This commit is contained in:
2026-06-12 15:33:51 -04:00
parent 2213aab723
commit d2d2a4d596
5 changed files with 719 additions and 350 deletions

View File

@@ -10,7 +10,9 @@
use Zotlabs\Extend\Widget;
require_once 'addon/cry01/cry01_substrate.php';
require_once 'addon/cry01/cry01_chain.php';
require_once 'addon/cry01/cry01_attestation.php';
require_once 'addon/cry01/cry01_renderer.php';
require_once 'addon/cry01/cry01_spool.php';
@@ -161,8 +163,8 @@ function cry01_content() {
return cry01_render_manage($association_slug);
case 'lookup':
// Public Ğ1 balance lookup. No SASE gate, no wallet session, no
// storage of any kind. Address in, balance out.
// Public Ğ1 account lookup. No SASE gate, no wallet session, no
// storage of any kind. Address in, full AccountInfo out.
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!cry01_verify_csrf()) {
return cry01_render_error('Invalid form token. Please reload and try again.');
@@ -181,9 +183,10 @@ function cry01_content() {
// ----------------------------------------------------------------------------
function cry01_handle_lookup_post($association_slug, $access) {
// Public balance lookup: decode the pasted Ğ1 address, query the chain,
// re-render the landing page with the result (or an error) inline.
// No data is stored anywhere — this is a pure read.
// Public account lookup: decode the pasted Ğ1 address, query the chain
// for the full AccountInfo struct, re-render the landing page with the
// result (or an error) inline. No data is stored anywhere — this is a
// pure read.
$address = trim($_POST['g1_lookup_address'] ?? '');
if (!$address) {
@@ -200,8 +203,8 @@ function cry01_handle_lookup_post($association_slug, $access) {
]);
}
$balance = cry01_get_balance($account_id);
if ($balance === null) {
$info = cry01_get_account_info($account_id);
if ($info === null) {
return cry01_render_landing($association_slug, $access, [
'lookup_error' => 'Could not reach the Ğ1 network right now. Please try again shortly.',
'lookup_address' => $address,
@@ -209,8 +212,9 @@ function cry01_handle_lookup_post($association_slug, $access) {
}
return cry01_render_landing($association_slug, $access, [
'lookup_address' => $address,
'lookup_balance' => $balance,
'lookup_address' => $address,
'lookup_balance' => cry01_format_g1_amount($info['free']),
'lookup_account_info' => $info,
]);
}