Not sure what is “setting the hub” means.
When you use “gsn start
”, GSN is all set up, so all you need to do in your code is bring up a RelayProvider
{ relayHubAddress, naivePaymasterAddress, forwarderAddress } =
GsnTestEnvironment.loadDeployment('./build/gsn')
gsnConfig = await resolveConfigurationGSN({
forwarderAddress, paymasterAddress:naivePaymasterAddress })
gsnProvider = new RelayProvider(web3provider, gsnConfig)
You need the forwarder to update your recipient contract. You usually don’t need the relayHub itself, only the paymaster, since the paymaster is already pre-configured with the right relayHub.
You only need the relayHub itself if you want to deploy your own paymaster.
NOTE: With v2.0.3 (just released…), you no longer need the “resolveConfigurationGSN”, and can pass the configuration directly to the RelayProvider