use BEIMINT\Services\IPFS; use BEIMINT\Services\Contract; final class ListingSync { /** * 注册挂钩:在 mint 完成后与链上同步 */ public static function boot(): void { add_action('beimint_after_mint', [self::class, 'syncListing'], 10, 2); add_action('save_post_bei_mint_entry', [self::class, 'syncListing'], 20, 2); // 如需在后台显示同步记录,可额外挂载 Admin 页面 Admin::boot(); } /** * 同步至链上市场 * * @param array $ret beiimint_after_mint 返回的结果数组 * @param int $user_id 当前用户 ID */ public static function syncListing(array $ret, int $user_id): void { $post_id = $ret['post_id'] ?? 0; $cid = $ret['cid'] ?? ''; if (! $post_id || ! $cid) { return; } $payload = [ 'post_id' => $post_id, 'cid' => $cid, 'title' => get_the_title($post_id), 'author' => $user_id, 'timestamp' => time(), ]; try { // 1. 上传资产元数据到 IPFS $metaCid = (new IPFS())->addJson($payload); // 2. 调用市场合约方法上架 $txHash = (new Contract('BEIMarketplace'))->listAsset($post_id, $metaCid); // 3. 保存交易哈希,供后台查询 update_post_meta($post_id, 'market_tx', $txHash); } catch (\Exception $e) { error_log(sprintf('[ListingSync] 市场同步失败 (post %d): %s', $post_id, $e->getMessage())); } } }use BEIMINT\Services\IPFS; use BEIMINT\Services\Contract; final class ListingSync { /** * 注册挂钩:在 mint 完成后与链上同步 */ public static function boot(): void { add_action('beimint_after_mint', [self::class, 'syncListing'], 10, 2); add_action('save_post_bei_mint_entry', [self::class, 'syncListing'], 20, 2); // 如需在后台显示同步记录,可额外挂载 Admin 页面 Admin::boot(); } /** * 同步至链上市场 * * @param array $ret beiimint_after_mint 返回的结果数组 * @param int $user_id 当前用户 ID */ public static function syncListing(array $ret, int $user_id): void { $post_id = $ret['post_id'] ?? 0; $cid = $ret['cid'] ?? ''; if (! $post_id || ! $cid) { return; } $payload = [ 'post_id' => $post_id, 'cid' => $cid, 'title' => get_the_title($post_id), 'author' => $user_id, 'timestamp' => time(), ]; try { // 1. 上传资产元数据到 IPFS $metaCid = (new IPFS())->addJson($payload); // 2. 调用市场合约方法上架 $txHash = (new Contract('BEIMarketplace'))->listAsset($post_id, $metaCid); // 3. 保存交易哈希,供后台查询 update_post_meta($post_id, 'market_tx', $txHash); } catch (\Exception $e) { error_log(sprintf('[ListingSync] 市场同步失败 (post %d): %s', $post_id, $e->getMessage())); } } } BEIEcology – Behavior. Economy. Identity. Sovereign Ecosystem 行為・經濟・身份. 主權生態體系

BEIEcology

A commitment to innovation and sustainability

Études is a pioneering firm that seamlessly merges creativity and functionality to redefine architectural excellence.

Building exterior in Toronto, Canada

A passion for creating spaces

Our comprehensive suite of professional services caters to a diverse clientele, ranging from homeowners to commercial developers.

Renovation and restoration

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Continuous Support

Experience the fusion of imagination and expertise with Études Architectural Solutions.

App Access

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Consulting

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Project Management

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Architectural Solutions

Experience the fusion of imagination and expertise with Études Architectural Solutions.

An array of resources

Our comprehensive suite of professional services caters to a diverse clientele, ranging from homeowners to commercial developers.

Études Architect App

  • Collaborate with fellow architects.
  • Showcase your projects.
  • Experience the world of architecture.
Tourist taking photo of a building
Windows of a building in Nuremberg, Germany

Études Newsletter

  • A world of thought-provoking articles.
  • Case studies that celebrate architecture.
  • Exclusive access to design insights.

“Études has saved us thousands of hours of work and has unlocked insights we never thought possible.”

Annie Steiner

CEO, Greenprint

Join 900+ subscribers

Stay in the loop with everything you need to know.