@dipansrimany/mlink-sdk 0.3.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,30 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { E as EVMTransaction, C as ChainConfig, A as ActionMetadata } from '../types-CAnUIaVe.js';
2
+ import { E as EVMTransaction, C as ChainConfig, A as ActionMetadata } from '../types-DD9rJ58Y.js';
3
3
  import React from 'react';
4
4
 
5
- type MlinkStatus = 'idle' | 'loading' | 'ready' | 'executing' | 'success' | 'error';
5
+ type MlinkStatus = 'idle' | 'loading' | 'validating' | 'ready' | 'executing' | 'success' | 'error' | 'unregistered' | 'blocked';
6
+ type RegistrationStatus = 'pending' | 'approved' | 'blocked' | null;
7
+ interface RegistrationResult {
8
+ isRegistered: boolean;
9
+ status: RegistrationStatus;
10
+ error?: string;
11
+ warning?: string;
12
+ mlink?: {
13
+ mlinkId: string;
14
+ name: string;
15
+ description: string;
16
+ icon: string;
17
+ status: RegistrationStatus;
18
+ };
19
+ }
6
20
  interface MlinkInstance {
7
21
  status: MlinkStatus;
8
22
  metadata: ActionMetadata | null;
9
23
  error: string | null;
10
24
  url: string;
11
25
  refresh: () => Promise<void>;
26
+ registration: RegistrationResult | null;
27
+ isRegistered: boolean;
12
28
  }
13
29
  interface MlinkAdapter {
14
30
  connect: () => Promise<string>;
@@ -78,6 +94,14 @@ interface MlinkProps {
78
94
  onError?: (error: string) => void;
79
95
  className?: string;
80
96
  stylePreset?: 'default' | 'compact' | 'minimal';
97
+ /** Registry URL for validation (defaults to https://mlinks-fe.vercel.app) */
98
+ registryUrl?: string;
99
+ /** Whether to require registration for the mlink to work (defaults to true) */
100
+ requireRegistration?: boolean;
101
+ /** Whether to allow pending mlinks (defaults to true) */
102
+ allowPending?: boolean;
103
+ /** Whether to allow blocked mlinks (defaults to false) */
104
+ allowBlocked?: boolean;
81
105
  }
82
106
  interface ActionButtonProps {
83
107
  label: string;
@@ -97,6 +121,14 @@ interface ExecutionResult {
97
121
  interface UseMlinkOptions {
98
122
  refreshInterval?: number;
99
123
  enabled?: boolean;
124
+ /** Registry URL for validation (defaults to https://mlinks-fe.vercel.app) */
125
+ registryUrl?: string;
126
+ /** Whether to require registration for the mlink to work (defaults to true) */
127
+ requireRegistration?: boolean;
128
+ /** Whether to allow pending mlinks (defaults to true) */
129
+ allowPending?: boolean;
130
+ /** Whether to allow blocked mlinks (defaults to false) */
131
+ allowBlocked?: boolean;
100
132
  }
101
133
  interface UseExecuteMlinkReturn {
102
134
  execute: (action: string, input?: string) => Promise<ExecutionResult>;
@@ -106,7 +138,7 @@ interface UseExecuteMlinkReturn {
106
138
  reset: () => void;
107
139
  }
108
140
 
109
- declare function Mlink({ url, adapter, theme: themeProp, onSuccess, onError, className, stylePreset, }: MlinkProps): react_jsx_runtime.JSX.Element;
141
+ declare function Mlink({ url, adapter, theme: themeProp, onSuccess, onError, className, stylePreset, registryUrl, requireRegistration, allowPending, allowBlocked, }: MlinkProps): react_jsx_runtime.JSX.Element;
110
142
 
111
143
  interface MlinkContextValue {
112
144
  theme: MlinkTheme;
@@ -126,7 +158,13 @@ interface UseExecuteMlinkOptions {
126
158
  onSuccess?: (txHash: string, action: string) => void;
127
159
  onError?: (error: string) => void;
128
160
  }
129
- declare function useExecuteMlink(options: UseExecuteMlinkOptions): UseExecuteMlinkReturn;
161
+ /**
162
+ * Enhanced UseExecuteMlinkReturn with data parameter support
163
+ */
164
+ interface UseExecuteMlinkReturnEnhanced extends Omit<UseExecuteMlinkReturn, 'execute'> {
165
+ execute: (action: string, input?: string, data?: Record<string, string | string[]>) => Promise<ExecutionResult>;
166
+ }
167
+ declare function useExecuteMlink(options: UseExecuteMlinkOptions): UseExecuteMlinkReturnEnhanced;
130
168
 
131
169
  /**
132
170
  * Create a Mlink adapter from wagmi hooks
@@ -205,4 +243,4 @@ declare const mantleTheme: MlinkTheme;
205
243
  declare const themePresets: Record<MlinkThemePreset, MlinkTheme>;
206
244
  declare function resolveTheme(theme?: Partial<MlinkTheme> | MlinkThemePreset): MlinkTheme;
207
245
 
208
- export { type ActionButtonProps, type EthersAdapterConfig, type ExecutionResult, Mlink, type MlinkAdapter, Mlink as MlinkComponent, type MlinkInstance, type MlinkProps, MlinkProvider, type MlinkProviderConfig, type MlinkStatus, type MlinkTheme, type MlinkThemePreset, type UseExecuteMlinkReturn, type UseMlinkOptions, type WagmiAdapterConfig, createMlinkAdapter, darkTheme, lightTheme, mantleTheme, resolveTheme, themePresets, useExecuteMlink, useMlink, useMlinkContext, useMlinkEthersAdapter, useMlinkWagmiAdapter };
246
+ export { type ActionButtonProps, type EthersAdapterConfig, type ExecutionResult, Mlink, type MlinkAdapter, Mlink as MlinkComponent, type MlinkInstance, type MlinkProps, MlinkProvider, type MlinkProviderConfig, type MlinkStatus, type MlinkTheme, type MlinkThemePreset, type RegistrationResult, type RegistrationStatus, type UseExecuteMlinkReturn, type UseExecuteMlinkReturnEnhanced, type UseMlinkOptions, type WagmiAdapterConfig, createMlinkAdapter, darkTheme, lightTheme, mantleTheme, resolveTheme, themePresets, useExecuteMlink, useMlink, useMlinkContext, useMlinkEthersAdapter, useMlinkWagmiAdapter };