@kimafinance/kima-transaction-widget 1.0.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/README.md +74 -0
- package/dist/assets/icons/Arrow.d.ts +8 -0
- package/dist/assets/icons/ArrowRight.d.ts +8 -0
- package/dist/assets/icons/Avalanche.d.ts +7 -0
- package/dist/assets/icons/Check.d.ts +7 -0
- package/dist/assets/icons/Cross.d.ts +8 -0
- package/dist/assets/icons/Ethereum.d.ts +7 -0
- package/dist/assets/icons/FooterLogo.d.ts +8 -0
- package/dist/assets/icons/Minimize.d.ts +8 -0
- package/dist/assets/icons/Polygon.d.ts +7 -0
- package/dist/assets/icons/Solana.d.ts +7 -0
- package/dist/assets/icons/USDC.d.ts +7 -0
- package/dist/assets/icons/USDT.d.ts +7 -0
- package/dist/assets/icons/Warning.d.ts +7 -0
- package/dist/assets/icons/index.d.ts +13 -0
- package/dist/assets/loading/180-ring.d.ts +3 -0
- package/dist/assets/loading/index.d.ts +1 -0
- package/dist/components/KimaTransactionWidget.d.ts +12 -0
- package/dist/components/TransactionWidget.d.ts +4 -0
- package/dist/components/TransferWidget.d.ts +4 -0
- package/dist/components/reusable/AddressInput.d.ts +3 -0
- package/dist/components/reusable/CoinDropdown.d.ts +3 -0
- package/dist/components/reusable/CoinSelect.d.ts +3 -0
- package/dist/components/reusable/ConfirmDetails.d.ts +3 -0
- package/dist/components/reusable/CustomCheckbox.d.ts +8 -0
- package/dist/components/reusable/Dropdown.d.ts +8 -0
- package/dist/components/reusable/ExternalLink.d.ts +9 -0
- package/dist/components/reusable/NetworkLabel.d.ts +8 -0
- package/dist/components/reusable/NetworkSelect.d.ts +6 -0
- package/dist/components/reusable/PrimaryButton.d.ts +9 -0
- package/dist/components/reusable/Progressbar.d.ts +9 -0
- package/dist/components/reusable/SecondaryButton.d.ts +9 -0
- package/dist/components/reusable/SingleForm.d.ts +3 -0
- package/dist/components/reusable/Tooltip.d.ts +8 -0
- package/dist/components/reusable/WalletButton.d.ts +5 -0
- package/dist/components/reusable/WalletConnectModal.d.ts +3 -0
- package/dist/components/reusable/WalletSelect.d.ts +3 -0
- package/dist/components/reusable/index.d.ts +13 -0
- package/dist/contexts/EthereumProviderContext.d.ts +18 -0
- package/dist/helpers/fetch-wrapper.d.ts +7 -0
- package/dist/helpers/functions.d.ts +2 -0
- package/dist/hooks/useAllowance.d.ts +4 -0
- package/dist/hooks/useIsWalletReady.d.ts +7 -0
- package/dist/hooks/useServiceFee.d.ts +3 -0
- package/dist/index.css +809 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6663 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +6226 -0
- package/dist/index.modern.js.map +1 -0
- package/dist/interface.d.ts +31 -0
- package/dist/store/index.d.ts +5 -0
- package/dist/store/optionSlice.d.ts +47 -0
- package/dist/store/selectors.d.ts +20 -0
- package/dist/styles/hooks/index.d.ts +1 -0
- package/dist/styles/hooks/useWidth.d.ts +2 -0
- package/dist/utils/config.d.ts +8 -0
- package/dist/utils/constants.d.ts +50 -0
- package/dist/utils/ethereum/common.d.ts +21 -0
- package/dist/utils/ethereum/erc20Token.d.ts +171 -0
- package/dist/utils/functions.d.ts +1 -0
- package/dist/utils/parseError.d.ts +2 -0
- package/dist/utils/solana/createAssociatedTokenAccountInstruction.d.ts +2 -0
- package/dist/utils/solana/createTransferInstruction.d.ts +39 -0
- package/dist/utils/solana/getAccountInfo.d.ts +19 -0
- package/dist/utils/solana/getAssociatedTokenAddress.d.ts +2 -0
- package/dist/utils/solana/getOrCreateAssociatedTokenAccount.d.ts +14 -0
- package/package.json +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# kima-transaction-widget
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/kima-transfer-widget) [](https://standardjs.com)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save kima-transaction-widget
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import React from 'react'
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
KimaTransactionWidget,
|
|
18
|
+
KimaProvider,
|
|
19
|
+
ThemeOptions,
|
|
20
|
+
FontSizeOptions,
|
|
21
|
+
ModeOptions
|
|
22
|
+
SupportNetworks
|
|
23
|
+
} from 'kima-transfer-widget'
|
|
24
|
+
import 'kima-transfer-widget/dist/index.css'
|
|
25
|
+
|
|
26
|
+
const App = () => {
|
|
27
|
+
return (
|
|
28
|
+
<KimaProvider>
|
|
29
|
+
<div className='container'>
|
|
30
|
+
<KimaTransactionWidget
|
|
31
|
+
theme={ThemeOptions.dark}
|
|
32
|
+
fontSize={FontSizeOptions.medium}
|
|
33
|
+
mode={ModeOptions.payment}
|
|
34
|
+
transactionOption={{
|
|
35
|
+
targetChain: SupportNetworks.Avalanche,
|
|
36
|
+
targetAddress: '0x67cc400c434F691Ed45e452dC8F2Baf0101a9B63',
|
|
37
|
+
amount: 100
|
|
38
|
+
}}
|
|
39
|
+
errorHandler={(e: any) => {
|
|
40
|
+
console.log('error:', e)
|
|
41
|
+
}}
|
|
42
|
+
successHandler={() => {
|
|
43
|
+
console.log('success')
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</KimaProvider>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default App
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Props
|
|
58
|
+
|
|
59
|
+
| Prop Name | Type | Description | Values | Default Value |
|
|
60
|
+
| ------------------------------ | ------------------ | ------------------------ | ----------------| ------------- |
|
|
61
|
+
| theme `(optional)` | ThemeOptions | color theme of widget | `light`, `dark` | `light` |
|
|
62
|
+
| fontSize `(optional)` | FontSizeOptions | font size of widget | `small`, `medium`, `large` | `medium` |
|
|
63
|
+
| mode `(required)` | ModeOptions | scenario of the widget | `payment`, `bridge` | |
|
|
64
|
+
| transactionOption `(optional)` | TransactionOption | target chain, address and currency | | |
|
|
65
|
+
| errorHandler `(optional)` | Function | callback function to handle errors | | |
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Note
|
|
69
|
+
|
|
70
|
+
[How to fix Polyfill node core module error](https://www.alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5)
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
kima-transaction-widget is licensed under MIT license.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as CrossIcon } from './Cross';
|
|
2
|
+
export { default as MinimizeIcon } from './Minimize';
|
|
3
|
+
export { default as FooterLogo } from './FooterLogo';
|
|
4
|
+
export { default as CheckIcon } from './Check';
|
|
5
|
+
export { default as WarningIcon } from './Warning';
|
|
6
|
+
export { default as ArrowRightIcon } from './ArrowRight';
|
|
7
|
+
export { default as ArrowIcon } from './Arrow';
|
|
8
|
+
export { default as EthereumIcon } from './Ethereum';
|
|
9
|
+
export { default as SolanaIcon } from './Solana';
|
|
10
|
+
export { default as PolygonIcon } from './Polygon';
|
|
11
|
+
export { default as AvalancheIcon } from './Avalanche';
|
|
12
|
+
export { default as USDCIcon } from './USDC';
|
|
13
|
+
export { default as USDTIcon } from './USDT';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Loading180Ring } from './180-ring';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DefaultProps, TransactionOption, ModeOptions } from '../interface';
|
|
3
|
+
import '../index.css';
|
|
4
|
+
interface Props extends DefaultProps {
|
|
5
|
+
transactionOption?: TransactionOption;
|
|
6
|
+
mode: ModeOptions;
|
|
7
|
+
errorHandler?: (e: any) => void;
|
|
8
|
+
closeHandler?: (e: any) => void;
|
|
9
|
+
successHandler?: (e: any) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const KimaTransactionWidget: ({ theme, fontSize, mode, transactionOption, errorHandler, closeHandler, successHandler }: Props) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
clickHandler?: any;
|
|
4
|
+
children?: any;
|
|
5
|
+
className?: string;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const PrimaryButton: ({ className, clickHandler, children, isLoading }: Props) => JSX.Element;
|
|
9
|
+
export default PrimaryButton;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
step: number;
|
|
4
|
+
focus: number;
|
|
5
|
+
setFocus: Dispatch<SetStateAction<number>>;
|
|
6
|
+
errorStep: number;
|
|
7
|
+
}
|
|
8
|
+
declare const Progressbar: ({ step, errorStep, setFocus }: Props) => JSX.Element;
|
|
9
|
+
export default Progressbar;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
clickHandler?: any;
|
|
4
|
+
children?: any;
|
|
5
|
+
className?: string;
|
|
6
|
+
theme?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const SecondaryButton: ({ className, clickHandler, children, theme }: Props) => JSX.Element;
|
|
9
|
+
export default SecondaryButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as ExternalLink } from './ExternalLink';
|
|
2
|
+
export { default as NetworkLabel } from './NetworkLabel';
|
|
3
|
+
export { default as PrimaryButton } from './PrimaryButton';
|
|
4
|
+
export { default as SecondaryButton } from './SecondaryButton';
|
|
5
|
+
export { default as NetworkSelect } from './NetworkSelect';
|
|
6
|
+
export { default as WalletSelect } from './WalletSelect';
|
|
7
|
+
export { default as Dropdown } from './Dropdown';
|
|
8
|
+
export { default as WalletButton } from './WalletButton';
|
|
9
|
+
export { default as CoinDropdown } from './CoinDropdown';
|
|
10
|
+
export { default as ConfirmDetails } from './ConfirmDetails';
|
|
11
|
+
export { default as WalletConnectModal } from './WalletConnectModal';
|
|
12
|
+
export { default as AddressInput } from './AddressInput';
|
|
13
|
+
export { default as CustomCheckbox } from './CustomCheckbox';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare type Provider = ethers.providers.Web3Provider | undefined;
|
|
4
|
+
export declare type Signer = ethers.Signer | undefined;
|
|
5
|
+
interface IEthereumProviderContext {
|
|
6
|
+
connect(): void;
|
|
7
|
+
disconnect(): void;
|
|
8
|
+
provider: Provider;
|
|
9
|
+
chainId: number | undefined;
|
|
10
|
+
signer: Signer;
|
|
11
|
+
signerAddress: string | undefined;
|
|
12
|
+
providerError: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const EthereumProvider: ({ children }: {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}) => JSX.Element;
|
|
17
|
+
export declare const useEthereumProvider: () => IEthereumProviderContext;
|
|
18
|
+
export {};
|