Skip to content

Commit

Permalink
get chainId once if null. Not every tx 👀. should speed up things
Browse files Browse the repository at this point in the history
  • Loading branch information
luca992 committed Nov 15, 2022
1 parent 78397f4 commit 761920c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ open class CosmWasmClient protected constructor(
apiUrl: String,
encryptionUtils: EncryptionUtils,
broadcastMode: BroadcastMode = BroadcastMode.Block,
private var chainId: String? = null
var chainId: String? = null
) {
internal val restClient = RestClient(apiUrl, broadcastMode, encryptionUtils)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ private constructor(
account.address == senderAddress
} ?: throw Error("Failed to retrieve account from signer")
val nonceResult = getNonce(senderAddress)
if (chainId == null) {
chainId = getChainId()
}
val signerData = txOptions.explicitSignerData
?: SignerData(nonceResult.accountNumber, nonceResult.sequence, getChainId())
?: SignerData(nonceResult.accountNumber, nonceResult.sequence, chainId!!)
val fee = StdFee(
gas = txOptions.gasLimit,
amount = listOf(
Expand Down

0 comments on commit 761920c

Please sign in to comment.