{"modulePath":"github.com/smartcontractkit/chainlink-testing-framework","version":"v1.35.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package seth\n\n## Constants\n\n```go\nconst RootKeyNum = 0\n```\n\n## Variables\n\n```go\nvar ErrInsufficientEphemeralKeys = `\nError: Insufficient Ephemeral Addresses for Simulated Network\n\nTo operate on a simulated network, you must configure at least one ephemeral address. Currently, %d ephemeral address(es) are set. Please update your TOML configuration file as follows to meet this requirement:\n[Seth] ephemeral_addresses_number = 1\n\nThis adjustment ensures that your setup is minimally viable. Although it is highly recommended to use at least 20 ephemeral addresses.\n`\n```\n\n```go\nvar ErrInsufficientStaticKeys = `\nError: Insufficient Private Keys for Live Network\n\nTo run this test on a live network, you must either:\n1. Set at least two private keys in the '[Network.WalletKeys]' section of your TOML configuration file. Example format:\n   [Network.WalletKeys]\n   NETWORK_NAME=[\"PRIVATE_KEY_1\", \"PRIVATE_KEY_2\"]\n2. Set at least two private keys in the '[Network.EVMNetworks.NETWORK_NAME] section of your TOML configuration file. Example format:\n   evm_keys=[\"PRIVATE_KEY_1\", \"PRIVATE_KEY_2\"]\n\nCurrently, only %d private key/s is/are set.\n\nRecommended Action:\nDistribute your funds across multiple private keys and update your configuration accordingly. Even though 1 private key is sufficient for testing, it is highly recommended to use at least 10 private keys.\n`\n```\n\n```go\nvar OneEphemeralKeysLiveTestnetAutoFixFn = func(sethCfg *pkg_seth.Config) error {\n\tconcurrency := sethCfg.GetMaxConcurrency()\n\n\tif sethCfg.IsSimulatedNetwork() {\n\t\tif concurrency \u003c 1 {\n\t\t\treturn fmt.Errorf(ErrInsufficientEphemeralKeys, 0)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tif sethCfg.EphemeralAddrs != nil \u0026\u0026 int(*sethCfg.EphemeralAddrs) \u003e 0 {\n\t\tvar zero int64 = 0\n\t\tsethCfg.EphemeralAddrs = \u0026zero\n\t}\n\n\tif concurrency \u003c 1 {\n\t\treturn fmt.Errorf(ErrInsufficientStaticKeys, len(sethCfg.Network.PrivateKeys))\n\t}\n\n\treturn nil\n}\n```\nOneEphemeralKeysLiveTestnetAutoFixFn checks whether there's at least one ephemeral key on a simulated network or at least one static key on a live network, and that there are no ephemeral keys on a live network (if ephemeral keys count is different from zero, it will disable them). Root key is excluded from the check.\n\n```go\nvar OneEphemeralKeysLiveTestnetCheckFn = func(sethCfg *pkg_seth.Config) error {\n\tconcurrency := sethCfg.GetMaxConcurrency()\n\n\tif sethCfg.IsSimulatedNetwork() {\n\t\tif concurrency \u003c 1 {\n\t\t\treturn fmt.Errorf(ErrInsufficientEphemeralKeys, 0)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tif sethCfg.EphemeralAddrs != nil \u0026\u0026 int(*sethCfg.EphemeralAddrs) \u003e 0 {\n\t\tephMsg := `\n\t\t\tError: Ephemeral Addresses Detected on Live Network\n\n\t\t\tEphemeral addresses are currently set for use on a live network, which is not permitted. The number of ephemeral addresses set is %d. Please make the following update to your TOML configuration file to correct this:\n\t\t\t'[Seth] ephemeral_addresses_number = 0'\n\n\t\t\tAdditionally, ensure the following requirements are met to run this test on a live network:\n\t\t\t1. Use more than one private key in your network configuration.\n\t\t\t`\n\n\t\treturn errors.New(ephMsg)\n\t}\n\n\tif concurrency \u003c 1 {\n\t\treturn fmt.Errorf(ErrInsufficientStaticKeys, len(sethCfg.Network.PrivateKeys))\n\t}\n\n\treturn nil\n}\n```\nOneEphemeralKeysLiveTestnetCheckFn checks whether there's at least one ephemeral key on a simulated network or at least one static key on a live network, and that there are no ephemeral keys on a live network. Root key is excluded from the check.\n\n## Functions\n\n```go\nfunc AvailableSethKeyNum(client *pkg_seth.Client) int\n```\nAvailableSethKeyNum returns the available Seth address index If there are multiple addresses, it will return any synced key Otherwise it will return the root key\n\n```go\nfunc GetChainClient(c config.SethConfig, network blockchain.EVMNetwork) (*pkg_seth.Client, error)\n```\nGetChainClient returns a seth client for the given network after validating the config\n\n```go\nfunc GetChainClientWithConfigFunction(c config.SethConfig, network blockchain.EVMNetwork, configFn ConfigFunction) (*pkg_seth.Client, error)\n```\nGetChainClientWithConfigFunction returns a seth client for the given network after validating the config and applying the config function\n\n```go\nfunc MergeSethAndEvmNetworkConfigs(evmNetwork blockchain.EVMNetwork, sethConfig pkg_seth.Config) (pkg_seth.Config, error)\n```\nMergeSethAndEvmNetworkConfigs merges EVMNetwork to Seth config. If Seth config already has Network settings, it will return unchanged Seth config that was passed to it. If the network is simulated, it will use Geth-specific settings. Otherwise, it will use the chain ID to find the correct network settings. If no match is found it will return error.\n\n```go\nfunc MustReplaceSimulatedNetworkUrlWithK8(l zerolog.Logger, network blockchain.EVMNetwork, testEnvironment environment.Environment) blockchain.EVMNetwork\n```\nMustReplaceSimulatedNetworkUrlWithK8 replaces the simulated network URL with the K8 URL and returns the network. If the network is not simulated, it will return the network unchanged.\n\n```go\nfunc ValidateSethNetworkConfig(cfg *pkg_seth.Network) error\n```\nValidateSethNetworkConfig validates the Seth network config\n\n## Types\n\n```go\ntype ConfigFunction = func(*pkg_seth.Config) error\n```\n\n","path":"github.com/smartcontractkit/chainlink-testing-framework/utils/seth","name":"seth","synopsis":"","isRedistributable":true}
