You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many times i see that "config" (from ConfigHelper) object is not defined (its null)
Because when we are calling certain classes that extend from SmartContract, like new NFTFactory(...) calls for instance, we are neither providing a valid config param, neither providing the network param ... without this info..
This line (on SDK SmartContract class): this.config = config || new ConfigHelper().getConfig(network)
will resolve to null. Both config and network params are optional, but in reality we need to have one or the other...
One example of the wronng usage is on the src->helpers -> createAsset function
...
const nftFactory = new NftFactory(config.nftFactoryAddress, owner);
...
Bellow is the abstract class constructor on the SDK...
/**
* Instantiate the smart contract.
* @param {Signer} signer The signer object.
* @param {string | number} [network] Network id or name
* @param {Config} [config] The configuration object.
* @param {AbiItem[]} [abi] ABI array of the smart contract
*/
constructor(
signer: Signer,
network?: string | number,
config?: Config,
abi?: AbiItem[]
) {
this.signer = signer
this.config = config || new ConfigHelper().getConfig(network)
this.abi = abi || this.getDefaultAbi()
}
Note the "no config found" message bellow for the "undefined" network. When this happens config is null.
Some operations require multiple calls to getconfig() and this can lead to strange issues
The text was updated successfully, but these errors were encountered:
Many times i see that "config" (from
ConfigHelper
) object is not defined (itsnull
)Because when we are calling certain classes that extend from
SmartContract
, likenew NFTFactory(...)
calls for instance, we are neither providing a validconfig
param, neither providing thenetwork
param ... without this info..This line (on SDK SmartContract class):
this.config = config || new ConfigHelper().getConfig(network)
will resolve to null. Both
config
and networkparams
are optional, but in reality we need to have one or the other...One example of the wronng usage is on the
src->helpers -> createAsset
functionBellow is the abstract class constructor on the SDK...
Note the "no config found" message bellow for the "undefined" network. When this happens config is
null
.Some operations require multiple calls to
getconfig()
and this can lead to strange issuesThe text was updated successfully, but these errors were encountered: