@dipansrimany/mlink-sdk 0.3.1 → 0.4.1
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.
- package/dist/adapters/express.d.mts +2 -2
- package/dist/adapters/express.d.ts +2 -2
- package/dist/adapters/express.js +117 -10
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +117 -10
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/next.d.mts +2 -2
- package/dist/adapters/next.d.ts +2 -2
- package/dist/adapters/next.js +117 -10
- package/dist/adapters/next.js.map +1 -1
- package/dist/adapters/next.mjs +117 -10
- package/dist/adapters/next.mjs.map +1 -1
- package/dist/builders-CLqoe2Kx.d.ts +245 -0
- package/dist/builders-pKj4NiIj.d.mts +245 -0
- package/dist/index.d.mts +1129 -24
- package/dist/index.d.ts +1129 -24
- package/dist/index.js +342 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -21
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +9 -3
- package/dist/react/index.d.ts +9 -3
- package/dist/react/index.js +407 -30
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +407 -30
- package/dist/react/index.mjs.map +1 -1
- package/dist/styles.css +191 -0
- package/dist/types-DD9rJ58Y.d.mts +214 -0
- package/dist/types-DD9rJ58Y.d.ts +214 -0
- package/package.json +2 -2
- package/dist/builders-CJNt88dM.d.ts +0 -19
- package/dist/builders-CN5ijFpW.d.mts +0 -19
- package/dist/types-CAnUIaVe.d.mts +0 -68
- package/dist/types-CAnUIaVe.d.ts +0 -68
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
type ActionType = 'button' | 'input';
|
|
2
|
+
interface ActionButton {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
type: ActionType;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ActionError {
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parameter types supported by linked actions
|
|
14
|
+
* Similar to HTML input types + blockchain-specific types
|
|
15
|
+
*/
|
|
16
|
+
type ActionParameterType = 'text' | 'number' | 'email' | 'url' | 'date' | 'datetime-local' | 'textarea' | 'select' | 'radio' | 'checkbox' | 'address' | 'token' | 'amount';
|
|
17
|
+
/**
|
|
18
|
+
* Selectable parameter types that require options array
|
|
19
|
+
*/
|
|
20
|
+
type SelectableParameterType = 'select' | 'radio' | 'checkbox';
|
|
21
|
+
/**
|
|
22
|
+
* Option for select/radio/checkbox parameters
|
|
23
|
+
*/
|
|
24
|
+
interface ActionParameterOption {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
selected?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Base action parameter (non-selectable types)
|
|
31
|
+
*/
|
|
32
|
+
interface ActionParameterBase {
|
|
33
|
+
/** Parameter name - used as placeholder key in href template */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Display label for the input */
|
|
36
|
+
label?: string;
|
|
37
|
+
/** Whether this parameter is required */
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/** Regex pattern for validation */
|
|
40
|
+
pattern?: string;
|
|
41
|
+
/** Description of what the pattern expects */
|
|
42
|
+
patternDescription?: string;
|
|
43
|
+
/** Minimum value (for number/date types) */
|
|
44
|
+
min?: string | number;
|
|
45
|
+
/** Maximum value (for number/date types) */
|
|
46
|
+
max?: string | number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Non-selectable parameter (text, number, etc.)
|
|
50
|
+
*/
|
|
51
|
+
interface ActionParameter extends ActionParameterBase {
|
|
52
|
+
type?: Exclude<ActionParameterType, SelectableParameterType>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Selectable parameter (select, radio, checkbox)
|
|
56
|
+
*/
|
|
57
|
+
interface ActionParameterSelectable extends ActionParameterBase {
|
|
58
|
+
type: SelectableParameterType;
|
|
59
|
+
/** Options for selection */
|
|
60
|
+
options: ActionParameterOption[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Union type for all parameter types
|
|
64
|
+
*/
|
|
65
|
+
type TypedActionParameter = ActionParameter | ActionParameterSelectable;
|
|
66
|
+
/**
|
|
67
|
+
* Linked action type
|
|
68
|
+
*/
|
|
69
|
+
type LinkedActionType = 'transaction' | 'post' | 'external-link';
|
|
70
|
+
/**
|
|
71
|
+
* Linked action with href template and parameters
|
|
72
|
+
* Similar to Solana's LinkedAction
|
|
73
|
+
*/
|
|
74
|
+
interface LinkedAction {
|
|
75
|
+
/** Type of action (defaults to 'transaction') */
|
|
76
|
+
type?: LinkedActionType;
|
|
77
|
+
/** URL template with {parameter} placeholders */
|
|
78
|
+
href: string;
|
|
79
|
+
/** Button label */
|
|
80
|
+
label: string;
|
|
81
|
+
/** Whether this action is disabled */
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/** Parameters to collect from user */
|
|
84
|
+
parameters?: TypedActionParameter[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Links section containing linked actions
|
|
88
|
+
*/
|
|
89
|
+
interface ActionLinks {
|
|
90
|
+
/** Array of linked actions */
|
|
91
|
+
actions: LinkedAction[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* POST callback for next action after transaction confirms
|
|
95
|
+
*/
|
|
96
|
+
interface PostNextActionLink {
|
|
97
|
+
type: 'post';
|
|
98
|
+
/** Callback URL to get next action */
|
|
99
|
+
href: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Inline next action (embedded in response)
|
|
103
|
+
*/
|
|
104
|
+
interface InlineNextActionLink {
|
|
105
|
+
type: 'inline';
|
|
106
|
+
/** Next action metadata */
|
|
107
|
+
action: ActionMetadata;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Next action link (for chaining)
|
|
111
|
+
*/
|
|
112
|
+
type NextActionLink = PostNextActionLink | InlineNextActionLink;
|
|
113
|
+
/**
|
|
114
|
+
* GET response - action metadata
|
|
115
|
+
* Enhanced with optional links.actions for Solana-style linked actions
|
|
116
|
+
*/
|
|
117
|
+
interface ActionMetadata {
|
|
118
|
+
/** Action type (defaults to 'action') */
|
|
119
|
+
type?: 'action' | 'completed';
|
|
120
|
+
/** Action title */
|
|
121
|
+
title: string;
|
|
122
|
+
/** Icon URL or base64 image */
|
|
123
|
+
icon: string;
|
|
124
|
+
/** Action description */
|
|
125
|
+
description: string;
|
|
126
|
+
/** Primary button label (used when no linked actions) */
|
|
127
|
+
label?: string;
|
|
128
|
+
/** Legacy actions array (for backwards compatibility) */
|
|
129
|
+
actions?: ActionButton[];
|
|
130
|
+
/** Linked actions with parameters (Solana-style) */
|
|
131
|
+
links?: ActionLinks;
|
|
132
|
+
/** Whether the entire action is disabled */
|
|
133
|
+
disabled?: boolean;
|
|
134
|
+
/** Error to display */
|
|
135
|
+
error?: ActionError;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* POST body - transaction request
|
|
139
|
+
* Enhanced to support parameter data
|
|
140
|
+
*/
|
|
141
|
+
interface TransactionRequest {
|
|
142
|
+
/** User's wallet address */
|
|
143
|
+
account: string;
|
|
144
|
+
/** Selected action value or href */
|
|
145
|
+
action: string;
|
|
146
|
+
/** Legacy single input value */
|
|
147
|
+
input?: string;
|
|
148
|
+
/** Parameter values collected from form (Solana-style) */
|
|
149
|
+
data?: Record<string, string | string[]>;
|
|
150
|
+
}
|
|
151
|
+
interface EVMTransaction {
|
|
152
|
+
to: string;
|
|
153
|
+
value: string;
|
|
154
|
+
data: string;
|
|
155
|
+
chainId: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* POST response - Enhanced to support multiple transactions and chaining
|
|
159
|
+
*/
|
|
160
|
+
interface TransactionResponse {
|
|
161
|
+
/** Single transaction (for simple cases) */
|
|
162
|
+
transaction?: EVMTransaction;
|
|
163
|
+
/** Multiple transactions (for batch/multi-contract) */
|
|
164
|
+
transactions?: EVMTransaction[];
|
|
165
|
+
/** Message to display to user */
|
|
166
|
+
message?: string;
|
|
167
|
+
/** Next action for chaining */
|
|
168
|
+
links?: {
|
|
169
|
+
next?: NextActionLink;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Context passed to handler
|
|
174
|
+
* Enhanced to support parameter data
|
|
175
|
+
*/
|
|
176
|
+
interface ActionContext {
|
|
177
|
+
/** User's wallet address */
|
|
178
|
+
account: string;
|
|
179
|
+
/** Selected action value or href */
|
|
180
|
+
action: string;
|
|
181
|
+
/** Legacy single input value */
|
|
182
|
+
input?: string;
|
|
183
|
+
/** Parameter values from form (Solana-style) */
|
|
184
|
+
data?: Record<string, string | string[]>;
|
|
185
|
+
}
|
|
186
|
+
type ActionHandler = (context: ActionContext) => Promise<TransactionResponse>;
|
|
187
|
+
interface ActionDefinition {
|
|
188
|
+
title: string;
|
|
189
|
+
icon: string;
|
|
190
|
+
description: string;
|
|
191
|
+
actions: ActionButton[];
|
|
192
|
+
disabled?: boolean;
|
|
193
|
+
handler: ActionHandler;
|
|
194
|
+
}
|
|
195
|
+
interface ChainConfig {
|
|
196
|
+
chainId: number;
|
|
197
|
+
name: string;
|
|
198
|
+
rpcUrl: string;
|
|
199
|
+
explorerUrl: string;
|
|
200
|
+
nativeCurrency: {
|
|
201
|
+
name: string;
|
|
202
|
+
symbol: string;
|
|
203
|
+
decimals: number;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
type ValidationResult<T> = {
|
|
207
|
+
success: true;
|
|
208
|
+
data: T;
|
|
209
|
+
} | {
|
|
210
|
+
success: false;
|
|
211
|
+
error: string;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export type { ActionMetadata as A, ChainConfig as C, EVMTransaction as E, InlineNextActionLink as I, LinkedAction as L, NextActionLink as N, PostNextActionLink as P, SelectableParameterType as S, TransactionRequest as T, ValidationResult as V, TransactionResponse as a, TypedActionParameter as b, ActionType as c, ActionButton as d, ActionError as e, ActionHandler as f, ActionDefinition as g, ActionContext as h, ActionParameterType as i, ActionParameterOption as j, ActionParameterBase as k, ActionParameter as l, ActionParameterSelectable as m, LinkedActionType as n, ActionLinks as o };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
type ActionType = 'button' | 'input';
|
|
2
|
+
interface ActionButton {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
type: ActionType;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ActionError {
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parameter types supported by linked actions
|
|
14
|
+
* Similar to HTML input types + blockchain-specific types
|
|
15
|
+
*/
|
|
16
|
+
type ActionParameterType = 'text' | 'number' | 'email' | 'url' | 'date' | 'datetime-local' | 'textarea' | 'select' | 'radio' | 'checkbox' | 'address' | 'token' | 'amount';
|
|
17
|
+
/**
|
|
18
|
+
* Selectable parameter types that require options array
|
|
19
|
+
*/
|
|
20
|
+
type SelectableParameterType = 'select' | 'radio' | 'checkbox';
|
|
21
|
+
/**
|
|
22
|
+
* Option for select/radio/checkbox parameters
|
|
23
|
+
*/
|
|
24
|
+
interface ActionParameterOption {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
selected?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Base action parameter (non-selectable types)
|
|
31
|
+
*/
|
|
32
|
+
interface ActionParameterBase {
|
|
33
|
+
/** Parameter name - used as placeholder key in href template */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Display label for the input */
|
|
36
|
+
label?: string;
|
|
37
|
+
/** Whether this parameter is required */
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/** Regex pattern for validation */
|
|
40
|
+
pattern?: string;
|
|
41
|
+
/** Description of what the pattern expects */
|
|
42
|
+
patternDescription?: string;
|
|
43
|
+
/** Minimum value (for number/date types) */
|
|
44
|
+
min?: string | number;
|
|
45
|
+
/** Maximum value (for number/date types) */
|
|
46
|
+
max?: string | number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Non-selectable parameter (text, number, etc.)
|
|
50
|
+
*/
|
|
51
|
+
interface ActionParameter extends ActionParameterBase {
|
|
52
|
+
type?: Exclude<ActionParameterType, SelectableParameterType>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Selectable parameter (select, radio, checkbox)
|
|
56
|
+
*/
|
|
57
|
+
interface ActionParameterSelectable extends ActionParameterBase {
|
|
58
|
+
type: SelectableParameterType;
|
|
59
|
+
/** Options for selection */
|
|
60
|
+
options: ActionParameterOption[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Union type for all parameter types
|
|
64
|
+
*/
|
|
65
|
+
type TypedActionParameter = ActionParameter | ActionParameterSelectable;
|
|
66
|
+
/**
|
|
67
|
+
* Linked action type
|
|
68
|
+
*/
|
|
69
|
+
type LinkedActionType = 'transaction' | 'post' | 'external-link';
|
|
70
|
+
/**
|
|
71
|
+
* Linked action with href template and parameters
|
|
72
|
+
* Similar to Solana's LinkedAction
|
|
73
|
+
*/
|
|
74
|
+
interface LinkedAction {
|
|
75
|
+
/** Type of action (defaults to 'transaction') */
|
|
76
|
+
type?: LinkedActionType;
|
|
77
|
+
/** URL template with {parameter} placeholders */
|
|
78
|
+
href: string;
|
|
79
|
+
/** Button label */
|
|
80
|
+
label: string;
|
|
81
|
+
/** Whether this action is disabled */
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/** Parameters to collect from user */
|
|
84
|
+
parameters?: TypedActionParameter[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Links section containing linked actions
|
|
88
|
+
*/
|
|
89
|
+
interface ActionLinks {
|
|
90
|
+
/** Array of linked actions */
|
|
91
|
+
actions: LinkedAction[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* POST callback for next action after transaction confirms
|
|
95
|
+
*/
|
|
96
|
+
interface PostNextActionLink {
|
|
97
|
+
type: 'post';
|
|
98
|
+
/** Callback URL to get next action */
|
|
99
|
+
href: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Inline next action (embedded in response)
|
|
103
|
+
*/
|
|
104
|
+
interface InlineNextActionLink {
|
|
105
|
+
type: 'inline';
|
|
106
|
+
/** Next action metadata */
|
|
107
|
+
action: ActionMetadata;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Next action link (for chaining)
|
|
111
|
+
*/
|
|
112
|
+
type NextActionLink = PostNextActionLink | InlineNextActionLink;
|
|
113
|
+
/**
|
|
114
|
+
* GET response - action metadata
|
|
115
|
+
* Enhanced with optional links.actions for Solana-style linked actions
|
|
116
|
+
*/
|
|
117
|
+
interface ActionMetadata {
|
|
118
|
+
/** Action type (defaults to 'action') */
|
|
119
|
+
type?: 'action' | 'completed';
|
|
120
|
+
/** Action title */
|
|
121
|
+
title: string;
|
|
122
|
+
/** Icon URL or base64 image */
|
|
123
|
+
icon: string;
|
|
124
|
+
/** Action description */
|
|
125
|
+
description: string;
|
|
126
|
+
/** Primary button label (used when no linked actions) */
|
|
127
|
+
label?: string;
|
|
128
|
+
/** Legacy actions array (for backwards compatibility) */
|
|
129
|
+
actions?: ActionButton[];
|
|
130
|
+
/** Linked actions with parameters (Solana-style) */
|
|
131
|
+
links?: ActionLinks;
|
|
132
|
+
/** Whether the entire action is disabled */
|
|
133
|
+
disabled?: boolean;
|
|
134
|
+
/** Error to display */
|
|
135
|
+
error?: ActionError;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* POST body - transaction request
|
|
139
|
+
* Enhanced to support parameter data
|
|
140
|
+
*/
|
|
141
|
+
interface TransactionRequest {
|
|
142
|
+
/** User's wallet address */
|
|
143
|
+
account: string;
|
|
144
|
+
/** Selected action value or href */
|
|
145
|
+
action: string;
|
|
146
|
+
/** Legacy single input value */
|
|
147
|
+
input?: string;
|
|
148
|
+
/** Parameter values collected from form (Solana-style) */
|
|
149
|
+
data?: Record<string, string | string[]>;
|
|
150
|
+
}
|
|
151
|
+
interface EVMTransaction {
|
|
152
|
+
to: string;
|
|
153
|
+
value: string;
|
|
154
|
+
data: string;
|
|
155
|
+
chainId: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* POST response - Enhanced to support multiple transactions and chaining
|
|
159
|
+
*/
|
|
160
|
+
interface TransactionResponse {
|
|
161
|
+
/** Single transaction (for simple cases) */
|
|
162
|
+
transaction?: EVMTransaction;
|
|
163
|
+
/** Multiple transactions (for batch/multi-contract) */
|
|
164
|
+
transactions?: EVMTransaction[];
|
|
165
|
+
/** Message to display to user */
|
|
166
|
+
message?: string;
|
|
167
|
+
/** Next action for chaining */
|
|
168
|
+
links?: {
|
|
169
|
+
next?: NextActionLink;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Context passed to handler
|
|
174
|
+
* Enhanced to support parameter data
|
|
175
|
+
*/
|
|
176
|
+
interface ActionContext {
|
|
177
|
+
/** User's wallet address */
|
|
178
|
+
account: string;
|
|
179
|
+
/** Selected action value or href */
|
|
180
|
+
action: string;
|
|
181
|
+
/** Legacy single input value */
|
|
182
|
+
input?: string;
|
|
183
|
+
/** Parameter values from form (Solana-style) */
|
|
184
|
+
data?: Record<string, string | string[]>;
|
|
185
|
+
}
|
|
186
|
+
type ActionHandler = (context: ActionContext) => Promise<TransactionResponse>;
|
|
187
|
+
interface ActionDefinition {
|
|
188
|
+
title: string;
|
|
189
|
+
icon: string;
|
|
190
|
+
description: string;
|
|
191
|
+
actions: ActionButton[];
|
|
192
|
+
disabled?: boolean;
|
|
193
|
+
handler: ActionHandler;
|
|
194
|
+
}
|
|
195
|
+
interface ChainConfig {
|
|
196
|
+
chainId: number;
|
|
197
|
+
name: string;
|
|
198
|
+
rpcUrl: string;
|
|
199
|
+
explorerUrl: string;
|
|
200
|
+
nativeCurrency: {
|
|
201
|
+
name: string;
|
|
202
|
+
symbol: string;
|
|
203
|
+
decimals: number;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
type ValidationResult<T> = {
|
|
207
|
+
success: true;
|
|
208
|
+
data: T;
|
|
209
|
+
} | {
|
|
210
|
+
success: false;
|
|
211
|
+
error: string;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export type { ActionMetadata as A, ChainConfig as C, EVMTransaction as E, InlineNextActionLink as I, LinkedAction as L, NextActionLink as N, PostNextActionLink as P, SelectableParameterType as S, TransactionRequest as T, ValidationResult as V, TransactionResponse as a, TypedActionParameter as b, ActionType as c, ActionButton as d, ActionError as e, ActionHandler as f, ActionDefinition as g, ActionContext as h, ActionParameterType as i, ActionParameterOption as j, ActionParameterBase as k, ActionParameter as l, ActionParameterSelectable as m, LinkedActionType as n, ActionLinks as o };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dipansrimany/mlink-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "SDK for building Mantle links - shareable blockchain transaction URLs with React UI components",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "SDK for building Mantle links - shareable blockchain transaction URLs with React UI components. Supports Solana-style linked actions with parameters.",
|
|
5
5
|
"author": "Mlink",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { f as ActionDefinition, A as ActionMetadata, T as TransactionRequest, a as TransactionResponse, c as ActionButton } from './types-CAnUIaVe.js';
|
|
2
|
-
|
|
3
|
-
declare function button(config: {
|
|
4
|
-
label: string;
|
|
5
|
-
value: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
}): ActionButton;
|
|
8
|
-
declare function input(config: {
|
|
9
|
-
label: string;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}): ActionButton;
|
|
13
|
-
interface Action {
|
|
14
|
-
getMetadata(): ActionMetadata;
|
|
15
|
-
handleRequest(request: TransactionRequest): Promise<TransactionResponse>;
|
|
16
|
-
}
|
|
17
|
-
declare function createAction(definition: ActionDefinition): Action;
|
|
18
|
-
|
|
19
|
-
export { type Action as A, button as b, createAction as c, input as i };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { f as ActionDefinition, A as ActionMetadata, T as TransactionRequest, a as TransactionResponse, c as ActionButton } from './types-CAnUIaVe.mjs';
|
|
2
|
-
|
|
3
|
-
declare function button(config: {
|
|
4
|
-
label: string;
|
|
5
|
-
value: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
}): ActionButton;
|
|
8
|
-
declare function input(config: {
|
|
9
|
-
label: string;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}): ActionButton;
|
|
13
|
-
interface Action {
|
|
14
|
-
getMetadata(): ActionMetadata;
|
|
15
|
-
handleRequest(request: TransactionRequest): Promise<TransactionResponse>;
|
|
16
|
-
}
|
|
17
|
-
declare function createAction(definition: ActionDefinition): Action;
|
|
18
|
-
|
|
19
|
-
export { type Action as A, button as b, createAction as c, input as i };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
type ActionType = 'button' | 'input';
|
|
2
|
-
interface ActionButton {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
type: ActionType;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface ActionError {
|
|
10
|
-
message: string;
|
|
11
|
-
}
|
|
12
|
-
interface ActionMetadata {
|
|
13
|
-
title: string;
|
|
14
|
-
icon: string;
|
|
15
|
-
description: string;
|
|
16
|
-
actions: ActionButton[];
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
error?: ActionError;
|
|
19
|
-
}
|
|
20
|
-
interface TransactionRequest {
|
|
21
|
-
account: string;
|
|
22
|
-
action: string;
|
|
23
|
-
input?: string;
|
|
24
|
-
}
|
|
25
|
-
interface EVMTransaction {
|
|
26
|
-
to: string;
|
|
27
|
-
value: string;
|
|
28
|
-
data: string;
|
|
29
|
-
chainId: number;
|
|
30
|
-
}
|
|
31
|
-
interface TransactionResponse {
|
|
32
|
-
transaction: EVMTransaction;
|
|
33
|
-
message?: string;
|
|
34
|
-
}
|
|
35
|
-
interface ActionContext {
|
|
36
|
-
account: string;
|
|
37
|
-
action: string;
|
|
38
|
-
input?: string;
|
|
39
|
-
}
|
|
40
|
-
type ActionHandler = (context: ActionContext) => Promise<TransactionResponse>;
|
|
41
|
-
interface ActionDefinition {
|
|
42
|
-
title: string;
|
|
43
|
-
icon: string;
|
|
44
|
-
description: string;
|
|
45
|
-
actions: ActionButton[];
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
handler: ActionHandler;
|
|
48
|
-
}
|
|
49
|
-
interface ChainConfig {
|
|
50
|
-
chainId: number;
|
|
51
|
-
name: string;
|
|
52
|
-
rpcUrl: string;
|
|
53
|
-
explorerUrl: string;
|
|
54
|
-
nativeCurrency: {
|
|
55
|
-
name: string;
|
|
56
|
-
symbol: string;
|
|
57
|
-
decimals: number;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
type ValidationResult<T> = {
|
|
61
|
-
success: true;
|
|
62
|
-
data: T;
|
|
63
|
-
} | {
|
|
64
|
-
success: false;
|
|
65
|
-
error: string;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type { ActionMetadata as A, ChainConfig as C, EVMTransaction as E, TransactionRequest as T, ValidationResult as V, TransactionResponse as a, ActionType as b, ActionButton as c, ActionError as d, ActionHandler as e, ActionDefinition as f, ActionContext as g };
|
package/dist/types-CAnUIaVe.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
type ActionType = 'button' | 'input';
|
|
2
|
-
interface ActionButton {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
type: ActionType;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface ActionError {
|
|
10
|
-
message: string;
|
|
11
|
-
}
|
|
12
|
-
interface ActionMetadata {
|
|
13
|
-
title: string;
|
|
14
|
-
icon: string;
|
|
15
|
-
description: string;
|
|
16
|
-
actions: ActionButton[];
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
error?: ActionError;
|
|
19
|
-
}
|
|
20
|
-
interface TransactionRequest {
|
|
21
|
-
account: string;
|
|
22
|
-
action: string;
|
|
23
|
-
input?: string;
|
|
24
|
-
}
|
|
25
|
-
interface EVMTransaction {
|
|
26
|
-
to: string;
|
|
27
|
-
value: string;
|
|
28
|
-
data: string;
|
|
29
|
-
chainId: number;
|
|
30
|
-
}
|
|
31
|
-
interface TransactionResponse {
|
|
32
|
-
transaction: EVMTransaction;
|
|
33
|
-
message?: string;
|
|
34
|
-
}
|
|
35
|
-
interface ActionContext {
|
|
36
|
-
account: string;
|
|
37
|
-
action: string;
|
|
38
|
-
input?: string;
|
|
39
|
-
}
|
|
40
|
-
type ActionHandler = (context: ActionContext) => Promise<TransactionResponse>;
|
|
41
|
-
interface ActionDefinition {
|
|
42
|
-
title: string;
|
|
43
|
-
icon: string;
|
|
44
|
-
description: string;
|
|
45
|
-
actions: ActionButton[];
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
handler: ActionHandler;
|
|
48
|
-
}
|
|
49
|
-
interface ChainConfig {
|
|
50
|
-
chainId: number;
|
|
51
|
-
name: string;
|
|
52
|
-
rpcUrl: string;
|
|
53
|
-
explorerUrl: string;
|
|
54
|
-
nativeCurrency: {
|
|
55
|
-
name: string;
|
|
56
|
-
symbol: string;
|
|
57
|
-
decimals: number;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
type ValidationResult<T> = {
|
|
61
|
-
success: true;
|
|
62
|
-
data: T;
|
|
63
|
-
} | {
|
|
64
|
-
success: false;
|
|
65
|
-
error: string;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type { ActionMetadata as A, ChainConfig as C, EVMTransaction as E, TransactionRequest as T, ValidationResult as V, TransactionResponse as a, ActionType as b, ActionButton as c, ActionError as d, ActionHandler as e, ActionDefinition as f, ActionContext as g };
|