Reputation: 28627
How does one configure either Truffle itself,
or Truffle's HDWalletProvider
such that the poll interval is different?
I would like my Truffle instance to be less "chatty" over JSON-RPC, when it has submitted a transaction and is waiting for a result, be decreasing the polling interval from it's default value.
I was not able to find this option in the following documentation:
In truffle-config.js
, within networks
:
testnet: {
provider: () => new HDWalletProvider(
SEED_PHRASE,
'https://localhost:4444/',
),
gasPrice: Math.floor(GAS_PRICE),
networkCheckTimeout: 1e3,
},
Upvotes: 3
Views: 1022
Reputation: 585
Not sure about HDWalletProvider, and, like you, could not find any documentation regarding the polling rate for it. After browsing the source, I've come to the conclusion that HDWalletProvider doesn't include a built-in mechanism for poll-rate limiting, though I may be incorrect.
Apologies that I couldn't find exactly what you're looking for, but hopefully this will fit your needs. I'll have more time to go over the source this weekend, and I'll update this answer if I find anything additional.
Update:
After seeing your mention of the pollingInterval
field for Web3ProviderEngine
, you could access the corresponding engine.pollingInterval
field for your instance of HDWalletProvider
. If you're unclear on object instantiation and fields in TypeScript, I'd recommend opening another question on that topic, or perusing existing resources such as this question.
Upvotes: 1
Reputation: 28627
Patched @truffle/hdwallet-provider
to add pollingInterval
.
This is now available in
[email protected]
.
Patched truffle
to add deploymentPollingInterval
.
This is now available in
[email protected]
.
Example:
testnet: {
provider: () => new HDWalletProvider({
mnemonic: {
phrase: SEED_PHRASE,
},
providerOrUrl: 'http://localhost:4444',
pollingInterval: 8000,
}),
gasPrice: Math.floor(GAS_PRICE),
networkCheckTimeout: 8000,
deploymentPollingInterval: 8000,
},
When unspecified, the default value for pollingInterval
and deploymentPollingInterval
are both 4000
; so the above example has the effect of making it half as "chatty" over JSON-RPC, when polling for blocks, and when running truffle migrate
.
Upvotes: 3