@edgex-web/components 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +325 -0
- package/dist/components/Deposit/index.d.ts +13 -0
- package/dist/components/Deposit/index.d.ts.map +1 -0
- package/dist/components/Deposit/src/ChainSelector.d.ts +35 -0
- package/dist/components/Deposit/src/ChainSelector.d.ts.map +1 -0
- package/dist/components/Deposit/src/ChainTokenSelector.d.ts +25 -0
- package/dist/components/Deposit/src/ChainTokenSelector.d.ts.map +1 -0
- package/dist/components/Deposit/src/Deposit.d.ts +17 -0
- package/dist/components/Deposit/src/Deposit.d.ts.map +1 -0
- package/dist/components/Deposit/src/DepositManager.d.ts +10 -0
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -0
- package/dist/components/Deposit/src/EVMWalletView.d.ts +18 -0
- package/dist/components/Deposit/src/EVMWalletView.d.ts.map +1 -0
- package/dist/components/Deposit/src/MPCWalletView.d.ts +14 -0
- package/dist/components/Deposit/src/MPCWalletView.d.ts.map +1 -0
- package/dist/components/Deposit/src/WalletProvider.d.ts +23 -0
- package/dist/components/Deposit/src/WalletProvider.d.ts.map +1 -0
- package/dist/components/Deposit/src/components.d.ts +89 -0
- package/dist/components/Deposit/src/components.d.ts.map +1 -0
- package/dist/components/Deposit/src/index.d.ts +5 -0
- package/dist/components/Deposit/src/index.d.ts.map +1 -0
- package/dist/components/Deposit/src/utils.d.ts +45 -0
- package/dist/components/Deposit/src/utils.d.ts.map +1 -0
- package/dist/components/Deposit/src/walletAdapters.d.ts +67 -0
- package/dist/components/Deposit/src/walletAdapters.d.ts.map +1 -0
- package/dist/components/Deposit/types/index.d.ts +90 -0
- package/dist/components/Deposit/types/index.d.ts.map +1 -0
- package/dist/components/Deposit/types/wallet-hooks.d.ts +78 -0
- package/dist/components/Deposit/types/wallet-hooks.d.ts.map +1 -0
- package/dist/components/Provider/index.d.ts +11 -0
- package/dist/components/Provider/index.d.ts.map +1 -0
- package/dist/components/Withdraw/index.d.ts +11 -0
- package/dist/components/Withdraw/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +7259 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +123 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/types/index.d.ts +114 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +98 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export interface ComponentConfig {
|
|
2
|
+
theme?: 'light' | 'dark';
|
|
3
|
+
locale?: string;
|
|
4
|
+
apiBaseUrl?: string;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DepositConfig {
|
|
8
|
+
symbol: string;
|
|
9
|
+
onSuccess?: (result: DepositResult) => void;
|
|
10
|
+
onError?: (error: Error) => void;
|
|
11
|
+
onCancel?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface WithdrawConfig {
|
|
14
|
+
symbol: string;
|
|
15
|
+
onSuccess?: (result: WithdrawResult) => void;
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
onCancel?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface DepositResult {
|
|
20
|
+
transactionId: string;
|
|
21
|
+
amount: string;
|
|
22
|
+
symbol: string;
|
|
23
|
+
status: 'pending' | 'completed' | 'failed';
|
|
24
|
+
}
|
|
25
|
+
export interface WithdrawResult {
|
|
26
|
+
transactionId: string;
|
|
27
|
+
amount: string;
|
|
28
|
+
symbol: string;
|
|
29
|
+
status: 'pending' | 'completed' | 'failed';
|
|
30
|
+
}
|
|
31
|
+
export interface EventCallbacks {
|
|
32
|
+
onSuccess?: (result: DepositResult | WithdrawResult) => void;
|
|
33
|
+
onError?: (error: Error) => void;
|
|
34
|
+
onCancel?: () => void;
|
|
35
|
+
}
|
|
36
|
+
export interface GlobalEventData {
|
|
37
|
+
type: 'deposit' | 'withdraw';
|
|
38
|
+
config: DepositConfig | WithdrawConfig;
|
|
39
|
+
}
|
|
40
|
+
export interface EventEmitter {
|
|
41
|
+
emit: (event: string, data: GlobalEventData) => void;
|
|
42
|
+
on: (event: string, callback: (data: GlobalEventData) => void) => void;
|
|
43
|
+
off: (event: string, callback: (data: GlobalEventData) => void) => void;
|
|
44
|
+
}
|
|
45
|
+
export type WalletType = 'mpc' | 'evm';
|
|
46
|
+
export interface BaseWallet {
|
|
47
|
+
type: WalletType;
|
|
48
|
+
address: string;
|
|
49
|
+
isConnected: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface MPCWallet extends BaseWallet {
|
|
52
|
+
type: 'mpc';
|
|
53
|
+
smartWalletAddress: string;
|
|
54
|
+
aaWalletAddress: string;
|
|
55
|
+
}
|
|
56
|
+
export interface EVMWallet extends BaseWallet {
|
|
57
|
+
type: 'evm';
|
|
58
|
+
chainId: number;
|
|
59
|
+
balance: string;
|
|
60
|
+
allowance: string;
|
|
61
|
+
isApproved: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface TokenInfo {
|
|
64
|
+
token: string;
|
|
65
|
+
symbol: string;
|
|
66
|
+
decimals: number;
|
|
67
|
+
iconUrl: string;
|
|
68
|
+
tokenAddress: string;
|
|
69
|
+
balance?: {
|
|
70
|
+
formatted: string;
|
|
71
|
+
raw: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface ChainInfo {
|
|
75
|
+
chainId: number;
|
|
76
|
+
chain: string;
|
|
77
|
+
chainIconUrl: string;
|
|
78
|
+
blockTime: number;
|
|
79
|
+
txConfirm: number;
|
|
80
|
+
allowDeposit: boolean;
|
|
81
|
+
tokenList: TokenInfo[];
|
|
82
|
+
}
|
|
83
|
+
export interface ChainWithTokens {
|
|
84
|
+
chainId: number;
|
|
85
|
+
chain: string;
|
|
86
|
+
chainIconUrl: string;
|
|
87
|
+
blockTime: number;
|
|
88
|
+
txConfirm: number;
|
|
89
|
+
allowDeposit: boolean;
|
|
90
|
+
tokenList: TokenInfo[];
|
|
91
|
+
}
|
|
92
|
+
export interface WalletOperations {
|
|
93
|
+
connect(): Promise<void>;
|
|
94
|
+
disconnect(): Promise<void>;
|
|
95
|
+
switchChain(chainId: number): Promise<void>;
|
|
96
|
+
getBalance(tokenAddress?: string): Promise<string>;
|
|
97
|
+
approve(tokenAddress: string, amount: string): Promise<string>;
|
|
98
|
+
deposit(amount: string, tokenAddress: string): Promise<string>;
|
|
99
|
+
signMessage(message: string): Promise<string>;
|
|
100
|
+
}
|
|
101
|
+
export interface DepositState {
|
|
102
|
+
isLoading: boolean;
|
|
103
|
+
isApproving: boolean;
|
|
104
|
+
isDepositing: boolean;
|
|
105
|
+
error: string | null;
|
|
106
|
+
txHash: string | null;
|
|
107
|
+
}
|
|
108
|
+
export interface DepositFormData {
|
|
109
|
+
amount: string;
|
|
110
|
+
selectedToken: string;
|
|
111
|
+
selectedChain: number;
|
|
112
|
+
slippage: number;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,SA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3
|
+
"version": "0.1.0-beta.1",
|
|
4
|
+
"description": "EdgeX Universal UI Components Library - Reusable React components for deposit, withdraw and other common UI patterns",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org/"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"build": "tsc && vite build",
|
|
20
|
+
"build:css": "tailwindcss -c tailwind.config.cjs -i ./src/styles/tailwind.css -o ./dist/styles.css --minify",
|
|
21
|
+
"build:watch": "vite build --watch",
|
|
22
|
+
"test": "vitest",
|
|
23
|
+
"test:ui": "vitest --ui",
|
|
24
|
+
"test:coverage": "vitest --coverage",
|
|
25
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
26
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
27
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,json,css,md}\"",
|
|
28
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,css,md}\"",
|
|
29
|
+
"type-check": "tsc --noEmit",
|
|
30
|
+
"prepare": "husky install",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"react",
|
|
35
|
+
"components",
|
|
36
|
+
"ui",
|
|
37
|
+
"edgex",
|
|
38
|
+
"deposit",
|
|
39
|
+
"withdraw",
|
|
40
|
+
"typescript"
|
|
41
|
+
],
|
|
42
|
+
"author": "kyle",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/edgex-tech/edgex-components.git"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": ">=16.8.0",
|
|
50
|
+
"react-dom": ">=16.8.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@testing-library/jest-dom": "^6.1.5",
|
|
54
|
+
"@testing-library/react": "^14.1.2",
|
|
55
|
+
"@testing-library/user-event": "^14.5.1",
|
|
56
|
+
"@types/react": "^18.2.43",
|
|
57
|
+
"@types/react-dom": "^18.2.17",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
59
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
60
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
61
|
+
"@vitest/coverage-v8": "^1.0.4",
|
|
62
|
+
"@vitest/ui": "^1.0.4",
|
|
63
|
+
"autoprefixer": "^10.4.21",
|
|
64
|
+
"eslint": "^8.55.0",
|
|
65
|
+
"eslint-config-prettier": "^9.1.0",
|
|
66
|
+
"eslint-plugin-react": "^7.33.2",
|
|
67
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
68
|
+
"husky": "^8.0.3",
|
|
69
|
+
"jsdom": "^23.0.1",
|
|
70
|
+
"lint-staged": "^15.2.0",
|
|
71
|
+
"postcss": "^8.5.6",
|
|
72
|
+
"postcss-cli": "^11.0.1",
|
|
73
|
+
"prettier": "^3.1.1",
|
|
74
|
+
"react": "^18.2.0",
|
|
75
|
+
"react-dom": "^18.2.0",
|
|
76
|
+
"tailwindcss": "^3.4.17",
|
|
77
|
+
"typescript": "^5.3.3",
|
|
78
|
+
"vite": "^5.0.8",
|
|
79
|
+
"vite-plugin-dts": "^3.6.4",
|
|
80
|
+
"vitest": "^1.0.4"
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@headlessui/react": "^2.2.7",
|
|
84
|
+
"@heroicons/react": "^2.2.0",
|
|
85
|
+
"clsx": "^2.0.0",
|
|
86
|
+
"lucide-react": "^0.540.0",
|
|
87
|
+
"qrcode.react": "^4.2.0"
|
|
88
|
+
},
|
|
89
|
+
"lint-staged": {
|
|
90
|
+
"*.{ts,tsx}": [
|
|
91
|
+
"eslint --fix",
|
|
92
|
+
"prettier --write"
|
|
93
|
+
],
|
|
94
|
+
"*.{json,css,md}": [
|
|
95
|
+
"prettier --write"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
}
|