Skip to content

Commit

Permalink
chore: allow chainId for msgBroadcaster
Browse files Browse the repository at this point in the history
  • Loading branch information
bangjelkoski committed Nov 1, 2024
1 parent 132d0aa commit db70114
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/sdk-ts/src/core/tx/broadcaster/MsgBroadcasterWithPk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface MsgBroadcasterTxOptions {
}

interface MsgBroadcasterWithPkOptions {
network: Network
network?: Network

/**
* Only used if we want to override the default
Expand All @@ -52,6 +52,7 @@ interface MsgBroadcasterWithPkOptions {
}
privateKey: string | PrivateKey /* hex or PrivateKey class */
ethereumChainId?: EthereumChainId
chainId?: ChainId
simulateTx?: boolean
loggingEnabled?: boolean
txTimeout?: number // blocks to wait for tx to be included in a block
Expand Down Expand Up @@ -82,12 +83,13 @@ export class MsgBroadcasterWithPk {
public txTimeout = DEFAULT_BLOCK_TIMEOUT_HEIGHT

constructor(options: MsgBroadcasterWithPkOptions) {
const networkInfo = getNetworkInfo(options.network)
const endpoints = getNetworkEndpoints(options.network)
const network = options.network || Network.MainnetSentry
const networkInfo = getNetworkInfo(network)
const endpoints = getNetworkEndpoints(network)

this.gasBufferCoefficient = options.gasBufferCoefficient || 1.1
this.simulateTx = options.simulateTx || false
this.chainId = networkInfo.chainId
this.chainId = options.chainId || networkInfo.chainId
this.txTimeout = options.txTimeout || DEFAULT_BLOCK_TIMEOUT_HEIGHT
this.ethereumChainId =
options.ethereumChainId || networkInfo.ethereumChainId
Expand Down Expand Up @@ -142,7 +144,7 @@ export class MsgBroadcasterWithPk {
const tx = {
...transaction,
msgs: msgs,
ethereumAddress: ethereumWallet
ethereumAddress: ethereumWallet,
} as MsgBroadcasterTxOptions & { ethereumAddress: string }

const web3Msgs = msgs.map((msg) => msg.toWeb3())
Expand Down

0 comments on commit db70114

Please sign in to comment.