Verona 백서

Verona

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 54쪽 중 11쪽

#### What does this do? 1. **Implements transaction submission** — **INCREMENT** sends an **ExecuteContract** message through **`useAbstraxionSigningClient()`** (default gasless / session path). 2. **Manages connection with hooks** — **`login()`** / **`?granted=true`** (same as earlier steps); no **`<Abstraxion />`** modal or **`@burnt-labs/ui`**. 3. **Queries on load** — When **`queryClient`** is ready, **`getCount()`** runs once so the counter is visible after refresh. 4. **Shows results** — After execute, displays **transaction hash**, **block height**, and a **Mintscan** link. ### Quick Note on Fee Configuration In the `increment` function, the `.execute()` method is called as follows: {% code lineNumbers="true" %} ```typescript const res = await client?.execute( account.bech32Address, contractAddress, msg, "auto", "", // memo [], ); ``` {% endcode %} The **fourth parameter** in the function call represents the **fee configuration**. Instead of manually specifying the gas and fee amount, we use `"auto"`, allowing the **SDK to automatically handle fee estimation**: #### Why Use `"auto"`? * **Simplifies fee management** by automatically estimating optimal fees. * **Reduces errors** related to underestimating or overestimating gas. By default, the `gas-adjustment` applied to the `auto` value is typically **1.3**. If transactions are still failing due to low fees, it may indicate that the gas adjustment, acting as a multiplier for the automatically calculated fee, is too low. In such cases, you may need to increase this value for specific transactions. To update the gas adjustment in the **execute** call, replace `auto` with your desired adjustment value. The transaction will still use automatic gas estimation but will apply the specified gas adjustment instead of the default. **Session key vs direct signing:** This tutorial uses the default **`useAbstraxionSigningClient()`** path (gasless / session-style signing with Treasury). For **user-pays-gas** flows, `useAbstraxionSigningClient({ requireAuth: true })`, and **explicit fee simulation** (`simulate`, `calculateFee`) instead of `"auto"`, compare hooks in [`demos/react`](https://github.com/burnt-labs/xion.js/tree/main/demos/react) (see also [Web App Development](/en/build-on-verona/accounts/web-app#when-to-use-which-mode)). If everything is configured correctly, you should see the transaction results displayed as shown in the previous section. <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FE0Ie1YaD0XdFPn3DFSH0%2Fimage.png?alt=media&amp;token=f619dc14-5582-4453-9f16-3d779b312cd4" alt=""><figcaption><p>After clicking "Increment" you should see the confirmation above</p></figcaption></figure> These core components form the foundation for building and deploying a successful app! If you have any questions or need support, feel free to reach out to us on **Discord** or [**GitHub**](https://github.com/burnt-labs/xion.js). # Abstraxion modes and opportunities Explanation — how Abstraxion authentication types and signing choices combine into product-level UX patterns; live demos and demos/react as the verification surface This page is **understanding-oriented**. It sketches **what kinds of experiences** you can build by combining Abstraxion **authentication** configuration with **signing** behavior. It does **not** replace the step-by-step tutorials or the signer configuration reference. For wiring details, use: * [Web App Development — modes hub](/en/build-on-verona/accounts/web-app) — glossary of `authentication.type`, env map, and demo route index * [Abstraxion signer mode](/en/build-on-verona/accounts/web-app/abstraxion-signer-mode) — `getSignerConfig`, session vs direct signing, appendix tables * [Account abstraction tutorial](/en/build-on-verona/accounts/web-app/build-react-dapp-with-account-abstraxion) — end-to-end gasless app with dashboard auth **Verification rule:** Treat each numbered section (and the multi-wallet integration note) as a **typical architecture direction**. Validate flows, fees, and authenticator support against the [live demos](/en/build-on-verona/accounts/web-app#live-demos) and [`demos/react`](https://github.com/burnt-labs/xion.js/tree/main/demos/react) source for the Abstraxion release you depend on. Legacy Next.js routes in [`apps/demo-app`](https://github.com/burnt-labs/xion.js/tree/main/apps/demo-app) remain for migration reference only. *** ## Two axes: authenticate vs sign Abstraxion separates concerns that are easy to merge mentally: 1. **How the user reaches a Meta Account session** — controlled mainly by **`authentication.type`** (`auto`, `popup`, `redirect`, `signer`, `embedded`, …). Dashboard modes navigate or embed hosted UI; **signer** mode keeps the user on your SPA and calls **`getSignerConfig`** when your custody or browser wallet layer is ready. 2. **How individual transactions are authorized on-chain** — controlled by signing client choice (for example default **`useAbstraxionSigningClient()`** vs **`useAbstraxionSigningClient({ requireAuth: true })`** in signer contexts). Session-style paths align with Treasury / fee grants when you configure them; **`requireAuth`** pushes approval through paths closer to the user’s authenticator and often shifts fee responsibility. Neither axis alone defines the product story: **pairings** matter. The same Meta Account can feel like a gasless consumer app or like a self-custodied wallet experience depending on authenticators, grants, and signing hooks. *** ## 1 — Recommended baseline: dashboard auth (`auto` / `popup` / `redirect`) **Direction:** For most new apps, **`authentication.type: "auto"`** (or an explicit **`popup`** / **`redirect`**) is the **default we recommend**: users complete Meta Account login through the hosted dashboard experience, then **`useAbstraxionSigningClient()`** without **`requireAuth`** gives the usual **session-style** signing with Treasury / fee grants when you configure them. **Why teams choose it:** Fastest path, least custom signer code, clearest alignment with tutorials and hosted recovery flows. **Where to verify:** [Account abstraction tutorial](/en/build-on-verona/accounts/web-app/build-react-dapp-with-account-abstraxion), [live `/auto`](https://sdk-react.demos.burnt.com/auto), and [`AutoModePage.tsx` in `demos/react`](https://github.com/burnt-labs/xion.js/blob/main/demos/react/src/pages/AutoModePage.tsx). *** ## 2 — Signer mode + **session** signing (Meta Account execution; wallet or custody only drives **connect**) **Direction:** Set **`authentication.type: "signer"`** and implement **`getSignerConfig`** so a **browser extension wallet, hardware signer, or custody SDK** establishes the session **without** a full-page dashboard redirect. Then use the default **`useAbstraxionSigningClient()`** (no **`requireAuth: true`**). **What this feels like:** After connect, the app still behaves like a **Meta Account product**: session-style submission, gasless paths when grants and Treasury are set up, and the same hook shape as dashboard-first apps—only the **authentication surface** moved in-app. **Contrast with section 3:** Users are **not** prompted to approve **every** transaction through the extension like a classic self-custody wallet; approvals follow the session / grantee model unless you change signing options. **Where to verify:** [live `/signer-mode`](https://sdk-react.demos.burnt.com/signer-mode) and [`SignerModePage.tsx` in `demos/react`](https://github.com/burnt-labs/xion.js/blob/main/demos/react/src/pages/SignerModePage.tsx) (Turnkey there is **example custody wiring** for **`getSignerConfig`**; swap in your signer stack). Wiring tables: [Abstraxion signer mode](/en/build-on-verona/accounts/web-app/abstraxion-signer-mode). *** ## 3 — Signer mode + **direct** signing (`requireAuth: true`) (wallet-like per transaction on an abstract account) **Direction:** Keep **`type: "signer"`** and your **`getSignerConfig`**, but call **`useAbstraxionSigningClient({ requireAuth: true })`**. **What this feels like:** The **signing rhythm** matches a traditional browser-wallet flow: users see and approve work closer to each operation, **gas is typically on them** (or you model fees explicitly), and you lean less on long-lived session shortcuts. You still keep **abstract account** capabilities (multiple authenticators, policy, recovery options from the Meta Account model)—the change is **how each tx is authorized**, not “whether Meta Accounts exist.” **Contrast with section 2:** Same “wallet or custody proves identity for signer auth” idea; **different signing hook**. Section 2 = Meta Account–style execution after connect; section 3 = **per-tx** authenticator involvement for submits. **Where to verify:** Compare default vs **`requireAuth`** signing hooks in [`demos/react`](https://github.com/burnt-labs/xion.js/tree/main/demos/react) source (no dedicated live deploy). See [Signing: session key vs direct](/en/build-on-verona/accounts/web-app/abstraxion-signer-mode#signing-session-key-vs-direct). *** ## Multi-wallet “connect” UI (integration shape, not a separate product mode) Some apps already ship a **wallet list or connection modal** (sometimes reused from another chain’s stack). That layer usually feeds **which signer** your **`getSignerConfig`** factory returns—it does **not** replace the split between **section 2** (session signing after connect) and **section 3** (**`requireAuth`**). As one **illustration** only: a codebase might already depend on a common open-source **multi-wallet connection module** for non-XION chains; you can explore mapping its signer objects into **`SignerConfig`**, then **prove** the result in **`demos/react`** and your own tests—not a third runtime mode in Abstraxion. *** ## Strong authenticator as primary, others as backup (user-journey narrative) **Direction:** Teams often want a **primary** authenticator for day-to-day signing (for example passkey-style WebAuthn in product designs) and **additional** methods (email, OTP, another device) as **backup** if the primary is lost. That story sits mostly at the **Meta Account / dashboard / authenticator policy** layer; **signer** mode can reduce how often users see hosted UI, but the exact catalog, recovery paths, and in-app vs dashboard boundaries **change with product and SDK releases**. **Code in `demos/react`:** There is **no** single route that demonstrates every authenticator combination end-to-end. Treat this section as a **planning and UX narrative**; validate your target mix with product docs, manager APIs, and security review, then use signer + session or signer + **`requireAuth`** demos for the **Abstraxion wiring** slice. *** ## Keeping narrative aligned with implementation Product and SDK discussions sometimes distinguish **“how the SDK calls are spelled”** from **“what product posture those calls enable.”** This document stays in the second bucket. When feedback emphasizes **pairings**—dashboard-first (**section 1**) vs signer-backed Meta Account execution (**section 2**) vs signer-backed **per-tx** signing (**section 3**), plus passkey-first journeys—map them to the sections above, then **lock behavior** with demo routes and release notes—not with prose alone. *** ## Related * [Web App Development](/en/build-on-verona/accounts/web-app) * [Abstraxion signer mode](/en/build-on-verona/accounts/web-app/abstraxion-signer-mode) * [Custom UI and Abstraxion loading states](/en/build-on-verona/accounts/web-app/custom-ui-abstraxion-authentication) # Abstraxion signer mode Abstraxion authentication.type signer — getSignerConfig, AA API, env vars, Turnkey registration pattern **Signer mode** (`authentication.type: "signer"`) runs Meta Account flows **without** redirecting the user to the full-page Verona dashboard. ## Outcomes to read alongside this page * **Gasless session signing** — default **`useAbstraxionSigningClient()`** with Treasury / grants when you configure them; the [session signing](#session-signing-default-useabstraxionsigningclient) section and [live `/signer-mode`](https://sdk-react.demos.burnt.com/signer-mode) demo are the practical reference. * **Per-transaction approval and user-paid gas models** — signer authentication plus **`useAbstraxionSigningClient({ requireAuth: true })`**; compare hooks in [`demos/react`](https://github.com/burnt-labs/xion.js/tree/main/demos/react) source and [Signing: session key vs direct](#signing-session-key-vs-direct). For **architecture-level combinations** (recommended **`auto`** / dashboard flows vs **signer + session** vs **signer + `requireAuth`**, plus passkey-first narratives), read [Abstraxion modes and opportunities](/en/build-on-verona/accounts/web-app/abstraxion-modes-opportunities). The rest of this document is **wiring** and **appendix reference**. ## The essentials: `getSignerConfig` **What you implement** Write **`getSignerConfig`**: an async function that returns a **`SignerConfig`** when your wallet or custody layer is ready. The SDK calls it when the user connects. In **`demos/react`**, Turnkey wiring lives in [**`SignerModePage.tsx`**](https://github.com/burnt-labs/xion.js/blob/main/demos/react/src/pages/SignerModePage.tsx) and supporting hooks under [`demos/react/src/hooks`](https://github.com/burnt-labs/xion.js/tree/main/demos/react/src/hooks). Replace that stack with yours (MetaMask, Privy, …). **What you wire** Put **`getSignerConfig`** on **`authentication`** next to **`type: "signer"`**, and set **`chainId`** (and anything else) the same way as the demo config. **Do not re-derive** the boilerplate from scratch—start from **`SignerModePage.tsx`** + [**`demos/react/.env.example`**](https://github.com/burnt-labs/xion.js/blob/main/demos/react/.env.example). Everything else on **`authentication`** and env mapping is in the [appendix](#appendix-signer-configuration-reference). ## When to use signer mode | Use signer mode when… | Prefer dashboard auth (`auto` / `popup` / `redirect`) when… | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | You control the key material (Turnkey, Privy, custom HSM) or bridge a browser wallet as owner. | Standard Meta Account login via hosted dashboard is enough. | | You must avoid a full navigation away from your SPA. | Popup or embedded dashboard UX is acceptable. | | You are prototyping **wallet-led** abstract accounts (e.g. MetaMask in direct-signing patterns). | You want the fastest path with minimal AA API / contract metadata. | Concrete **demo routes** for signer auth + signing paths are in [Signing: session key vs direct](#signing-session-key-vs-direct) below. ## Signing: session key vs direct **Signer mode** only changes **how the user authenticates** (`getSignerConfig`). **How transactions are signed** is only **two** choices below: **session (default hook)** vs **direct (`requireAuth`)**. Turnkey in **`/signer-mode`** is **example wiring** for the session demo (custody UI → `getSignerConfig`), not a third signing mode. ### Session signing (default `useAbstraxionSigningClient()`) Call **`useAbstraxionSigningClient()`** with no options (or only options that do not set **`requireAuth: true`**). * After connect, the SDK uses a **session-style** signing client (**`GranteeSignerClient`**) aligned with **Treasury / fee grants**: gas is covered for allowed messages when grants are configured. * Typical **gasless dApp** flow: user approves grants once (when applicable), then submits through the session client. * Fees on **`execute`**: you often use **`"auto"`** for gas estimation like the main [Account abstraction tutorial](/en/build-on-verona/accounts/web-app/build-react-dapp-with-account-abstraxion). **Vendor example — Turnkey on** [**live `/signer-mode`**](https://sdk-react.demos.burnt.com/signer-mode)**:** that route pairs Turnkey with Abstraxion using custody registration helpers (“how does custody UI hand off before **`getSignerConfig`** runs?”). The same **context + refs** idea applies to other vendors. Turnkey env: [appendix](#appendix-signer-configuration-reference). For **MetaMask**-style wiring used to **diff** session vs direct signing, compare hooks in [`demos/react`](https://github.com/burnt-labs/xion.js/tree/main/demos/react) source. ### Direct signing (`requireAuth: true`) Call **`useAbstraxionSigningClient({ requireAuth: true })`**. * Each (or many) operations go through the **user’s authenticator** on the meta-account (**`AAClient`** path in signer mode), not the delegated session shortcut. * **Gas** is usually **paid by the user** (or you model fees explicitly); **`"auto"`** on **`execute`** is less appropriate than **simulate + `calculateFee`** (or your own fee model)—see the demo for the split. * Use when you need **per-transaction user approval**, **no session grants**, or to compare behavior next to the session path. ### Which demo to read | Example | Live / source | What it highlights | | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | **Session / gasless with signer auth** | [Live `/signer-mode`](https://sdk-react.demos.burnt.com/signer-mode) · [`SignerModePage.tsx`](https://github.com/burnt-labs/xion.js/blob/main/demos/react/src/pages/SignerModePage.tsx) | **`signer`** + Turnkey → **`getSignerConfig`**; default **`useAbstraxionSigningClient()`**; gasless / Treasury. | | **Direct vs session side by side** | [`demos/react` source only](https://github.com/burnt-labs/xion.js/tree/main/demos/react) (no live deploy) | Same **`signer`** auth; **default vs `requireAuth: true`**; MetaMask-style wallet; **simulate / fees** vs **`"auto"`**. | Run **`demos/react`** locally and open those routes after reading the page components and hooks—they are the **authoritative** examples next to this page. ## Related * [Abstraxion modes and opportunities](/en/build-on-verona/accounts/web-app/abstraxion-modes-opportunities) * [Web App Development — modes hub](/en/build-on-verona/accounts/web-app) * [Custom UI and loading states](/en/build-on-verona/accounts/web-app/custom-ui-abstraxion-authentication) * [Account abstraction tutorial](/en/build-on-verona/accounts/web-app/build-react-dapp-with-account-abstraxion) *** ## Appendix: Signer configuration reference Match **`SignerModePage.tsx`** or extend it. Full commented env: [**`demos/react/.env.example`**](https://github.com/burnt-labs/xion.js/blob/main/demos/react/.env.example). ### `authentication` when **`type: "signer"`** | Required? | Field | Notes | | --------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Yes | **`type`** | Must be **`"signer"`**. | | Yes | **`getSignerConfig`** | Your async factory → **`SignerConfig`**. | | Preset/override | **`aaApiUrl`** | Must still be provided by your app at runtime, typically from the **preset URL** for your **`chainId`** from `.env.example` (or via override). **Demo** config reads **`VITE_AA_API_URL`** or **`NEXT_PUBLIC_AA_API_URL`**. | | Preset/override | **`smartAccountContract`** | Must still be provided by your app at runtime, typically from the **preset wasm** for that network + AA API from `.env.example` (or via override). **`codeId` / `checksum`** must match the AA API you use. | | No | **`indexer`** | Set when using **`VITE_INDEXER_URL`** / **`NEXT_PUBLIC_INDEXER_URL`**
프로젝트로 돌아가기