Skip to content

Conversation

@towanTG
Copy link
Collaborator

@towanTG towanTG commented Sep 10, 2025

No description provided.

towanTG added 16 commits August 20, 2025 13:25
- Add sign and signAndBroadcast methods to UTXO toolboxes (Bitcoin, Litecoin, Dogecoin, Zcash)
- Add sign and signAndBroadcast methods to EVM toolbox
- Add unified sign and signAndBroadcast methods to Solana toolbox
- Handle BitcoinCash special case with TransactionBuilder instead of PSBT
- Create implementation plans for full wallet integration
- Create getSignTransaction and getSignAndBroadcastTransaction functions
- Use ethers.js TransactionRequest type for incoming transactions
- Ensure sign and signAndBroadcast have matching signatures
- Clean separation of concerns for signing logic
- Rename 'sign' to 'signTransaction' across all toolboxes
- Rename 'signAndBroadcast' to 'signAndSendTransaction' across all toolboxes
- Better naming convention that clearly indicates the action being performed
- Consistent naming across UTXO, EVM, and Solana toolboxes
@@ -1,416 +1,426 @@
// biome-ignore assist/source/useSortedKeys: keys are sorted by topic
Copy link
Collaborator

Choose a reason for hiding this comment

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

🙏

Comment on lines 153 to 160
.with(Chain.Tron, async () => {
const transaction = TronTransactionSchema.safeParse(tx);
if (!transaction.success) {
throw new SwapKitError("plugin_swapkit_invalid_tx_data", { chain, tx });
}

return await getWallet(chain as Chain.Tron).signAndBroadcastTransaction(transaction.data);
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about:

Suggested change
.with(Chain.Tron, async () => {
const transaction = TronTransactionSchema.safeParse(tx);
if (!transaction.success) {
throw new SwapKitError("plugin_swapkit_invalid_tx_data", { chain, tx });
}
return await getWallet(chain as Chain.Tron).signAndBroadcastTransaction(transaction.data);
})
.with(...CosmosChains, Chain.Near, Chain.Tron, async (chain) => {
const transaction = safeTxParse({ chain, tx })
if (!transaction.success) {
throw new SwapKitError("plugin_swapkit_invalid_tx_data", { chain, tx });
}
return await getWallet(chain).signAndBroadcastTransaction(transaction.data);
})


const transaction = { ...tx, ...gasPrices, gasLimit };

// Sign the transaction
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Sign the transaction

// Sign the transaction
const signedTx = await signer.signTransaction(transaction);

// Broadcast the signed transaction
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Broadcast the signed transaction

// Sign the transaction
const signedTx = await signTransaction(tx);

// Broadcast the signed transaction
Copy link
Collaborator

Choose a reason for hiding this comment

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

😡

Copy link
Collaborator

Choose a reason for hiding this comment

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

those comments are always just rephrase code written below. Please remove

Comment on lines +133 to +136
signAndBroadcastTransaction: async (transaction: Transaction | VersionedTransaction) => {
const signedTx = await signTransaction(getConnection, signer)(transaction);
return broadcastTransaction(getConnection)(signedTx);
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see a way to have it cleaner in future but we can keep it for now.

I.e. we could extract this signTransaction init a little bit earlier and just pass it's instance to those functions ;)

Transaction,
TransactionBuilder,
// @ts-expect-error
} from "@psf/bitcoincashjs-lib";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we remove this dep completely? PLEASE say yes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we can 👀

@ice-chillios ice-chillios marked this pull request as draft October 8, 2025 13:28
@ice-chillios ice-chillios force-pushed the develop branch 2 times, most recently from 1b0724e to 1e45499 Compare November 21, 2025 07:35
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.

3 participants