chore: updated function declaration for keccak256 7d1f3a48
Steve · 2025-09-21 09:51 1 file(s) · +22 −6
src/components/contract-call.js +22 −6
367 367
		return result;
368 368
	}
369 369
370 -
	keccak256 = (input) => {
371 -
		// Use the global keccak256 function from the sha3 library
370 +
	keccak256(input) {
372 371
		if (typeof window.keccak256 === "function") {
373 372
			return window.keccak256(input);
374 373
		} else {
375 -
			throw new Error(
376 -
				"keccak256 function not available. Make sure the sha3 library is loaded.",
377 -
			);
374 +
			throw new Error("keccak256 function not available");
378 375
		}
379 -
	};
376 +
	}
380 377
381 378
	// UI helper methods
382 379
	getCSSVariable(name, defaultValue) {
605 602
}
606 603
607 604
customElements.define("contract-call", ContractCall);
605 +
606 +
/**
607 +
 * ============================================================================
608 +
 * KECCAK256 DEPENDENCY - DO NOT EDIT BELOW THIS LINE
609 +
 * ============================================================================
610 +
 *
611 +
 * The following code is a third-party implementation of the Keccak/SHA-3
612 +
 * cryptographic hash functions. This code should not be modified as it
613 +
 * provides the necessary keccak256 functionality for the ContractCall component.
614 +
 *
615 +
 * ============================================================================
616 +
 */
608 617
609 618
/**
610 619
 * [js-sha3]{@link https://github.com/emn178/js-sha3}
1401 1410
			define(function () {
1402 1411
				return methods;
1403 1412
			});
1413 +
		}
1414 +
	}
1415 +
1416 +
	// Ensure functions are always available globally in browser
1417 +
	if (typeof window !== "undefined") {
1418 +
		for (let i = 0; i < methodNames.length; ++i) {
1419 +
			window[methodNames[i]] = methods[methodNames[i]];
1404 1420
		}
1405 1421
	}
1406 1422
})();