-
Notifications
You must be signed in to change notification settings - Fork 0
E2E test #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
E2E test #1
Conversation
…lication by 1e18.
…ignore, and make MULTISIG_ADDRESS optional
There was a problem hiding this 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> => { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont' expose mnemonics please
No description provided.