@dynamic-labs/types
Advanced tools
+1
-1
@@ -6,4 +6,4 @@ 'use client' | ||
| var version = "4.79.2"; | ||
| var version = "4.80.0"; | ||
| exports.version = version; |
+1
-1
| 'use client' | ||
| var version = "4.79.2"; | ||
| var version = "4.80.0"; | ||
| export { version }; |
+3
-3
| { | ||
| "name": "@dynamic-labs/types", | ||
| "version": "4.79.2", | ||
| "version": "4.80.0", | ||
| "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.", | ||
@@ -21,6 +21,6 @@ "author": "Dynamic Labs, Inc.", | ||
| "dependencies": { | ||
| "@dynamic-labs/sdk-api-core": "0.0.958", | ||
| "@dynamic-labs/assert-package-version": "4.79.2" | ||
| "@dynamic-labs/sdk-api-core": "0.0.964", | ||
| "@dynamic-labs/assert-package-version": "4.80.0" | ||
| }, | ||
| "peerDependencies": {} | ||
| } |
@@ -1,1 +0,1 @@ | ||
| export type { IUITransaction, IUITransactionFormatOptions, TransactionReceipt, } from './transaction'; | ||
| export type { IUITransaction, IUITransactionFormatOptions, RecordMergeAction, TransactionModeOption, TransactionReceipt, } from './transaction'; |
@@ -0,1 +1,2 @@ | ||
| import type { TokenBalance } from '@dynamic-labs/sdk-api-core'; | ||
| /** | ||
@@ -147,3 +148,97 @@ * Generic type for a transaction to navigate through the different chains | ||
| getPreSubmitValidationError?: () => string | undefined; | ||
| /** | ||
| * Optional set of chain-specific transaction modes (e.g. Aleo's | ||
| * Individual / Exchange = private vs. public transfer). When provided, | ||
| * the widget's send form renders a segmented control below the recipient | ||
| * field; the user's selection is delivered back via [setTransactionMode]. | ||
| * | ||
| * Other chains leave this undefined and the widget renders no toggle | ||
| * (current behaviour preserved). | ||
| */ | ||
| transactionModes?: TransactionModeOption[]; | ||
| /** | ||
| * The currently selected transaction mode id. The form reads this to | ||
| * highlight the active segment of the toggle. Mirror of [setTransactionMode] | ||
| * — the widget is the source of truth for selection, the transaction | ||
| * is the source of truth for behaviour at submit time. | ||
| */ | ||
| selectedTransactionMode?: string; | ||
| /** | ||
| * Called by the widget when the user picks a mode in the segmented | ||
| * control. Implementations should update `selectedTransactionMode` and | ||
| * mutate any internal state that affects [submit] / [getRecordMergeAction]. | ||
| */ | ||
| setTransactionMode?: (modeId: string) => void; | ||
| /** | ||
| * Optional inline call-to-action surfaced on the form when the current | ||
| * (mode, amount, balance) state requires user remediation that the form | ||
| * itself can trigger — e.g. Aleo's "no single private record covers the | ||
| * amount; merge records first". Returning `undefined` hides the banner. | ||
| * | ||
| * The widget renders an alert showing `message` plus a button that | ||
| * invokes `onAction`; while the action is in-flight the form disables | ||
| * the submit button. | ||
| */ | ||
| getRecordMergeAction?: () => RecordMergeAction | undefined; | ||
| /** | ||
| * Optional. Called by the send form whenever the amount input changes | ||
| * (on blur) so the transaction can keep any derived state — chiefly | ||
| * [getRecordMergeAction] — current with what the user has typed. | ||
| * Implementations should never throw on invalid input; they should | ||
| * either no-op or clear the derived state. The form already handles | ||
| * Yup validation separately. | ||
| */ | ||
| setPendingAmount?: (amountInput: string) => void; | ||
| /** | ||
| * Optional. When provided, the SendBalanceView uses this list as the | ||
| * token picker's source AND for the "Available" balance display, | ||
| * instead of the default `useTokenBalances` (redcoast-backed) fetch. | ||
| * | ||
| * Useful for chains where the SPENDABLE balance differs from a public | ||
| * balance lookup. For example, Aleo always spends from private records | ||
| * during a Send, so the picker should reflect the user's shielded | ||
| * balance — not the public mapping value redcoast returns. | ||
| * | ||
| * Implementations should return `TokenBalance` entries shaped like | ||
| * what `useTokenBalances` would return (so the rest of the form | ||
| * renders unchanged): `address`, `name`, `symbol`, `decimals`, | ||
| * `balance` (display units, number) and `rawBalance` (atomic units, | ||
| * number) at minimum, plus optional `logoURI`, `isNative`, `price`. | ||
| * | ||
| * Resolves to `undefined` (or absent) → form falls back to the | ||
| * default fetcher and behaves as today for every other chain. | ||
| */ | ||
| getSendableTokenBalances?: () => Promise<TokenBalance[] | undefined>; | ||
| /** | ||
| * Optional. Called by the send form whenever the user picks a different | ||
| * token in the picker, with the token's `address` (`contractAddress`). | ||
| * Implementations should update any per-token state that affects | ||
| * [submit], [getBalance], [getRecordMergeAction], or [parse]/[format] | ||
| * decimals. Used by chains where the picker entries map to materially | ||
| * different submit paths (e.g. Aleo: credits vs. stablecoin vs. ARC-21, | ||
| * each with its own program id and transition signature). | ||
| * | ||
| * Other chains leave this undefined; the form does not call it. | ||
| */ | ||
| setSelectedToken?: (contractAddress: string) => void; | ||
| } | ||
| /** A single option rendered in the send form's transaction-mode toggle. */ | ||
| export interface TransactionModeOption { | ||
| /** Stable id, returned by `setTransactionMode`. */ | ||
| id: string; | ||
| /** User-facing label (e.g. "Individual"). */ | ||
| label: string; | ||
| icon?: 'individual' | 'exchange'; | ||
| /** When true, the segment renders disabled and is non-interactive. */ | ||
| disabled?: boolean; | ||
| /** Optional tooltip explaining the disabled state. */ | ||
| disabledReason?: string; | ||
| } | ||
| export interface RecordMergeAction { | ||
| /** Plain-text explanation of what's wrong. */ | ||
| message: string; | ||
| /** Label for the action button (e.g. "Merge records"). */ | ||
| actionLabel: string; | ||
| onAction: () => Promise<void>; | ||
| } | ||
| export interface IUITransactionFormatOptions { | ||
@@ -150,0 +245,0 @@ precision?: number; |
Sorry, the diff of this file is too big to display
613149
0.93%894
11.89%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed