diff --git a/docs.json b/docs.json index c55ab983..c42a0b16 100644 --- a/docs.json +++ b/docs.json @@ -1004,7 +1004,8 @@ "guides/using-unity-iap-to-sell-nfts", "guides/unity-primary-sales", "guides/unity-webgl-telegram", - "guides/telegram-integration" + "guides/telegram-integration", + "guides/packs" ] } ] diff --git a/es/guides/guide-cards.json b/es/guides/guide-cards.json index 2f0666e4..6d6b18da 100644 --- a/es/guides/guide-cards.json +++ b/es/guides/guide-cards.json @@ -1 +1 @@ -{"lastUpdated":"2025-09-03T12:15:39.593Z","totalCards":6,"sections":[{"title":"Desarrolladores de videojuegos","cards":[{"title":"Cree un juego móvil con Unity + Sequence","img":"/images/unity/jellyforest-iphone.jpg","href":"/guias/jelly-forest-unity-guia","description":"Aprenda a crear un juego atractivo para iOS y Android que utiliza Sequence Embedded Wallets en segundo plano para habilitar un marketplace integrado y una moneda dentro del juego."},{"title":"Cómo crear un juego con Unreal Engine","img":"/images/guides/overview/unreal-ew-guide.th.png","href":"/guias/unreal-ew-guia","description":"Utilice el SDK de Unreal de Sequence para mostrar información de Embedded Wallet, firmar mensajes y enviar transacciones."},{"title":"Cree un juego Dungeon Crawler con recompensas generadas por IA","img":"/images/guides/treasure-chest/dungeonMinter.th.png","href":"/guias/tesoro-guia","description":"Con este tutorial, cree un laberinto web donde los objetos de caja de recompensas (lootbox) se generan usando IA y se mintean dinámicamente en el wallet universal del jugador."},{"title":"Cree un juego WebGL en Typescript","img":"/images/aviator.th.jpg","href":"/guias/webgl-guia","description":"Siga una guía paso a paso para crear una demo de juego web que utiliza Sequence Embedded Wallet y tokens de logros personalizados dentro del juego."},{"title":"Venda objetos del juego a través de una tienda web","img":"/images/guides/overview/primary-sales.th.jpg","href":"/guias/ventas-primarias","description":"Impulse el crecimiento de su juego vendiendo objetos directamente a sus jugadores. En esta guía, le mostraremos cómo desplegar un contrato de Primary Sale paso a paso usando cualquier moneda personalizada o existente para una tienda web que utiliza objetos del juego de un contrato ERC1155."},{"title":"Compre artículos on-chain en Unity","img":"/images/guides/overview/unity-primary-sales.th.jpg","href":"/guias/unity-ventas-primarias","description":"Esta guía cubre la creación de una Primary Sale con el SDK de Unity de Sequence."}]}]} \ No newline at end of file +{"lastUpdated":"2025-09-03T12:15:39.593Z","totalCards":"6","sections":[{"title":"Desarrolladores de videojuegos","cards":[{"title":"Cree un juego móvil con Unity + Sequence","img":"/images/unity/jellyforest-iphone.jpg","href":"/guias/jelly-forest-unity-guia","description":"Aprenda a crear un juego atractivo para iOS y Android que utiliza Sequence Embedded Wallets en segundo plano para habilitar un marketplace integrado y una moneda dentro del juego."},{"title":"Cómo crear un juego con Unreal Engine","img":"/images/guides/overview/unreal-ew-guide.th.png","href":"/guias/unreal-ew-guia","description":"Utilice el SDK de Unreal de Sequence para mostrar información de Embedded Wallet, firmar mensajes y enviar transacciones."},{"title":"Cree un juego Dungeon Crawler con recompensas generadas por IA","img":"/images/guides/treasure-chest/dungeonMinter.th.png","href":"/guias/tesoro-guia","description":"Con este tutorial, cree un laberinto web donde los objetos de caja de recompensas (lootbox) se generan usando IA y se mintean dinámicamente en el wallet universal del jugador."},{"title":"Cree un juego WebGL en Typescript","img":"/images/aviator.th.jpg","href":"/guias/webgl-guia","description":"Siga una guía paso a paso para crear una demo de juego web que utiliza Sequence Embedded Wallet y tokens de logros personalizados dentro del juego."},{"title":"Venda objetos del juego a través de una tienda web","img":"/images/guides/overview/primary-sales.th.jpg","href":"/guias/ventas-primarias","description":"Impulse el crecimiento de su juego vendiendo objetos directamente a sus jugadores. En esta guía, le mostraremos cómo desplegar un contrato de Primary Sale paso a paso usando cualquier moneda personalizada o existente para una tienda web que utiliza objetos del juego de un contrato ERC1155."},{"title":"Compre artículos on-chain en Unity","img":"/images/guides/overview/unity-primary-sales.th.jpg","href":"/guias/unity-ventas-primarias","description":"Esta guía cubre la creación de una Primary Sale con el SDK de Unity de Sequence."},{"title":"Configurar un contrato ERC1155Pack","img":"/images/guides/overview/packs.th.jpg","href":"/guides/packs","description":"Esta guía explica cómo configurar un contrato ERC1155Pack usando Sequence Builder."}]}]} \ No newline at end of file diff --git a/es/guides/guide-overview.mdx b/es/guides/guide-overview.mdx new file mode 100644 index 00000000..ae8824c1 --- /dev/null +++ b/es/guides/guide-overview.mdx @@ -0,0 +1,60 @@ +--- +title: Guías +description: Siga nuestras guías paso a paso y utilice plantillas de código abierto para acelerar su salida al mercado. +mode: wide +sidebarTitle: Descripción general +--- + + + + Aprovechando la Transaction API de Sequence y un entorno serverless, creará un servicio de minteo escalable para NFTs u otras transacciones que maneja automáticamente las complejidades de blockchain como reorganizaciones, gestión de nonce y paralelización de transacciones. + + + + Aprenda cómo conectar Privy con Sequence, permitiendo que sus usuarios inicien sesión e interactúen con su aplicación a través de un Sequence Smart Wallet. Esto implica crear un Sequence wallet controlado por un EOA gestionado por Privy del usuario, y luego usar ese Sequence wallet para enviar transacciones sin gas. + + + + Cree un marketplace impulsado por API donde los jugadores pueden mintear, vender o comprar objetos usando una interfaz web personalizada que utiliza las APIs de Orderbook de Sequence. + + + + Guía para consultar información sobre el uso de sus usuarios para su proyecto específico utilizando un Cloudflare Worker serverless. + + + + Utilizando la Metadata API de Sequence, puede crear, gestionar y almacenar metadatos asociados a sus NFTs desde casi cualquier entorno. Le mostraremos cómo utilizar estas REST-APIs para organizar las colecciones de su juego o experiencia. + + + +## Desarrolladores de videojuegos + + + + Aprenda a crear un juego atractivo para iOS y Android que utiliza Sequence Embedded Wallets en segundo plano para habilitar un marketplace integrado y una moneda dentro del juego. + + + + Utilice el SDK de Unreal de Sequence para mostrar información de Embedded Wallet, firmar mensajes y enviar transacciones. + + + + Con este tutorial, cree un laberinto web donde los objetos de caja de recompensas (lootbox) se generan usando IA y se mintean dinámicamente en el wallet universal del jugador. + + + + Siga una guía paso a paso para crear una demo de juego web que utiliza Sequence Embedded Wallet y tokens de logros personalizados dentro del juego. + + + + Impulse el crecimiento de su juego vendiendo objetos directamente a sus jugadores. En esta guía, le mostraremos cómo desplegar un contrato de Primary Sale paso a paso usando cualquier moneda personalizada o existente para una tienda web que utiliza objetos del juego de un contrato ERC1155. + + + + Esta guía cubre la creación de una Primary Sale con el SDK de Unity de Sequence. + + + + Esta guía explica cómo configurar un contrato ERC1155Pack usando Sequence Builder. + + \ No newline at end of file diff --git a/es/guides/packs.mdx b/es/guides/packs.mdx new file mode 100644 index 00000000..93bc34fe --- /dev/null +++ b/es/guides/packs.mdx @@ -0,0 +1,88 @@ +--- +title: Cómo configurar un contrato ERC1155Pack en Sequence Builder +description: Aprenda cómo funciona ERC1155Pack en Builder, incluyendo la mecánica de commit-reveal y la publicación del contenido de los packs. +sidebarTitle: Uso de un contrato ERC1155Pack +--- + +Utilice esta guía para configurar packs en su contrato ERC1155Pack dentro de Sequence Builder. El contrato `ERC1155Pack` amplía ERC1155Items para agregar un flujo de apertura de packs basado en un esquema de commit-reveal. + + + Requisito previo: desplegar contratos y colecciones + + Asegúrese de haber [creado un proyecto](/solutions/builder/getting-started), desplegado su contrato ERC1155Pack y también los contratos/colecciones ERC1155 o ERC721 cuyos ítems desea incluir en cada pack. + + +## Paso 1: Abra su contrato ERC1155Pack +Desde el panel de su proyecto, seleccione el contrato PACK que desea configurar y luego abra la pestaña `Pack` para gestionar su contenido. Confirme que está en la red y colección correctas antes de editar. + + + ![Resumen del contrato Pack](/images/builder/builder-packs-1.png) + + +## Paso 2: Elija o agregue un pack para editar +Use el selector de packs para elegir el pack que desea actualizar, o haga clic en `Add new pack` para crear una nueva entrada. La tabla muestra la dirección del token, tipo, IDs y cantidades que se incluirán al abrir un pack. + + + ![Seleccione el pack y revise el contenido](/images/builder/builder-packs-2.png) + + +## Paso 3: Suba el contenido del pack mediante CSV +Haga clic en `Add New Pack` o `Update Pack Contents` para abrir el cargador de CSV. Ingrese el `Pack ID` que desea modificar, defina el `Supply` para indicar cuántos packs pueden abrirse y suba un archivo CSV con una fila por cada contenido del pack. + +Cada fila debe incluir: +- `Pack Content ID` +- Para cada ítem: `Token Address`, `Token Type` (1155/721), `Token IDs` y `Amounts` + +p. ej. + +``` +Pack Content ID, Item 1 Token Addr, Item 1 Token Type, Item 1 Token IDs, Item 1 Amounts, Item 2 Token Addr, Item 2 Token Type, Item 2 Token IDs, Item 2 Amounts +1,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1200","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"5,6","7,3" +2,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1201","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9,10","7,9" +3,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1202","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"7,8","4,8" +4,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1203","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9","7" +5,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1204","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9,10","5,4" + +``` + + + ![Suba el CSV con el contenido del pack](/images/builder/builder-packs-3.png) + + + + El CSV reemplaza todo el contenido existente para el Pack ID seleccionado y reinicia el seguimiento de distribución de packs. + + Si ya ha distribuido packs para un ID específico, le recomendamos no cambiar el CSV, ya que esto reinicia el registro de packs abiertos. + + Si un ítem 721 ya fue distribuido en un pack anterior y aparece en un nuevo CSV de pack, fallará al mintear cuando un usuario abra ese pack. + + +## Paso 4: Asigne el rol de Minter al contrato de pack en su colección de ítems +Para que los packs puedan mintear ítems al abrirse, otorgue al contrato ERC1155Pack la función de `Minter` en la colección ERC1155 que utiliza para el contenido del pack. Abra la sección `Settings > Permissions` de ese contrato, agregue la dirección del contrato de pack y asigne `Minter`, luego firme la transacción. + +## Paso 5: Revise y publique +Después de procesar el CSV, verá una vista previa de las filas de contenido del pack analizadas. Verifique las direcciones de los tokens, IDs, cantidades y totales, luego haga clic en `Create Pack Contents` para guardar. Su pack ya está listo para que los jugadores lo abran. + + + ![Vista previa del contenido procesado y publicación](/images/builder/builder-packs-4.png) + + +¿Busca un frontend para abrir packs? Vea nuestro boilerplate en React en [https://github.com/0xsequence-demos/pack-opening-boilerplate/](https://github.com/0xsequence-demos/pack-opening-boilerplate/). + +## Cómo funciona ERC1155Pack +El contenido de los packs es gestionado por direcciones con `PACK_ADMIN_ROLE` usando `setPacksContent(bytes32 _merkleRoot, uint256 _supply, uint256 packId)`. El merkle root codifica todas las posibles combinaciones de contenido y `supply` define cuántos packs pueden abrirse para ese ID. Builder se encarga de crear el root a partir de su CSV para que usted solo se enfoque en el contenido. + +Flujo (on-chain): +- El usuario llama a `commit(packId)` para quemar su pack y crear un compromiso. +- Después de al menos un bloque, cualquier persona puede llamar a `reveal(user, packContent, proof, packId)` con una prueba de merkle para el contenido seleccionado; el contrato verifica y mintea los ítems. La API de Sequence lo hará automáticamente. +- Si no se llama a reveal antes de que expire el hash del bloque de compromiso (30 minutos), `refundPack(user, packId)` devuelve el pack. + +Aleatorización: +- El compromiso registra `block.number + 1` para la aleatoriedad. +- Reveal deriva `randomSeed = keccak256(abi.encode(blockHash, user))`. +- El contrato elige `randomSeed % remainingSupply[packId]`, usando un mapa `_availableIndices` al estilo Fisher–Yates para que cada contenido solo pueda revelarse una vez y se mantenga la aleatoriedad. +- La hoja de merkle es `keccak256(abi.encode(revealIdx, packContent))`, que se valida con la prueba proporcionada. + + + Los validadores o mineros que controlan bloques secuenciales podrían sesgar los hashes de bloque. Permitir que cualquiera llame a `reveal` ayuda a asegurar que los packs comprometidos se revelen antes de que expiren los hashes de bloque. + \ No newline at end of file diff --git a/guides/guide-cards.json b/guides/guide-cards.json index 1987c241..97a2c63a 100644 --- a/guides/guide-cards.json +++ b/guides/guide-cards.json @@ -40,6 +40,12 @@ "img": "/images/guides/overview/unity-primary-sales.th.jpg", "href": "/guides/unity-primary-sales", "description": "This guide covers the creation of a Primary Sale with Sequence's Unity SDK." + }, + { + "title": "Configure a ERC1155Pack Contract", + "img": "/images/guides/overview/packs.th.jpg", + "href": "/guides/packs", + "description": "This guide covers the configuration of a ERC1155Pack Contract via Sequence Builder." } ] } diff --git a/guides/guide-overview.mdx b/guides/guide-overview.mdx index 8070ae72..92412695 100644 --- a/guides/guide-overview.mdx +++ b/guides/guide-overview.mdx @@ -96,4 +96,11 @@ sidebarTitle: Overview > This guide covers the creation of a Primary Sale with Sequence's Unity SDK. + + This guide covers the configuration of a ERC1155Pack Contract via Sequence Builder. + diff --git a/guides/packs.mdx b/guides/packs.mdx new file mode 100644 index 00000000..f2a8ebbb --- /dev/null +++ b/guides/packs.mdx @@ -0,0 +1,95 @@ +--- +title: "How to Configure a ERC1155Pack Contract in Sequence Builder" +description: Learn how ERC1155Pack works in Builder, including commit-reveal mechanics, and publishing pack contents. +sidebarTitle: Using a ERC1155Pack Contract +--- + +Use this guide to configure packs in your ERC1155Pack contract in Sequence Builder. The `ERC1155Pack` contract extends ERC1155Items to add a pack-opening flow powered by a commit-reveal scheme. + + +Prerequisite: Deploy Contracts and Items + +Make sure you have [created a project](/solutions/builder/getting-started), deployed your ERC1155Pack contract, and deployed the ERC1155 or ERC721 contracts/collections whose items you want inside each pack. + + +## Step 1: Open your ERC1155Pack contract + +From your project dashboard, select the PACK contract you want to configure, then open the `Pack` tab to manage its contents. Confirm you are on the correct network and linked collection before editing. + +![Pack contract overview](/images/builder/builder-packs-1.png) + + +## Step 2: Choose or add a pack to edit + +Use the pack selector to pick the pack you want to update, or click `Add new pack` to create another pack entry. The table lists each pack's underlying token address, type, IDs, and amounts that will be included when a pack is opened. + +![Select pack and review contents](/images/builder/builder-packs-2.png) + + +## Step 3: Upload pack contents via CSV + +Click `Add New Pack` or `Update Pack Contents` to open the CSV uploader. Enter the `Pack ID` you want to modify, set the `Supply` for how many packs can be opened, and upload a CSV with one row per pack content. + +Each row must include: + +- `Pack Content ID` +- For each item: `Token Address`, `Token Type` (1155/721), `Token IDs`, and `Amounts` + +e.g. +``` +Pack Content ID, Item 1 Token Addr, Item 1 Token Type, Item 1 Token IDs, Item 1 Amounts, Item 2 Token Addr, Item 2 Token Type, Item 2 Token IDs, Item 2 Amounts +1,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1200","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"5,6","7,3" +2,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1201","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9,10","7,9" +3,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1202","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"7,8","4,8" +4,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1203","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9","7" +5,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1204","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9,10","5,4" + +``` + + +![Upload CSV for pack contents](/images/builder/builder-packs-3.png) + + + +The CSV replaces all existing contents for the selected Pack ID, and resets pack distribution tracking. + +If you have already distributed packs for a specific ID, we recommend you do not change the CSV, as this resets which packs have been opened. + +If a 721 item was already distributed in a previous pack, and it is in a new pack CSV, it will fail to mint when a user opens that pack. + + + +## Step 4: Give the pack contract a Minter role on your item collection + +For packs to mint items when opened, grant the ERC1155Pack contract address the `Minter` role on the ERC1155 collection you're using for pack contents. Open that item contract’s `Settings > Permissions`, add the pack contract address, and assign `Minter`, then sign the transaction. + +## Step 5: Review and publish + +After the CSV is processed you will see a preview of the parsed Pack Content rows. Verify the token addresses, IDs, amounts, and totals, then click `Create Pack Contents` to save. Your pack is now ready to be opened by players. + +![Preview processed pack contents and publish](/images/builder/builder-packs-4.png) + + +Looking for a frontend to open packs? Check out our react boilerplate at https://github.com/0xsequence-demos/pack-opening-boilerplate/. + + +## How ERC1155Pack works + +Pack contents are managed by addresses with `PACK_ADMIN_ROLE` using `setPacksContent(bytes32 _merkleRoot, uint256 _supply, uint256 packId)`. The merkle root encodes every possible pack content, and `supply` defines how many packs can be opened for that ID. Builder handles the root creation from your CSV so you can focus on content. + +Flow (on-chain): + +- User calls `commit(packId)` to burn their pack and create a commitment. +- After at least one block, anyone can call `reveal(user, packContent, proof, packId)` with a merkle proof for the selected content; the contract verifies and mints the items. The Sequence API will do this automatically. +- If reveal is not called before the commitment block hash expires (30 minutes), `refundPack(user, packId)` returns the pack. + +Randomization: + +- Commitment records `block.number + 1` for randomness. +- Reveal derives `randomSeed = keccak256(abi.encode(blockHash, user))`. +- The contract picks `randomSeed % remainingSupply[packId]`, using a Fisher–Yates-style `_availableIndices` map so each content can only be revealed once and stays uniformly random. +- The merkle leaf is `keccak256(abi.encode(revealIdx, packContent))`, matched by the supplied proof. + + +Validators or miners controlling sequential blocks could bias block hashes. Allowing anyone to call `reveal` helps ensure committed packs are revealed before block hashes expire. + diff --git a/images/builder/builder-packs-1.png b/images/builder/builder-packs-1.png new file mode 100644 index 00000000..bcdb969e Binary files /dev/null and b/images/builder/builder-packs-1.png differ diff --git a/images/builder/builder-packs-2.png b/images/builder/builder-packs-2.png new file mode 100644 index 00000000..869197ee Binary files /dev/null and b/images/builder/builder-packs-2.png differ diff --git a/images/builder/builder-packs-3.png b/images/builder/builder-packs-3.png new file mode 100644 index 00000000..696206a4 Binary files /dev/null and b/images/builder/builder-packs-3.png differ diff --git a/images/builder/builder-packs-4.png b/images/builder/builder-packs-4.png new file mode 100644 index 00000000..6a9a118c Binary files /dev/null and b/images/builder/builder-packs-4.png differ diff --git a/images/guides/overview/packs.png b/images/guides/overview/packs.png new file mode 100644 index 00000000..ae6e83d9 Binary files /dev/null and b/images/guides/overview/packs.png differ diff --git a/images/guides/overview/packs.th.jpg b/images/guides/overview/packs.th.jpg new file mode 100644 index 00000000..a47e720f Binary files /dev/null and b/images/guides/overview/packs.th.jpg differ diff --git a/ja/guides/guide-cards.json b/ja/guides/guide-cards.json index 6b65d970..1c28b990 100644 --- a/ja/guides/guide-cards.json +++ b/ja/guides/guide-cards.json @@ -1 +1 @@ -{"lastUpdated":"2025-09-03T12:15:39.593Z","totalCards":6,"sections":[{"title":"ゲーム開発者向け","cards":[{"title":"UnityとSequenceでモバイルゲームを構築する","img":"/images/unity/jellyforest-iphone.jpg","href":"/guides/jelly-forest-unity-guide","description":"Sequence Embedded Walletを内部的に活用し、統合マーケットプレイスやゲーム内通貨を備えた魅力的なiOS・Androidゲームの作り方を説明します。"},{"title":"Unreal Engineでゲームを構築する方法","img":"/images/guides/overview/unreal-ew-guide.th.png","href":"/guides/unreal-ew-guide","description":"SequenceのUnreal SDKを使って、Embedded Walletの情報表示、メッセージ署名、トランザクション送信を行いましょう。"},{"title":"AI生成報酬付きダンジョンクローラーゲームを作成する","img":"/images/guides/treasure-chest/dungeonMinter.th.png","href":"/guides/treasure-chest-guide","description":"このチュートリアルでは、AIで生成されたガチャアイテムをプレイヤーのユニバーサルウォレットに動的にミントする、ウェブベースの迷路ゲームを作成します。"},{"title":"TypescriptでWebGLゲームを構築する","img":"/images/aviator.th.jpg","href":"/guides/webgl-guide","description":"Sequence Embedded Walletとカスタムのゲーム内実績トークンを活用したウェブゲームデモを、ステップバイステップで作成できます。"},{"title":"ウェブショップでゲームアイテムを販売する","img":"/images/guides/overview/primary-sales.th.jpg","href":"/guides/primary-sales","description":"ゲーム成長を加速させるため、アイテムをプレイヤーに直接販売できます。本ガイドでは、ERC1155コントラクト由来のゲームアイテムを利用したウェブショップで、任意のカスタム通貨や既存通貨を使ってPrimary Saleコントラクトをデプロイする手順を説明します。"},{"title":"Unityでオンチェーンアイテムを購入する","img":"/images/guides/overview/unity-primary-sales.th.jpg","href":"/guides/unity-primary-sales","description":"このガイドでは、SequenceのUnity SDKを使ったPrimary Saleの作成方法を説明します。"}]}]} \ No newline at end of file +{"lastUpdated":"2025-09-03T12:15:39.593Z","totalCards":"6","sections":[{"title":"ゲーム開発者向け","cards":[{"title":"UnityとSequenceでモバイルゲームを構築する","img":"/images/unity/jellyforest-iphone.jpg","href":"/guides/jelly-forest-unity-guide","description":"Sequence Embedded Walletを内部的に活用し、統合マーケットプレイスやゲーム内通貨を備えた魅力的なiOS・Androidゲームの作り方を説明します。"},{"title":"Unreal Engineでゲームを構築する方法","img":"/images/guides/overview/unreal-ew-guide.th.png","href":"/guides/unreal-ew-guide","description":"SequenceのUnreal SDKを使って、Embedded Walletの情報表示、メッセージ署名、トランザクション送信を行いましょう。"},{"title":"AI生成報酬付きダンジョンクローラーゲームを作成する","img":"/images/guides/treasure-chest/dungeonMinter.th.png","href":"/guides/treasure-chest-guide","description":"このチュートリアルでは、AIで生成されたガチャアイテムをプレイヤーのユニバーサルウォレットに動的にミントする、ウェブベースの迷路ゲームを作成します。"},{"title":"TypescriptでWebGLゲームを構築する","img":"/images/aviator.th.jpg","href":"/guides/webgl-guide","description":"Sequence Embedded Walletとカスタムのゲーム内実績トークンを活用したウェブゲームデモを、ステップバイステップで作成できます。"},{"title":"ウェブショップでゲームアイテムを販売する","img":"/images/guides/overview/primary-sales.th.jpg","href":"/guides/primary-sales","description":"ゲーム成長を加速させるため、アイテムをプレイヤーに直接販売できます。本ガイドでは、ERC1155コントラクト由来のゲームアイテムを利用したウェブショップで、任意のカスタム通貨や既存通貨を使ってPrimary Saleコントラクトをデプロイする手順を説明します。"},{"title":"Unityでオンチェーンアイテムを購入する","img":"/images/guides/overview/unity-primary-sales.th.jpg","href":"/guides/unity-primary-sales","description":"このガイドでは、SequenceのUnity SDKを使ったPrimary Saleの作成方法を説明します。"},{"title":"ERC1155Packコントラクトの設定方法","img":"/images/guides/overview/packs.th.jpg","href":"/guides/packs","description":"このガイドでは、Sequence Builderを使ったERC1155Packコントラクトの設定方法について説明します。"}]}]} \ No newline at end of file diff --git a/ja/guides/guide-overview.mdx b/ja/guides/guide-overview.mdx index bb5d7a63..ace6bb84 100644 --- a/ja/guides/guide-overview.mdx +++ b/ja/guides/guide-overview.mdx @@ -1,64 +1,60 @@ --- title: ガイド -description: web3ゲーム向けSequenceインフラストラクチャスタックのガイド一覧です。 +description: ステップバイステップのガイドとオープンソースのコードテンプレートを活用して、市場投入までの時間を短縮しましょう。 mode: wide sidebarTitle: 概要 --- -ステップバイステップのガイドとオープンソースのコードテンプレートを活用して、市場投入までの時間を短縮しましょう。 - -## ゲーム開発者向け - - - Sequence Embedded Walletを内部的に活用し、統合マーケットプレイスやゲーム内通貨を備えた魅力的なiOS・Androidゲームの作り方を説明します。 + + SequenceのTransaction APIとサーバーレス環境を活用し、リオーグやノンス管理、トランザクションの並列処理など、ブロックチェーン特有の複雑さを自動で処理するスケーラブルなNFTミントサービスやその他トランザクションサービスを構築します。 - - 統合ガイドに従い、TelegramアプリにSequence Embedded Walletを組み込んで、EVMチェーン上のユーザーをサポートする方法を学びましょう。 + + PrivyとSequenceを連携させる方法を学び、ユーザーがSequenceスマートウォレットを通じてアプリにサインインし操作できるようにしましょう。これは、ユーザーのPrivy管理EOAによって制御されるSequenceウォレットを作成し、そのウォレットを使ってガス不要のトランザクションを送信する流れです。 - - SequenceのUnreal SDKを使って、Embedded Walletの情報表示、メッセージ署名、トランザクション送信を行いましょう。 + + Sequence Orderbook APIを活用し、プレイヤーがアイテムをミント・売買できるAPI駆動型のカスタムウェブマーケットプレイスを構築します。 - - このチュートリアルでは、AIで生成されたガチャアイテムをプレイヤーのユニバーサルウォレットに動的にミントする、ウェブベースの迷路ゲームを作成します。 + + Cloudflare Workerのサーバーレス環境を活用し、特定プロジェクトのユーザー利用状況を取得するための情報クエリガイドです。 - - Sequence Embedded Walletとカスタムのゲーム内実績トークンを活用したウェブゲームデモを、ステップバイステップで作成できます。 + + SequenceのMetadata APIを利用することで、NFTに関連するメタデータをほぼあらゆる環境からプログラム的に作成・管理・保存できます。これらのREST-APIを呼び出して、ゲームや体験のコレクションを整理する方法を解説します。 + - - ゲーム成長を加速させるため、アイテムをプレイヤーに直接販売できます。本ガイドでは、ERC1155コントラクト由来のゲームアイテムを利用したウェブショップで、任意のカスタム通貨や既存通貨を使ってPrimary Saleコントラクトをデプロイする手順を説明します。 - +## ゲーム開発者向け - - このガイドでは、SequenceのUnity SDKを使ったPrimary Saleの作成方法を説明します。 + + + Sequence Embedded Walletを内部的に活用し、統合マーケットプレイスやゲーム内通貨を備えた魅力的なiOS・Androidゲームの作り方を説明します。 - -## Web3 + + SequenceのUnreal SDKを使って、Embedded Walletの情報表示、メッセージ署名、トランザクション送信を行いましょう。 + - - - SequenceのTransaction APIとサーバーレス環境を活用し、リオーグやノンス管理、トランザクションの並列処理など、ブロックチェーン特有の複雑さを自動で処理するスケーラブルなNFTミントサービスやその他トランザクションサービスを構築します。 + + このチュートリアルでは、AIで生成されたガチャアイテムをプレイヤーのユニバーサルウォレットに動的にミントする、ウェブベースの迷路ゲームを作成します。 - - PrivyをSequenceに接続する方法 + + Sequence Embedded Walletとカスタムのゲーム内実績トークンを活用したウェブゲームデモを、ステップバイステップで作成できます。 - - Sequence Orderbook APIを活用し、プレイヤーがアイテムをミント・売買できるAPI駆動型のカスタムウェブマーケットプレイスを構築します。 + + ゲーム成長を加速させるため、アイテムをプレイヤーに直接販売できます。本ガイドでは、ERC1155コントラクト由来のゲームアイテムを利用したウェブショップで、任意のカスタム通貨や既存通貨を使ってPrimary Saleコントラクトをデプロイする手順を説明します。 - - Cloudflare Workerのサーバーレス環境を活用し、特定プロジェクトのユーザー利用状況を取得するための情報クエリガイドです。 + + このガイドでは、SequenceのUnity SDKを使ったPrimary Saleの作成方法を説明します。 - - SequenceのMetadata APIを利用することで、NFTに関連するメタデータをほぼあらゆる環境からプログラム的に作成・管理・保存できます。これらのREST-APIを呼び出して、ゲームや体験のコレクションを整理する方法を解説します。 + + このガイドでは、Sequence Builderを使ったERC1155Packコントラクトの設定方法について説明します。 \ No newline at end of file diff --git a/ja/guides/packs.mdx b/ja/guides/packs.mdx new file mode 100644 index 00000000..7fe54ce6 --- /dev/null +++ b/ja/guides/packs.mdx @@ -0,0 +1,88 @@ +--- +title: Sequence BuilderでERC1155Packコントラクトを設定する方法 +description: BuilderでのERC1155Packの仕組みや、コミット・リビール方式、パック内容の公開方法について学びましょう。 +sidebarTitle: ERC1155Packコントラクトの利用方法 +--- + +このガイドを参考に、Sequence BuilderでERC1155Packコントラクト内のパックを設定しましょう。`ERC1155Pack`コントラクトはERC1155Itemsを拡張し、コミット・リビール方式によるパック開封フローを追加します。 + + + 前提条件:コントラクトとアイテムのデプロイ + + [プロジェクトを作成](/solutions/builder/getting-started)し、ERC1155Packコントラクトをデプロイ済みであること、さらに各パックに入れたいERC1155またはERC721コントラクト/コレクションもデプロイ済みであることを確認してください。 + + +## ステップ1:ERC1155Packコントラクトを開く +プロジェクトのダッシュボードから設定したいPACKコントラクトを選択し、`Pack`タブを開いて内容を管理します。編集前に、正しいネットワークとコレクションが選択されているか確認してください。 + + + ![パックコントラクトの概要](/images/builder/builder-packs-1.png) + + +## ステップ2:編集するパックを選択または追加 +パックセレクターで更新したいパックを選ぶか、`Add new pack`をクリックして新しいパックを作成します。テーブルには各パックのトークンアドレス、タイプ、ID、開封時に含まれる数量が表示されます。 + + + ![パック選択と内容確認](/images/builder/builder-packs-2.png) + + +## ステップ3:CSVでパック内容をアップロード +`Add New Pack`または`Update Pack Contents`をクリックしてCSVアップローダーを開きます。変更したい`Pack ID`を入力し、開封可能なパック数を`Supply`に設定し、各パック内容を1行ずつ記載したCSVをアップロードします。 + +各行には以下を含めてください: +- `Pack Content ID` +- 各アイテムごとに:`Token Address`、`Token Type`(1155/721)、`Token IDs`、`Amounts` + +例: + +``` +Pack Content ID, Item 1 Token Addr, Item 1 Token Type, Item 1 Token IDs, Item 1 Amounts, Item 2 Token Addr, Item 2 Token Type, Item 2 Token IDs, Item 2 Amounts +1,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1200","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"5,6","7,3" +2,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1201","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9,10","7,9" +3,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1202","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"7,8","4,8" +4,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1203","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9","7" +5,0x3a6a8f4091b705fe1241c47e2532d45a6dff5a85,721,"1204","1",0xa558419686308ce836c36a5c44eeeb4b0916ca7b,1155,"9,10","5,4" + +``` + + + ![パック内容用CSVのアップロード](/images/builder/builder-packs-3.png) + + + + CSVをアップロードすると、選択したPack IDの既存内容がすべて置き換えられ、パック配布の追跡もリセットされます。 + + 特定IDのパックをすでに配布している場合、CSVを変更すると開封済みパックの情報もリセットされるため、変更は推奨しません。 + + 以前のパックで配布済みの721アイテムが新しいパックCSVにも含まれている場合、ユーザーがそのパックを開封してもミントに失敗します。 + + +## ステップ4:パックコントラクトにアイテムコレクションのMinter権限を付与 +パック開封時にアイテムをミントできるよう、ERC1155Packコントラクトアドレスに、パック内容として使うERC1155コレクションの`Minter`権限を付与します。該当アイテムコントラクトの`Settings > Permissions`を開き、パックコントラクトアドレスを追加して`Minter`を割り当て、トランザクションに署名してください。 + +## ステップ5:内容確認と公開 +CSVの処理が完了すると、解析されたPack Contentのプレビューが表示されます。トークンアドレス、ID、数量、合計を確認し、`Create Pack Contents`をクリックして保存します。これでパックはプレイヤーが開封できる状態になります。 + + + ![処理済みパック内容のプレビューと公開](/images/builder/builder-packs-4.png) + + +パック開封用のフロントエンドをお探しですか?[https://github.com/0xsequence-demos/pack-opening-boilerplate/](https://github.com/0xsequence-demos/pack-opening-boilerplate/) のReactボイラープレートもご覧ください。 + +## ERC1155Packの仕組み +パック内容は`PACK_ADMIN_ROLE`を持つアドレスが`setPacksContent(bytes32 _merkleRoot, uint256 _supply, uint256 packId)`で管理します。マークルルートにはすべてのパック内容がエンコードされ、`supply`でそのIDの開封可能数を定義します。BuilderがCSVからルートを自動生成するため、内容の準備に集中できます。 + +フロー(オンチェーン): +- ユーザーが`commit(packId)`を呼び出してパックをバーンし、コミットメントを作成します。 +- 1ブロック以上経過後、誰でも`reveal(user, packContent, proof, packId)`を呼び出して、選択した内容のマークル証明を提出できます。コントラクトが検証し、アイテムをミントします。Sequence APIが自動でこれを実行します。 +- コミットメントのブロックハッシュが有効期限切れ(30分)になる前にリビールされなかった場合、`refundPack(user, packId)`でパックが返却されます。 + +ランダム化について: +- コミットメント時に`block.number + 1`を記録し、ランダム性を確保します。 +- リビール時に`randomSeed = keccak256(abi.encode(blockHash, user))`が生成されます。 +- コントラクトは`randomSeed % remainingSupply[packId]`を使い、Fisher–Yates方式の`_availableIndices`マップで各内容が一度だけリビールされ、均等なランダム性を保ちます。 +- マークルリーフは`keccak256(abi.encode(revealIdx, packContent))`で生成され、提出された証明と照合されます。 + + + バリデータやマイナーが連続したブロックを制御するとブロックハッシュを操作できる可能性があります。誰でも`reveal`を呼び出せることで、コミット済みパックがブロックハッシュ有効期限前にリビールされることを保証します。 + \ No newline at end of file