@mantle-rwa/react 0.1.0
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/cjs/components/InvestorDashboard/index.js +156 -0
- package/dist/cjs/components/InvestorDashboard/index.js.map +1 -0
- package/dist/cjs/components/KYCFlow/index.js +231 -0
- package/dist/cjs/components/KYCFlow/index.js.map +1 -0
- package/dist/cjs/components/TokenMintForm/index.js +286 -0
- package/dist/cjs/components/TokenMintForm/index.js.map +1 -0
- package/dist/cjs/components/YieldCalculator/index.js +245 -0
- package/dist/cjs/components/YieldCalculator/index.js.map +1 -0
- package/dist/cjs/components/index.js +15 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/hooks/index.js +9 -0
- package/dist/cjs/hooks/index.js.map +1 -0
- package/dist/cjs/hooks/useRWA.js +54 -0
- package/dist/cjs/hooks/useRWA.js.map +1 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/index.js +10 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/esm/components/InvestorDashboard/index.js +153 -0
- package/dist/esm/components/InvestorDashboard/index.js.map +1 -0
- package/dist/esm/components/KYCFlow/index.js +228 -0
- package/dist/esm/components/KYCFlow/index.js.map +1 -0
- package/dist/esm/components/TokenMintForm/index.js +279 -0
- package/dist/esm/components/TokenMintForm/index.js.map +1 -0
- package/dist/esm/components/YieldCalculator/index.js +236 -0
- package/dist/esm/components/YieldCalculator/index.js.map +1 -0
- package/dist/esm/components/index.js +8 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/hooks/index.js +5 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/hooks/useRWA.js +51 -0
- package/dist/esm/hooks/useRWA.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/index.js +6 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/types/components/InvestorDashboard/index.d.ts +25 -0
- package/dist/types/components/InvestorDashboard/index.d.ts.map +1 -0
- package/dist/types/components/KYCFlow/index.d.ts +25 -0
- package/dist/types/components/KYCFlow/index.d.ts.map +1 -0
- package/dist/types/components/TokenMintForm/index.d.ts +60 -0
- package/dist/types/components/TokenMintForm/index.d.ts.map +1 -0
- package/dist/types/components/YieldCalculator/index.d.ts +59 -0
- package/dist/types/components/YieldCalculator/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +8 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +5 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/useRWA.d.ts +22 -0
- package/dist/types/hooks/useRWA.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +177 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +66 -0
- package/src/components/InvestorDashboard/index.tsx +359 -0
- package/src/components/KYCFlow/index.tsx +434 -0
- package/src/components/TokenMintForm/index.tsx +590 -0
- package/src/components/YieldCalculator/index.tsx +541 -0
- package/src/components/index.ts +8 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useRWA.ts +70 -0
- package/src/index.ts +32 -0
- package/src/styles/index.css +197 -0
- package/src/types/index.ts +193 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
/* Custom component styles */
|
|
6
|
+
.rwa-card {
|
|
7
|
+
@apply rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-700 dark:bg-gray-800;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rwa-button {
|
|
11
|
+
@apply inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.rwa-button-primary {
|
|
15
|
+
@apply rwa-button bg-mantle-600 text-white hover:bg-mantle-700 focus:ring-mantle-500;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.rwa-button-secondary {
|
|
19
|
+
@apply rwa-button border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-mantle-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.rwa-input {
|
|
23
|
+
@apply block w-full rounded-md border border-gray-300 px-3 py-2 text-sm placeholder-gray-400 focus:border-mantle-500 focus:outline-none focus:ring-1 focus:ring-mantle-500 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rwa-label {
|
|
27
|
+
@apply block text-sm font-medium text-gray-700 dark:text-gray-200;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* KYCFlow Component Styles */
|
|
31
|
+
.rwa-kyc-flow {
|
|
32
|
+
@apply rounded-lg border border-gray-200 bg-white p-6 shadow-sm;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.rwa-kyc-flow.dark {
|
|
36
|
+
@apply border-gray-700 bg-gray-800;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.rwa-kyc-header {
|
|
40
|
+
@apply text-lg font-semibold text-gray-900 mb-4;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.rwa-kyc-flow.dark .rwa-kyc-header {
|
|
44
|
+
@apply text-white;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.rwa-kyc-error {
|
|
48
|
+
@apply flex items-center gap-2 mb-4 p-3 bg-red-50 text-red-700 rounded-md border border-red-200;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.rwa-kyc-flow.dark .rwa-kyc-error {
|
|
52
|
+
@apply bg-red-900/20 text-red-300 border-red-800;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.rwa-kyc-error-icon {
|
|
56
|
+
@apply flex-shrink-0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.rwa-kyc-provider {
|
|
60
|
+
@apply flex items-center gap-3 mb-6 p-3 bg-gray-50 rounded-md;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.rwa-kyc-flow.dark .rwa-kyc-provider {
|
|
64
|
+
@apply bg-gray-700/50;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.rwa-kyc-provider-logo {
|
|
68
|
+
@apply text-2xl;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.rwa-kyc-provider-details {
|
|
72
|
+
@apply flex flex-col;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.rwa-kyc-provider-name {
|
|
76
|
+
@apply font-medium text-gray-900;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.rwa-kyc-flow.dark .rwa-kyc-provider-name {
|
|
80
|
+
@apply text-white;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.rwa-kyc-provider-description {
|
|
84
|
+
@apply text-sm text-gray-500;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.rwa-kyc-flow.dark .rwa-kyc-provider-description {
|
|
88
|
+
@apply text-gray-400;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.rwa-kyc-steps {
|
|
92
|
+
@apply space-y-3 mb-6;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.rwa-kyc-step {
|
|
96
|
+
@apply flex items-start gap-3 p-3 rounded-md transition-colors;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.rwa-kyc-step.pending {
|
|
100
|
+
@apply bg-gray-50;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.rwa-kyc-flow.dark .rwa-kyc-step.pending {
|
|
104
|
+
@apply bg-gray-700/30;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.rwa-kyc-step.in_progress {
|
|
108
|
+
@apply bg-blue-50 border border-blue-200;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.rwa-kyc-flow.dark .rwa-kyc-step.in_progress {
|
|
112
|
+
@apply bg-blue-900/20 border-blue-800;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.rwa-kyc-step.completed {
|
|
116
|
+
@apply bg-green-50;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.rwa-kyc-flow.dark .rwa-kyc-step.completed {
|
|
120
|
+
@apply bg-green-900/20;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.rwa-kyc-step.failed {
|
|
124
|
+
@apply bg-red-50;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.rwa-kyc-flow.dark .rwa-kyc-step.failed {
|
|
128
|
+
@apply bg-red-900/20;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.rwa-kyc-step-indicator {
|
|
132
|
+
@apply flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.rwa-kyc-step.pending .rwa-kyc-step-indicator {
|
|
136
|
+
@apply bg-gray-200 text-gray-600;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.rwa-kyc-flow.dark .rwa-kyc-step.pending .rwa-kyc-step-indicator {
|
|
140
|
+
@apply bg-gray-600 text-gray-300;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.rwa-kyc-step.in_progress .rwa-kyc-step-indicator {
|
|
144
|
+
@apply bg-blue-500 text-white;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.rwa-kyc-step.completed .rwa-kyc-step-indicator {
|
|
148
|
+
@apply bg-green-500 text-white;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.rwa-kyc-step.failed .rwa-kyc-step-indicator {
|
|
152
|
+
@apply bg-red-500 text-white;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.rwa-kyc-step-content {
|
|
156
|
+
@apply flex flex-col;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.rwa-kyc-step-label {
|
|
160
|
+
@apply font-medium text-gray-900;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.rwa-kyc-flow.dark .rwa-kyc-step-label {
|
|
164
|
+
@apply text-white;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.rwa-kyc-step-description {
|
|
168
|
+
@apply text-sm text-gray-500 mt-0.5;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.rwa-kyc-flow.dark .rwa-kyc-step-description {
|
|
172
|
+
@apply text-gray-400;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.rwa-kyc-actions {
|
|
176
|
+
@apply mt-6;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.rwa-kyc-actions button {
|
|
180
|
+
@apply w-full;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.rwa-kyc-success {
|
|
184
|
+
@apply flex items-center justify-center gap-2 p-3 bg-green-50 text-green-700 rounded-md font-medium;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.rwa-kyc-flow.dark .rwa-kyc-success {
|
|
188
|
+
@apply bg-green-900/20 text-green-300;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.rwa-kyc-success-icon {
|
|
192
|
+
@apply text-lg;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.rwa-kyc-session {
|
|
196
|
+
@apply mt-4 text-center;
|
|
197
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for @mantle-rwa/react components
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Re-export SDK types that are commonly used
|
|
6
|
+
export { AccreditationTier } from '@mantle-rwa/sdk';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Theme options for components
|
|
10
|
+
*/
|
|
11
|
+
export type Theme = 'light' | 'dark';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* KYC Provider options
|
|
15
|
+
*/
|
|
16
|
+
export type KYCProviderType = 'persona' | 'synaps' | 'jumio';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Required fields for KYC verification
|
|
20
|
+
*/
|
|
21
|
+
export type KYCRequiredField = 'identity' | 'accreditation' | 'address' | 'tax';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* KYC verification result
|
|
25
|
+
*/
|
|
26
|
+
export interface KYCResult {
|
|
27
|
+
verified: boolean;
|
|
28
|
+
tier: number;
|
|
29
|
+
identityHash: string;
|
|
30
|
+
sessionId: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* KYCFlow component props
|
|
35
|
+
* @see Requirements 10.1, 10.2, 10.3, 10.4, 10.5
|
|
36
|
+
*/
|
|
37
|
+
export interface KYCFlowProps {
|
|
38
|
+
/** KYC provider to use */
|
|
39
|
+
provider: KYCProviderType;
|
|
40
|
+
/** Callback when KYC verification completes */
|
|
41
|
+
onComplete: (kycData: KYCResult) => void;
|
|
42
|
+
/** Callback when an error occurs */
|
|
43
|
+
onError?: (error: Error) => void;
|
|
44
|
+
/** Required verification fields */
|
|
45
|
+
requiredFields: KYCRequiredField[];
|
|
46
|
+
/** Theme mode */
|
|
47
|
+
theme?: Theme;
|
|
48
|
+
/** Custom styles override */
|
|
49
|
+
customStyles?: Partial<KYCFlowStyles>;
|
|
50
|
+
/** KYC Registry contract address for auto-update */
|
|
51
|
+
registryAddress?: string;
|
|
52
|
+
/** Whether to automatically update the on-chain registry */
|
|
53
|
+
autoUpdateRegistry?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Custom styles for KYCFlow component
|
|
58
|
+
*/
|
|
59
|
+
export interface KYCFlowStyles {
|
|
60
|
+
container?: string;
|
|
61
|
+
header?: string;
|
|
62
|
+
content?: string;
|
|
63
|
+
button?: string;
|
|
64
|
+
input?: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* InvestorDashboard component props
|
|
70
|
+
* @see Requirements 11.1, 11.2, 11.3, 11.4, 11.5
|
|
71
|
+
*/
|
|
72
|
+
export interface InvestorDashboardProps {
|
|
73
|
+
/** RWA Token contract address */
|
|
74
|
+
tokenAddress: string;
|
|
75
|
+
/** Yield Distributor contract address */
|
|
76
|
+
yieldDistributorAddress: string;
|
|
77
|
+
/** KYC Registry contract address */
|
|
78
|
+
kycRegistryAddress: string;
|
|
79
|
+
/** Theme mode */
|
|
80
|
+
theme?: Theme;
|
|
81
|
+
/** Callback when yield is claimed */
|
|
82
|
+
onClaimYield?: (distributionId: number) => void;
|
|
83
|
+
/** Whether to show portfolio value */
|
|
84
|
+
showPortfolioValue?: boolean;
|
|
85
|
+
/** Price oracle address for portfolio value calculation */
|
|
86
|
+
priceOracle?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Yield history entry
|
|
91
|
+
*/
|
|
92
|
+
export interface YieldHistoryEntry {
|
|
93
|
+
distributionId: number;
|
|
94
|
+
amount: bigint;
|
|
95
|
+
paymentToken: string;
|
|
96
|
+
claimedAt: Date;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* TokenMintForm component props
|
|
101
|
+
* @see Requirements 12.1, 12.2, 12.3, 12.4
|
|
102
|
+
*/
|
|
103
|
+
export interface TokenMintFormProps {
|
|
104
|
+
/** RWA Token contract address */
|
|
105
|
+
tokenAddress: string;
|
|
106
|
+
/** KYC Registry contract address */
|
|
107
|
+
kycRegistryAddress: string;
|
|
108
|
+
/** Callback when minting completes */
|
|
109
|
+
onMintComplete?: (txHash: string, recipient: string, amount: string) => void;
|
|
110
|
+
/** Callback when an error occurs */
|
|
111
|
+
onError?: (error: Error) => void;
|
|
112
|
+
/** Whether to allow batch minting via CSV */
|
|
113
|
+
allowBatchMint?: boolean;
|
|
114
|
+
/** Maximum batch size for CSV uploads */
|
|
115
|
+
maxBatchSize?: number;
|
|
116
|
+
/** Theme mode */
|
|
117
|
+
theme?: Theme;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Batch mint entry from CSV
|
|
122
|
+
*/
|
|
123
|
+
export interface BatchMintEntry {
|
|
124
|
+
recipient: string;
|
|
125
|
+
amount: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* YieldCalculator component props
|
|
130
|
+
* @see Requirements 13.1, 13.2, 13.3, 13.4
|
|
131
|
+
*/
|
|
132
|
+
export interface YieldCalculatorProps {
|
|
133
|
+
/** RWA Token contract address */
|
|
134
|
+
tokenAddress: string;
|
|
135
|
+
/** Yield Distributor contract address */
|
|
136
|
+
yieldDistributorAddress: string;
|
|
137
|
+
/** Supported payment tokens */
|
|
138
|
+
supportedPaymentTokens: PaymentToken[];
|
|
139
|
+
/** Callback when distribution is initiated */
|
|
140
|
+
onDistribute?: (config: DistributionConfig) => void;
|
|
141
|
+
/** Whether to show distribution chart */
|
|
142
|
+
showChart?: boolean;
|
|
143
|
+
/** Whether to allow export functionality */
|
|
144
|
+
allowExport?: boolean;
|
|
145
|
+
/** Theme mode */
|
|
146
|
+
theme?: Theme;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Payment token configuration
|
|
151
|
+
*/
|
|
152
|
+
export interface PaymentToken {
|
|
153
|
+
address: string;
|
|
154
|
+
symbol: string;
|
|
155
|
+
decimals: number;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Distribution configuration
|
|
160
|
+
*/
|
|
161
|
+
export interface DistributionConfig {
|
|
162
|
+
tokenAddress: string;
|
|
163
|
+
paymentToken: string;
|
|
164
|
+
totalAmount: string;
|
|
165
|
+
snapshotDate?: Date;
|
|
166
|
+
claimWindowDays?: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Distribution preview entry
|
|
171
|
+
*/
|
|
172
|
+
export interface DistributionPreviewEntry {
|
|
173
|
+
address: string;
|
|
174
|
+
balance: bigint;
|
|
175
|
+
yieldAmount: bigint;
|
|
176
|
+
percentage: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* useRWA hook return type
|
|
181
|
+
*/
|
|
182
|
+
export interface UseRWAReturn {
|
|
183
|
+
/** Whether the SDK client is initialized */
|
|
184
|
+
isInitialized: boolean;
|
|
185
|
+
/** Current network chain ID */
|
|
186
|
+
chainId: number | undefined;
|
|
187
|
+
/** Connected wallet address */
|
|
188
|
+
address: string | undefined;
|
|
189
|
+
/** Whether wallet is connected */
|
|
190
|
+
isConnected: boolean;
|
|
191
|
+
/** Error if initialization failed */
|
|
192
|
+
error: Error | null;
|
|
193
|
+
}
|