Initia 백서

Initia

원문

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

ure-based derivation. Retrieved public keys are cached in localStorage for subsequent uses, reducing the number of signing prompts needed. ## Improvements * Chain selector now displays the total USD value and NFT count for each chain. * Send forms display contextual disabled messages explaining why submission is blocked. * Dependencies updated to React 19.2.0, wagmi 2.17.2, and cosmjs 0.36.1. ## Bug fixes * Max button is now disabled when the balance is zero. * Fixed NFT thumbnail rendering by removing conditional display logic. * Send page no longer throws an error when the asset list is empty if a denom is available in navigation state. </Update> <Update label="October 15, 2025" description="v2.0.5"> ## Collapsible fee breakdown When a transaction fee exceeds the user's balance, a new collapsible panel shows a detailed breakdown of the spend amount, fee amount, total, and current balance. Fee display precision has also been increased to 8 decimal places for very small fee amounts that previously showed as `0.000000`. ## Configurable glyph URL The `glyphUrl` configuration option lets you specify a custom URL for loading glyph assets, replacing the previously hardcoded URL. Default values are set for mainnet and testnet. ## Bug fixes * Fixed drawer backdrop not responding to clicks in production by adding an explicit `onClick` handler. * Chain dropdown now shows all chains with a balance, regardless of their USD value. * Send page now throws a descriptive error when the primary asset is missing instead of failing silently. </Update> <Update label="October 1, 2025" description="v2.0.4"> ## Transaction timing parameters `requestTxBlock`, `submitTxBlock`, and `waitForTxConfirmation` now accept `timeoutMs` and `intervalMs` parameters for configuring transaction polling behavior. The default poll interval has been reduced from 1000ms to 500ms for faster confirmation detection. Error handling was also improved by returning `Error` objects from `normalizeError` instead of plain strings. </Update> <Update label="September 30, 2025" description="v2.0.3"> ## Custom fee handling A new `TxParams` interface and `submitTxBlock`/`submitTxSync` functions give developers programmatic control over transaction fee configuration, enabling custom fee logic beyond the built-in fee selector. ## Bridge UI improvements The bridge has received several UI improvements. Route selection now shows loading skeletons and redesigned option cards. Bridge history items are grouped by date with time-only timestamps. The fee selector separates the amount display from the token selector for clarity. ## Improvements * Numeric inputs now handle pasted formatted numbers (e.g., `1,234,567.890`) by stripping grouping separators. * Modals use trap-focus behavior for better accessibility, with `tabIndex=-1` on auxiliary buttons. ## Bug fixes * Fixed sequence conflicts in same-chain OP hook transactions by incrementing the account sequence by 2 for parallel message execution. </Update> <Update label="September 30, 2025" description="v2.0.2"> ## Improvements * Switched to dedicated indexer endpoints for chain data queries, improving response times and reliability. * Fee denom fetching is now optimized to skip transaction queries when only a single fee token is available. * Activity list guards against entries with missing timestamps to prevent rendering errors. </Update> <Update label="September 30, 2025" description="v2.0.1"> ## Bug fixes * Fixed NFT deduplication by using `collection_addr` combined with `token_id` as the unique key instead of token ID alone, preventing collisions across different NFT collections. </Update> # API Reference Source: https://docs.initia.xyz/interwovenkit/features/autosign/api-reference Complete API documentation for the autosign feature ## Overview The `autoSign` object provides methods and properties for managing autosign functionality. It is available via the `useInterwovenKit()` hook. ## Accessing the API ```tsx theme={null} import { useInterwovenKit } from '@initia/interwovenkit-react' function MyComponent() { const { autoSign } = useInterwovenKit() // Use autoSign methods and properties } ``` ## Type Definitions ### AutoSign Object ```tsx theme={null} interface AutoSign { isLoading: boolean enable: (chainId?: string) => Promise<void> disable: (chainId?: string) => Promise<void> expiredAtByChain: Record<string, Date | null | undefined> isEnabledByChain: Record<string, boolean> granteeByChain: Record<string, string | undefined> } ``` ## Properties ### isLoading Indicates whether autosign status is currently being checked. <ParamField type="boolean"> Returns `true` when autosign status is being initialized or checked, `false` otherwise. Use this to show loading indicators in your UI. </ParamField> **Example:** ```tsx theme={null} function AutosignButton() { const { autoSign } = useInterwovenKit() if (autoSign.isLoading) { return <button disabled>Loading...</button> } return <button>Enable Autosign</button> } ``` ### isEnabledByChain Map of chain IDs to their autosign enabled status. <ParamField type="Record<string, boolean>"> Returns an object mapping chain IDs to boolean values indicating whether autosign is currently enabled for each chain. Use this to check autosign status and conditionally render UI elements. </ParamField> **Example:** ```tsx theme={null} function AutosignStatus({ chainId }: { chainId: string }) { const { autoSign } = useInterwovenKit() if (autoSign.isEnabledByChain[chainId]) { return <p>Autosign is enabled for {chainId}</p> } return <p>Autosign is not enabled</p> } ``` ### expiredAtByChain Map of chain IDs to their expiration dates. <ParamField type="Record<string, Date | null | undefined>"> Returns an object mapping chain IDs to expiration dates. Values can be: - `Date`: The date when autosign expires - `null`: Autosign is not enabled for this chain - `undefined`: Autosign is enabled with no expiration (permanent) </ParamField> **Example:** ```tsx theme={null} function ExpirationDisplay({ chainId }: { chainId: string }) { const { autoSign } = useInterwovenKit() const expiration = autoSign.expiredAtByChain[chainId] if (expiration === null) { return <p>Autosign is not enabled</p> } if (expiration === undefined) { return <p>Autosign is enabled (no expiration)</p> } return <p>Autosign expires: {expiration.toLocaleString()}</p> } ``` ### granteeByChain Map of chain IDs to grantee addresses (the derived AutoSign wallet addresses). <ParamField type="Record<string, string | undefined>"> Returns an object mapping chain IDs to the grantee addresses that have been authorized to sign transactions. Use this for debugging or displaying which address is authorized for autosign. </ParamField> **Example:** ```tsx theme={null} function MultiChainStatus() { const { autoSign } = useInterwovenKit() return ( <div> {Object.entries(autoSign.isEnabledByChain).map(([chainId, isEnabled]) => { const expiration = autoSign.expiredAtByChain[chainId] return ( <div key={chainId}> {chainId}: {isEnabled ? 'Enabled' : 'Disabled'} {isEnabled && expiration && ` (until ${expiration.toLocaleString()})`} </div> ) })} </div> ) } ``` ## Methods ### enable() Enables autosign for a specific chain or the default chain. <ParamField type="(chainId?: string) => Promise<void>"> Opens a drawer for user confirmation, derives the AutoSign wallet for the current app origin, and creates the necessary authz and feegrant permissions. Returns a Promise that resolves when autosign is successfully enabled or rejects if the user cancels or an error occurs. **Parameters:** - `chainId` (optional): Chain ID to enable autosign for. If not provided, uses the default chain ID from `InterwovenKitProvider`. **Returns:** Promise that resolves when autosign is enabled **Throws:** Error if user rejects the derivation or grant flow, or if the selected chain has no configured AutoSign message types </ParamField> **Example:** ```tsx theme={null} async function enableAutosign() { try { await autoSign.enable() console.log('Autosign enabled for default chain') } catch (error) { console.error('Failed to enable autosign:', error) } } async function enableForChain() { try { await autoSign.enable('minievm-2') console.log('Autosign enabled for minievm-2') } catch (error) { console.error('Failed to enable autosign:', error) } } ``` **Common Failure Cases:** * `"User cancelled"`: The user closes the AutoSign flow before approving it. * `No message types configured for chain ${chainId}`: The selected chain does not resolve to any allowed AutoSign message types. * Grant creation fails on-chain or during the wallet/signature flow. ### disable() Disables autosign for a specific chain or the default chain. <ParamField type="(chainId?: string) => Promise<void>"> Revokes all authz and feegrant permissions for the specified chain, preventing further automatic signing. Returns a Promise that resolves when autosign is successfully disabled. **Parameters:** - `chainId` (optional): Chain ID to disable autosign for. If not provided, uses the default chain ID from `InterwovenKitProvider`. **Returns:** Promise that resolves when autosign is disabled **Throws:** Error if permissions are not configured or autosign is not enabled </ParamField> **Example:** ```tsx theme={null} async function disableAutosign() { try { await autoSign.disable() console.log('Autosign disabled for default chain') } catch (error) { console.error('Failed to disable autosign:', error) } } async function disableForChain() { try { await autoSign.disable('minievm-2') console.log('Autosign disabled for minievm-2') } catch (error) { console.error('Failed to disable autosign:', error) } } ``` # Configuration Source: https://docs.initia.xyz/interwovenkit/features/autosign/configuration ## Overview Configuring autosign requires setting up the `enableAutoSign` prop in your `InterwovenKitProvider`. InterwovenKit derives and manages the dedicated AutoSign wallet automatically. ## Prerequisites Before configuring autosign, ensure you have: * InterwovenKit already integrated into your application * An understanding of which transaction types you need to auto-sign <Note> This page focuses on the `enableAutoSign` configuration. For the full provider tree and base setup, see [Provider Setup](../../references/setup/providers). </Note> ## Setting Up Autosign <Steps> <Step title="Install Dependencies"> Ensure you have InterwovenKit and the required peer dependencies installed: <CodeGroup> ```bash npm theme={null} npm install @initia/interwovenkit-react @tanstack/react-query wagmi viem ``` ```bash yarn theme={null} yarn add @initia/interwovenkit-react @tanstack/react-query wagmi viem ``` ```bash pnpm theme={null} pnpm add @initia/interwovenkit-react @tanstack/react-query wagmi viem ``` ```bash bun theme={null} bun add @initia/interwovenkit-react @tanstack/react-query wagmi viem ``` </CodeGroup> </Step> <Step title="Configure InterwovenKitProvider"> Add the `enableAutoSign` prop to your `InterwovenKitProvider`: ```tsx providers.tsx theme={null} import { createConfig, http, WagmiProvider } from 'wagmi' import { mainnet } from 'wagmi/chains' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { injectStyles, InterwovenKitProvider, } from '@initia/interwovenkit-react' import css from '@initia/interwovenkit-react/styles.css?inline' import type { PropsWithChildren } from 'react' injectStyles(css) const wagmiConfig = createConfig({ chains: [mainnet], transports: { [mainnet.id]: http() }, }) const queryClient = new QueryClient() const chainId = 'your-chain-id' function InterwovenKitWrapper({ children }: PropsWithChildren) { return ( <InterwovenKitProvider enableAutoSign={{ [chainId]: [ '/cosmos.bank.v1beta1.MsgSend', '/initia.move.v1.MsgExecute', ], }} > {children} </InterwovenKitProvider> ) } export default function Providers({ children }: PropsWithChildren) { return ( <QueryClientProvider client={queryClient}> <WagmiProvider config={wagmiConfig}> <InterwovenKitWrapper>{children}</InterwovenKitWrapper> </WagmiProvider> </QueryClientProvider> ) } ``` </Step> </Steps> ## Configuring Autosign Permissions ### Select Your Autosign Mode Before enabling autosign, decide which mode fits your application: * **Boolean (`enableAutoSign`)** * Best for simple, single-chain apps * Automatically allows default contract execution messages for the chain * Does **not** allow token transfers, staking, or other non-default messages * **Per-Chain Configuration** (`enableAutoSign: { "chain-id": ["msg.type.Url", ...] }`) * Required if your app sends tokens, delegates, or uses multiple chains * You must explicitly list every allowed message type If your app does more than basic contract execution calls, you should skip the boolean option and use the per-chain permissions in the [Advanced Configuration](#advanced-configuration-explicit-permissions) section. Most production applications will eventually require the per-chain configuration. ### Simple Configuration (Limited) This option only enables autosign for default contract execution messages and is intentionally restrictive. ```tsx theme={null} <InterwovenKitProvider enableAutoSign>{children}</InterwovenKitProvider> ``` <Info> If you later need to support token transfers, staking, or multiple chains, you must switch from the boolean configuration to the per-chain configuration in the [Advanced Configuration](#advanced-configuration-explicit-permissions) section. </Info> When using boolean configuration, InterwovenKit automatically: * Detects your chain's VM type * Grants permission for the appropriate message type: * **MiniEVM**: `/minievm.evm.v1.MsgCall` * **MiniWasm**: `/cosmwasm.wasm.v1.MsgExecuteContract` * **MiniMove**: `/initia.move.v1.MsgExecute` ### Advanced Configuration (Explicit Permissions) For multi-chain applications or when you need custom message types, specify autosign permissions per chain: ```tsx theme={null} <InterwovenKitProvider enableAutoSign={{ 'interwoven-1': [ '/cosmos.bank.v1beta1.MsgSend', // native token transfers '/cosmos.staking.v1beta1.MsgDelegate', // staking ], 'evm-1': ['/minievm.evm.v1.MsgCall'], 'wasm-1': ['/cosmwasm.wasm.v1.MsgExecuteContract'], 'move-1': ['/initia.move.v1.MsgExecute', '/cosmos.bank.v1beta1.MsgSend'], }} // ... other config > {children} </InterwovenKitProvider> ``` **Configuration Format:** The `enableAutoSign` prop accepts an object where: * **Keys**: Chain IDs (strings) * **Values**: Arrays of message type URLs (strings) **Common Message Types:** * **EVM Chains**: `/minievm.evm.v1.MsgCall` * **Wasm Chains**: `/cosmwasm.wasm.v1.MsgExecuteContract` * **Move Chains**: `/initia.move.v1.MsgExecute` * **Bank Module**: `/cosmos.bank.v1beta1.MsgSend` * **Staking**: `/cosmos.staking.v1beta1.MsgDelegate` <Warning> Only grant permissions for message types that your application actually needs. Granting overly broad permissions increases security risk. </Warning> # Introduction Source: https://docs.initia.xyz/interwovenkit/features/autosign/introduction Learn about autosign and dedicated signing wallets for seamless transaction signing. ## Overview Autosign enables your application to send transactions automatically without requiring user confirmation for each transaction. This feature uses a dedicated signing wallet derived from the connected wallet's signature to sign specific transactions on behalf of users, providing a seamless user experience while maintaining security through granular permission controls. <Info> Autosign is built on the Cosmos SDK's `authz` and `feegrant` modules, allowing fine-grained control over which transaction types can be automatically signed and when permissions expire. </Info> ## What Is the AutoSign Wallet? The AutoSign wallet is a dedicated signer that InterwovenKit derives from the connected wallet's signature flow. When autosign is enabled, InterwovenKit uses that derived wallet as the grantee for the authz and feegrant permissions needed to sign approved transaction types automatically. Key characteristics of the AutoSign wallet: * **Separate Address**: Each AutoSign wallet has its own blockchain address * **Derived Per App Origin**: InterwovenKit derives the wallet from a signed message scoped to the current origin * **Managed Automatically**: InterwovenKit handles derivation and wallet lifecycle in the app * **Scoped Permissions**: Can only sign transactions you've explicitly authorized * **Time-Limited**: Permissions expire after a set duration * **Revocable**: Users can revoke permissions at any time ## How Autosign Works When autosign is enabled, the following process occurs: <Steps> <Step title="Permission Request"> Your application requests permission to automatically sign specific transaction types on specific chains. This is configured through the `enableAutoSign` prop in `InterwovenKitProvider`. </Step> <Step title="Wallet Derivation"> InterwovenKit asks the connected wallet to sign a derivation message and uses that signature to derive a dedicated AutoSign wallet for the current app origin. </Step> <Step title="Grant Authorization"> The user's main wallet grants permission to the AutoSign wallet via Cosmos SDK's `authz` and `feegrant` modules: * **Authz grants**: Authorize the AutoSign wallet to execute specific message types * **Feegrant**: Allows the AutoSign wallet to pay transaction fees on behalf of the user The user signs a single transaction to create these grants. </Step> <Step title="Automatic Signing"> When transactions match the granted permissions: 1. InterwovenKit validates that the transaction message types match the grants 2. InterwovenKit checks that permissions haven't expired 3. The AutoSign wallet automatically signs the transaction 4. The transaction is broadcast without user interaction </Step> </Steps> ## Benefits Autosign provides several key benefits for both users and developers: For users: * **Seamless Experience**: No need to approve every transaction manually * **Reduced Friction**: Faster interactions, especially for frequent operations * **Security**: Permissions are scoped, time-limited, and revocable * **Control**: Users can see and manage all autosign permissions For developers: * **Better UX**: Reduce transaction approval fatigue * **Flexible Permissions**: Configure exactly which transaction types can be auto-signed * **Multi-Chain Support**: Configure different permissions per chain * **Trust Indicators**: Works with domain trust verification ## Security Autosign maintains security through several mechanisms: * **Scoped Permissions**: Only specific message types can be auto-signed. For example, you might grant permission for `/minievm.evm.v1.MsgCall` but not for `/cosmos.bank.v1beta1.MsgSend`, ensuring the AutoSign wallet can only execute the exact operations you've authorized. * **Time-Limited Grants**: All autosign permissions have expiration dates. Users can set expiration times when enabling autosign, and permissions automatically expire, requiring re-authorization. * **Domain Trust**: InterwovenKit shows security warnings for untrusted domains. Applications listed in the Initia registry are automatically trusted, while others show warnings that users can acknowledge or dismiss. * **Revocable Permissions**: Users can revoke autosign permissions at any time through their wallet settings. When revoked, all grants are immediately invalidated. # Usage Source: https://docs.initia.xyz/interwovenkit/features/autosign/usage Learn how to enable, disable, and manage autosign in your application ## Overview Once autosign is configured, you can
프로젝트로 돌아가기