<commit_before><?php
require_once USERS_PLUGIN_DIR.'/vendor/autoload.php';
use Web3\Web3;
use Web3\Contract;
use Crypto\Keccak;

/**
 * @module Users
 */
/**
 * Class handle with BlockChain
 *
 * @class Users_Web3
 */
class Users_Web3 extends Base_Users_Web3 {
	static $useCache = null;
	static $networks = array();

	/**
	 * Get needed environment variables
	 *
	 * @method construct
	 * @param {String} $network - chainId
	 * @static
	 */
	private static function construct($network) {
		if (self::$useCache === null) {
			self::$useCache = Q_Config::get("Users", "apps", "wallet", Users::communityId(), "Web3", "useCache", true);
		}

		if (self::$networks[$network]) {
			return;
		}

		$networks = Q_Config::expect(Users::communityId(), "networks");
		foreach ($networks as $n) {
			if ($n["chainId"] == $network) {
				self::$networks[$network]["network"] = $n;
				break;
			}
		}

		self::$networks[$network]["web3"] = new Web3(self::$networks[$network]["network"]["rpcUrls"][0]);

		$abi = file_get_contents(implode(DS, array(APP_WEB_DIR, "js", "nft-contract.abi.json")));
		self::$networks[$network]["contract"] = new Contract(self::$networks[$network]["network"]["rpcUrls"][0], $abi);
	}

	/**
	 * Aggregator for methods<commit_msg>Updated Users_Web3 class related to NFT config changes.<commit_after><?php
require_once USERS_PLUGIN_DIR.'/vendor/autoload.php';
use Web3\Web3;
use Web3\Contract;
use Crypto\Keccak;

/**
 * @module Users
 */
/**
 * Class handle with BlockChain
 *
 * @class Users_Web3
 */
class Users_Web3 extends Base_Users_Web3 {
	static $useCache = null;
	static $networks = array();

	/**
	 * Get needed environment variables
	 *
	 * @method construct
	 * @param {String} $network - chainId
	 * @static
	 */
	private static function construct($network) {
		if (self::$useCache === null) {
			self::$useCache = Q_Config::get("Users", "apps", "wallet", Users::communityId(), "Web3", "useCache", true);
		}

		if (self::$networks[$network]) {
			return;
		}

		$networks = Q_Config::expect("Assets", "Web3", "NFT", "networks");
		foreach ($networks as $n) {
			if ($n["chainId"] == $network) {
				self::$networks[$network]["network"] = $n;
				break;
			}
		}

		self::$networks[$network]["web3"] = new Web3(self::$networks[$network]["network"]["rpcUrls"][0]);

		$abi = file_get_contents(implode(DS, array(APP_WEB_DIR, "js", "nft-contract.abi.json")));
		self::$networks[$network]["contract"] = new Contract(self::$networks[$network]["network"]["rpcUrls"][0], $abi);
	}

	/**
	 * Aggregator for methods
{'fraction_non_alphanumeric': 0.19636507309363888, 'fraction_numerical': 0.009482418016594232, 'mean_word_length': 4.794050343249428, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5991890', 'n_tokens_mistral': 947, 'n_tokens_neox': 899, 'n_words': 176}