Skip to content

Commit

Permalink
refactor: broadcaster for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
bangjelkoski committed Feb 12, 2025
1 parent a2ac8c4 commit a66fa2f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions packages/wallets/wallet-core/src/broadcaster/MsgBroadcaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ export class MsgBroadcaster {

try {
return isCosmosWallet(walletStrategy.wallet)
? await this.broadcastCosmos(txWithAddresses)
? await this.broadcastDirectSign(txWithAddresses)
: isEip712V2OnlyWallet(walletStrategy.wallet)
? await this.broadcastWeb3V2(txWithAddresses)
: await this.broadcastWeb3(txWithAddresses)
? await this.broadcastEip712V2(txWithAddresses)
: await this.broadcastEip712(txWithAddresses)
} catch (e) {
const error = e as any

Expand Down Expand Up @@ -208,8 +208,8 @@ export class MsgBroadcaster {

try {
return isCosmosWallet(walletStrategy.wallet)
? await this.broadcastCosmos(txWithAddresses)
: await this.broadcastWeb3V2(txWithAddresses)
? await this.broadcastDirectSign(txWithAddresses)
: await this.broadcastEip712V2(txWithAddresses)
} catch (e) {
const error = e as any

Expand Down Expand Up @@ -246,8 +246,8 @@ export class MsgBroadcaster {

try {
return isCosmosWallet(walletStrategy.wallet)
? await this.broadcastCosmosWithFeeDelegation(txWithAddresses)
: await this.broadcastWeb3WithFeeDelegation(txWithAddresses)
? await this.broadcastDirectSignWithFeeDelegation(txWithAddresses)
: await this.broadcastEip712WithFeeDelegation(txWithAddresses)
} catch (e) {
const error = e as any

Expand All @@ -268,7 +268,7 @@ export class MsgBroadcaster {
* @param tx The transaction that needs to be broadcasted
* @returns transaction hash
*/
private async broadcastWeb3(tx: MsgBroadcasterTxOptionsWithAddresses) {
private async broadcastEip712(tx: MsgBroadcasterTxOptionsWithAddresses) {
const { chainId, txTimeout, endpoints, ethereumChainId, walletStrategy } =
this
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs]
Expand Down Expand Up @@ -380,7 +380,7 @@ export class MsgBroadcaster {
* @param tx The transaction that needs to be broadcasted
* @returns transaction hash
*/
private async broadcastWeb3V2(tx: MsgBroadcasterTxOptionsWithAddresses) {
private async broadcastEip712V2(tx: MsgBroadcasterTxOptionsWithAddresses) {
const { walletStrategy, chainId, txTimeout, endpoints, ethereumChainId } =
this
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs]
Expand Down Expand Up @@ -489,7 +489,7 @@ export class MsgBroadcaster {
* @param tx The transaction that needs to be broadcasted
* @returns transaction hash
*/
private async broadcastWeb3WithFeeDelegation(
private async broadcastEip712WithFeeDelegation(
tx: MsgBroadcasterTxOptionsWithAddresses,
): Promise<TxResponse> {
const {
Expand Down Expand Up @@ -577,7 +577,7 @@ export class MsgBroadcaster {
throw e
}

return await this.broadcastWeb3WithFeeDelegation(tx)
return await this.broadcastEip712WithFeeDelegation(tx)
}

return await this.retryOnException(exception, broadcast)
Expand All @@ -594,7 +594,7 @@ export class MsgBroadcaster {
* @param tx The transaction that needs to be broadcasted
* @returns transaction hash
*/
private async broadcastCosmos(tx: MsgBroadcasterTxOptionsWithAddresses) {
private async broadcastDirectSign(tx: MsgBroadcasterTxOptionsWithAddresses) {
const { walletStrategy, txTimeout, endpoints, chainId } = this
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs]

Expand Down Expand Up @@ -833,7 +833,7 @@ export class MsgBroadcaster {
* @param tx The transaction that needs to be broadcasted
* @returns transaction hash
*/
private async broadcastCosmosWithFeeDelegation(
private async broadcastDirectSignWithFeeDelegation(
tx: MsgBroadcasterTxOptionsWithAddresses,
) {
const {
Expand Down

0 comments on commit a66fa2f

Please sign in to comment.