@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare enum SupportNetworks {
|
|
2
|
+
Ethereum = "Ethereum",
|
|
3
|
+
Polygon = "Polygon",
|
|
4
|
+
Avalanche = "Avalanche",
|
|
5
|
+
Solana = "Solana"
|
|
6
|
+
}
|
|
7
|
+
export declare enum FontSizeOptions {
|
|
8
|
+
large = "large",
|
|
9
|
+
medium = "medium",
|
|
10
|
+
small = "small"
|
|
11
|
+
}
|
|
12
|
+
export declare enum ModeOptions {
|
|
13
|
+
payment = "payment",
|
|
14
|
+
bridge = "bridge"
|
|
15
|
+
}
|
|
16
|
+
export declare enum CurrencyOptions {
|
|
17
|
+
USDK = "USDK"
|
|
18
|
+
}
|
|
19
|
+
export declare enum ThemeOptions {
|
|
20
|
+
light = "light",
|
|
21
|
+
dark = "dark"
|
|
22
|
+
}
|
|
23
|
+
export interface TransactionOption {
|
|
24
|
+
targetChain: SupportNetworks;
|
|
25
|
+
targetAddress: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
}
|
|
28
|
+
export interface DefaultProps {
|
|
29
|
+
theme?: ThemeOptions;
|
|
30
|
+
fontSize?: FontSizeOptions;
|
|
31
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<{
|
|
2
|
+
option: import("./optionSlice").OptionState;
|
|
3
|
+
}, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<any>>;
|
|
4
|
+
export declare type RootState = ReturnType<typeof store.getState>;
|
|
5
|
+
export declare type AppDispatch = typeof store.dispatch;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { ModeOptions, ThemeOptions, TransactionOption } from '../interface';
|
|
3
|
+
export interface OptionState {
|
|
4
|
+
theme: ThemeOptions;
|
|
5
|
+
mode: ModeOptions;
|
|
6
|
+
originNetwork: string;
|
|
7
|
+
targetNetwork: string;
|
|
8
|
+
targetAddress: string;
|
|
9
|
+
connectModal: boolean;
|
|
10
|
+
solanaProvider: any;
|
|
11
|
+
submitted: boolean;
|
|
12
|
+
amount: number;
|
|
13
|
+
isApproving: boolean;
|
|
14
|
+
isSubmitting: boolean;
|
|
15
|
+
isConfirming: boolean;
|
|
16
|
+
feeDeduct: boolean;
|
|
17
|
+
splAllowance: number;
|
|
18
|
+
transactionOption?: TransactionOption;
|
|
19
|
+
errorHandler: Function;
|
|
20
|
+
closeHandler: Function;
|
|
21
|
+
successHandler: Function;
|
|
22
|
+
serviceFee: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const optionSlice: import("@reduxjs/toolkit").Slice<OptionState, {
|
|
25
|
+
setTheme: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<ThemeOptions>) => void;
|
|
26
|
+
setOriginNetwork: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<string>) => void;
|
|
27
|
+
setTargetNetwork: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<string>) => void;
|
|
28
|
+
setTargetAddress: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<string>) => void;
|
|
29
|
+
setConnectModal: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<boolean>) => void;
|
|
30
|
+
setSolanaProvider: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<any>) => void;
|
|
31
|
+
setSubmitted: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<boolean>) => void;
|
|
32
|
+
setTransactionOption: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<TransactionOption>) => void;
|
|
33
|
+
setAmount: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<number>) => void;
|
|
34
|
+
setApproving: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<boolean>) => void;
|
|
35
|
+
setSubmitting: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<boolean>) => void;
|
|
36
|
+
setSplAllowance: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<number>) => void;
|
|
37
|
+
setErrorHandler: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<Function>) => void;
|
|
38
|
+
setCloseHandler: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<Function>) => void;
|
|
39
|
+
setSuccessHandler: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<Function>) => void;
|
|
40
|
+
setServiceFee: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<number>) => void;
|
|
41
|
+
setMode: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<ModeOptions>) => void;
|
|
42
|
+
setConfirming: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<boolean>) => void;
|
|
43
|
+
setFeeDeduct: (state: import("immer/dist/internal").WritableDraft<OptionState>, action: PayloadAction<boolean>) => void;
|
|
44
|
+
}, "option">;
|
|
45
|
+
export declare const setTheme: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeOptions, any>, setOriginNetwork: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, any>, setTargetNetwork: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, any>, setTargetAddress: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, any>, setConnectModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, any>, setSolanaProvider: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, any>, setSubmitted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, any>, setTransactionOption: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransactionOption, any>, setAmount: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, any>, setApproving: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, any>, setSubmitting: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, any>, setConfirming: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, any>, setSplAllowance: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, any>, setErrorHandler: import("@reduxjs/toolkit").ActionCreatorWithPayload<Function, any>, setCloseHandler: import("@reduxjs/toolkit").ActionCreatorWithPayload<Function, any>, setSuccessHandler: import("@reduxjs/toolkit").ActionCreatorWithPayload<Function, any>, setServiceFee: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, any>, setMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<ModeOptions, any>, setFeeDeduct: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, any>;
|
|
46
|
+
declare const _default: import("redux").Reducer<OptionState, import("redux").AnyAction>;
|
|
47
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RootState } from '.';
|
|
2
|
+
export declare const selectTheme: (state: RootState) => import("..").ThemeOptions;
|
|
3
|
+
export declare const selectOriginNetwork: (state: RootState) => string;
|
|
4
|
+
export declare const selectTargetNetwork: (state: RootState) => string;
|
|
5
|
+
export declare const selectTargetAddress: (state: RootState) => string;
|
|
6
|
+
export declare const selectConnectModal: (state: RootState) => boolean;
|
|
7
|
+
export declare const selectSolanaProvider: (state: RootState) => any;
|
|
8
|
+
export declare const selectSubmitted: (state: RootState) => boolean;
|
|
9
|
+
export declare const selectTransactionOption: (state: RootState) => import("../interface").TransactionOption | undefined;
|
|
10
|
+
export declare const selectAmount: (state: RootState) => number;
|
|
11
|
+
export declare const selectApproving: (state: RootState) => boolean;
|
|
12
|
+
export declare const selectSubmitting: (state: RootState) => boolean;
|
|
13
|
+
export declare const selectSplAllowance: (state: RootState) => number;
|
|
14
|
+
export declare const selectErrorHandler: (state: RootState) => Function;
|
|
15
|
+
export declare const selectCloseHandler: (state: RootState) => Function;
|
|
16
|
+
export declare const selectSuccessHandler: (state: RootState) => Function;
|
|
17
|
+
export declare const selectServiceFee: (state: RootState) => number;
|
|
18
|
+
export declare const selectMode: (state: RootState) => import("..").ModeOptions;
|
|
19
|
+
export declare const selectConfirming: (state: RootState) => boolean;
|
|
20
|
+
export declare const selectFeeDeduct: (state: RootState) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useWidth } from './useWidth';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ETHEREUM_POOL_ADDRESS = "0x369b28f227C0188478cb05F8467bdd52002EcC4E";
|
|
2
|
+
export declare const POLYGON_POOL_ADDRESS = "0x369b28f227C0188478cb05F8467bdd52002EcC4E";
|
|
3
|
+
export declare const AVAX_POOL_ADDRESS = "0x369b28f227C0188478cb05F8467bdd52002EcC4E";
|
|
4
|
+
export declare const SOLANA_POOL_ADDRESS = "DRmLANN1qXBELs69gW5upY4qH4iWc23MTcRPjDuzZYuH";
|
|
5
|
+
export declare const SOLANA_USDK_ADDRESS = "GkbnUDkymDTF4U6Z5wM5kKJn3GmGndMn2rN5typmyUHY";
|
|
6
|
+
export declare const ETHEREUM_USDK_ADDRESS = "0x8BAd07F2445D6390DD94Eca08882b7d515EAbe6C";
|
|
7
|
+
export declare const POLYGON_USDK_ADDRESS = "0x5bd4865a6dEd507dA08ed1aBE3cd971a7e0405D7";
|
|
8
|
+
export declare const AVAX_USDK_ADDRESS = "0x7C043d4D2b505740742dF6Fdb79C5caEe08728a5";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const networkOptions: {
|
|
3
|
+
id: string;
|
|
4
|
+
icon: ({ width, height, ...rest }: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
width?: number | undefined;
|
|
7
|
+
height?: number | undefined;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const getNetworkOption: (id: string) => {
|
|
11
|
+
id: string;
|
|
12
|
+
icon: ({ width, height, ...rest }: {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
width?: number | undefined;
|
|
15
|
+
height?: number | undefined;
|
|
16
|
+
}) => JSX.Element;
|
|
17
|
+
} | undefined;
|
|
18
|
+
export declare type Cluster = 'devnet' | 'testnet' | 'mainnet';
|
|
19
|
+
export declare const CLUSTER: Cluster;
|
|
20
|
+
export declare const SOLANA_HOST: string;
|
|
21
|
+
export declare const CHAIN_STRING_SOLANA = "Solana";
|
|
22
|
+
export declare const CHAIN_STRING_ETHEREUM = "Ethereum";
|
|
23
|
+
export declare const CHAIN_STRING_POLYGON = "Polygon";
|
|
24
|
+
export declare const CHAIN_STRING_AVALANCHE = "Avalanche";
|
|
25
|
+
export declare const getEvmChainId: (chainId: string) => 5 | 80001 | 43113 | undefined;
|
|
26
|
+
export declare const getEvmChainString: (chainId: number) => "Ethereum" | "Polygon" | "Avalanche" | "Unknown";
|
|
27
|
+
export declare const getPoolAddress: (chainId: string) => "0x369b28f227C0188478cb05F8467bdd52002EcC4E" | "DRmLANN1qXBELs69gW5upY4qH4iWc23MTcRPjDuzZYuH" | undefined;
|
|
28
|
+
export declare const isEVMChain: (chainId: string) => boolean;
|
|
29
|
+
export declare const GOERLI_ETH_NETWORK_CHAIN_ID = 5;
|
|
30
|
+
export declare const POLYGON_NETWORK_CHAIN_ID = 80001;
|
|
31
|
+
export declare const AVAX_NETWORK_CHAIN_ID = 43113;
|
|
32
|
+
declare type coinOptions = {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
export declare const COIN_LIST: coinOptions;
|
|
36
|
+
export declare const FEE_PERCENT = 0.005;
|
|
37
|
+
export declare const PAY_AVAILABLE = "Available";
|
|
38
|
+
export declare const PAY_CONFIRMED = "Confirmed";
|
|
39
|
+
export declare const PAY_PAID = "Paid";
|
|
40
|
+
export declare const PAY_FAILED = "FailedToPay";
|
|
41
|
+
export declare const PAY_UNAVAILABLE = "UnAvailable";
|
|
42
|
+
export declare const PAY_KEYSIGNED = "KeySigned";
|
|
43
|
+
export declare const tooltipInfo: string[][];
|
|
44
|
+
export declare const ETH_USD_PROXY = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
45
|
+
export declare const AVAX_USD_PROXY = "0xFF3EEb22B5E3dE6e705b44749C2559d704923FD7";
|
|
46
|
+
export declare const MATIC_USD_PROXY = "0x7bAC85A8a13A4BcD8abb3eB7d6b4d632c5a57676";
|
|
47
|
+
export declare const SOL_USD_PROXY = "0x4ffC43a60e009B551865A93d232E33Fce9f01507";
|
|
48
|
+
export declare const ETHEREUM_NODE_PROVIDER = "https://eth-mainnet.g.alchemy.com/v2/KuGxhvDhFDX-r40tmVfgopWs0KdcjHPI";
|
|
49
|
+
export declare const DIVERSIFI_NODE_PROVIDER1_QUERY = "api.testnode1.kima.finance";
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Listener } from "@ethersproject/providers";
|
|
2
|
+
import type { Event, EventFilter } from "ethers";
|
|
3
|
+
export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
|
|
4
|
+
args: TArgsArray & TArgsObject;
|
|
5
|
+
}
|
|
6
|
+
export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {
|
|
7
|
+
}
|
|
8
|
+
export interface TypedListener<TEvent extends TypedEvent> {
|
|
9
|
+
(...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
|
|
10
|
+
}
|
|
11
|
+
declare type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never;
|
|
12
|
+
export interface OnEvent<TRes> {
|
|
13
|
+
<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>, listener: TypedListener<TEvent>): TRes;
|
|
14
|
+
(eventName: string, listener: Listener): TRes;
|
|
15
|
+
}
|
|
16
|
+
export declare type MinEthersFactory<C, ARGS> = {
|
|
17
|
+
deploy(...a: ARGS[]): Promise<C>;
|
|
18
|
+
};
|
|
19
|
+
export declare type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
|
|
20
|
+
export declare type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : never;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers";
|
|
2
|
+
import { FunctionFragment, Result, EventFragment } from "@ethersproject/abi";
|
|
3
|
+
import { Listener, Provider } from "@ethersproject/providers";
|
|
4
|
+
import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common";
|
|
5
|
+
export interface StandardTokenInterface extends utils.Interface {
|
|
6
|
+
functions: {
|
|
7
|
+
"allowance(address,address)": FunctionFragment;
|
|
8
|
+
"allowed(address,address)": FunctionFragment;
|
|
9
|
+
"approve(address,uint256)": FunctionFragment;
|
|
10
|
+
"balanceOf(address)": FunctionFragment;
|
|
11
|
+
"balances(address)": FunctionFragment;
|
|
12
|
+
"decimals()": FunctionFragment;
|
|
13
|
+
"name()": FunctionFragment;
|
|
14
|
+
"symbol()": FunctionFragment;
|
|
15
|
+
"totalSupply()": FunctionFragment;
|
|
16
|
+
"transfer(address,uint256)": FunctionFragment;
|
|
17
|
+
"transferFrom(address,address,uint256)": FunctionFragment;
|
|
18
|
+
};
|
|
19
|
+
encodeFunctionData(functionFragment: "allowance", values: [string, string]): string;
|
|
20
|
+
encodeFunctionData(functionFragment: "allowed", values: [string, string]): string;
|
|
21
|
+
encodeFunctionData(functionFragment: "approve", values: [string, BigNumberish]): string;
|
|
22
|
+
encodeFunctionData(functionFragment: "balanceOf", values: [string]): string;
|
|
23
|
+
encodeFunctionData(functionFragment: "balances", values: [string]): string;
|
|
24
|
+
encodeFunctionData(functionFragment: "decimals", values?: undefined): string;
|
|
25
|
+
encodeFunctionData(functionFragment: "name", values?: undefined): string;
|
|
26
|
+
encodeFunctionData(functionFragment: "symbol", values?: undefined): string;
|
|
27
|
+
encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string;
|
|
28
|
+
encodeFunctionData(functionFragment: "transfer", values: [string, BigNumberish]): string;
|
|
29
|
+
encodeFunctionData(functionFragment: "transferFrom", values: [string, string, BigNumberish]): string;
|
|
30
|
+
decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result;
|
|
31
|
+
decodeFunctionResult(functionFragment: "allowed", data: BytesLike): Result;
|
|
32
|
+
decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result;
|
|
33
|
+
decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result;
|
|
34
|
+
decodeFunctionResult(functionFragment: "balances", data: BytesLike): Result;
|
|
35
|
+
decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result;
|
|
36
|
+
decodeFunctionResult(functionFragment: "name", data: BytesLike): Result;
|
|
37
|
+
decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result;
|
|
38
|
+
decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result;
|
|
39
|
+
decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result;
|
|
40
|
+
decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result;
|
|
41
|
+
events: {
|
|
42
|
+
"Approval(address,address,uint256)": EventFragment;
|
|
43
|
+
"Transfer(address,address,uint256)": EventFragment;
|
|
44
|
+
};
|
|
45
|
+
getEvent(nameOrSignatureOrTopic: "Approval"): EventFragment;
|
|
46
|
+
getEvent(nameOrSignatureOrTopic: "Transfer"): EventFragment;
|
|
47
|
+
}
|
|
48
|
+
export declare type ApprovalEvent = TypedEvent<[string, string, BigNumber], {
|
|
49
|
+
_owner: string;
|
|
50
|
+
_spender: string;
|
|
51
|
+
_value: BigNumber;
|
|
52
|
+
}>;
|
|
53
|
+
export declare type ApprovalEventFilter = TypedEventFilter<ApprovalEvent>;
|
|
54
|
+
export declare type TransferEvent = TypedEvent<[string, string, BigNumber], {
|
|
55
|
+
_from: string;
|
|
56
|
+
_to: string;
|
|
57
|
+
_value: BigNumber;
|
|
58
|
+
}>;
|
|
59
|
+
export declare type TransferEventFilter = TypedEventFilter<TransferEvent>;
|
|
60
|
+
export interface StandardToken extends BaseContract {
|
|
61
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
62
|
+
attach(addressOrName: string): this;
|
|
63
|
+
deployed(): Promise<this>;
|
|
64
|
+
interface: StandardTokenInterface;
|
|
65
|
+
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
66
|
+
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
67
|
+
listeners(eventName?: string): Array<Listener>;
|
|
68
|
+
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
|
|
69
|
+
removeAllListeners(eventName?: string): this;
|
|
70
|
+
off: OnEvent<this>;
|
|
71
|
+
on: OnEvent<this>;
|
|
72
|
+
once: OnEvent<this>;
|
|
73
|
+
removeListener: OnEvent<this>;
|
|
74
|
+
functions: {
|
|
75
|
+
allowance(_owner: string, _spender: string, overrides?: CallOverrides): Promise<[BigNumber] & {
|
|
76
|
+
remaining: BigNumber;
|
|
77
|
+
}>;
|
|
78
|
+
allowed(arg0: string, arg1: string, overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
79
|
+
approve(_spender: string, _value: BigNumberish, overrides?: Overrides & {
|
|
80
|
+
from?: string | Promise<string>;
|
|
81
|
+
}): Promise<ContractTransaction>;
|
|
82
|
+
balanceOf(_owner: string, overrides?: CallOverrides): Promise<[BigNumber] & {
|
|
83
|
+
balance: BigNumber;
|
|
84
|
+
}>;
|
|
85
|
+
balances(arg0: string, overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
86
|
+
decimals(overrides?: CallOverrides): Promise<[number]>;
|
|
87
|
+
name(overrides?: CallOverrides): Promise<[string]>;
|
|
88
|
+
symbol(overrides?: CallOverrides): Promise<[string]>;
|
|
89
|
+
totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
90
|
+
transfer(_to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
91
|
+
from?: string | Promise<string>;
|
|
92
|
+
}): Promise<ContractTransaction>;
|
|
93
|
+
transferFrom(_from: string, _to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
94
|
+
from?: string | Promise<string>;
|
|
95
|
+
}): Promise<ContractTransaction>;
|
|
96
|
+
};
|
|
97
|
+
allowance(_owner: string, _spender: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
98
|
+
allowed(arg0: string, arg1: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
99
|
+
approve(_spender: string, _value: BigNumberish, overrides?: Overrides & {
|
|
100
|
+
from?: string | Promise<string>;
|
|
101
|
+
}): Promise<ContractTransaction>;
|
|
102
|
+
balanceOf(_owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
103
|
+
balances(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
104
|
+
decimals(overrides?: CallOverrides): Promise<number>;
|
|
105
|
+
name(overrides?: CallOverrides): Promise<string>;
|
|
106
|
+
symbol(overrides?: CallOverrides): Promise<string>;
|
|
107
|
+
totalSupply(overrides?: CallOverrides): Promise<BigNumber>;
|
|
108
|
+
transfer(_to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
109
|
+
from?: string | Promise<string>;
|
|
110
|
+
}): Promise<ContractTransaction>;
|
|
111
|
+
transferFrom(_from: string, _to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
112
|
+
from?: string | Promise<string>;
|
|
113
|
+
}): Promise<ContractTransaction>;
|
|
114
|
+
callStatic: {
|
|
115
|
+
allowance(_owner: string, _spender: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
116
|
+
allowed(arg0: string, arg1: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
117
|
+
approve(_spender: string, _value: BigNumberish, overrides?: CallOverrides): Promise<boolean>;
|
|
118
|
+
balanceOf(_owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
119
|
+
balances(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
120
|
+
decimals(overrides?: CallOverrides): Promise<number>;
|
|
121
|
+
name(overrides?: CallOverrides): Promise<string>;
|
|
122
|
+
symbol(overrides?: CallOverrides): Promise<string>;
|
|
123
|
+
totalSupply(overrides?: CallOverrides): Promise<BigNumber>;
|
|
124
|
+
transfer(_to: string, _value: BigNumberish, overrides?: CallOverrides): Promise<boolean>;
|
|
125
|
+
transferFrom(_from: string, _to: string, _value: BigNumberish, overrides?: CallOverrides): Promise<boolean>;
|
|
126
|
+
};
|
|
127
|
+
filters: {
|
|
128
|
+
"Approval(address,address,uint256)"(_owner?: string | null, _spender?: string | null, _value?: null): ApprovalEventFilter;
|
|
129
|
+
Approval(_owner?: string | null, _spender?: string | null, _value?: null): ApprovalEventFilter;
|
|
130
|
+
"Transfer(address,address,uint256)"(_from?: string | null, _to?: string | null, _value?: null): TransferEventFilter;
|
|
131
|
+
Transfer(_from?: string | null, _to?: string | null, _value?: null): TransferEventFilter;
|
|
132
|
+
};
|
|
133
|
+
estimateGas: {
|
|
134
|
+
allowance(_owner: string, _spender: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
135
|
+
allowed(arg0: string, arg1: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
136
|
+
approve(_spender: string, _value: BigNumberish, overrides?: Overrides & {
|
|
137
|
+
from?: string | Promise<string>;
|
|
138
|
+
}): Promise<BigNumber>;
|
|
139
|
+
balanceOf(_owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
140
|
+
balances(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
141
|
+
decimals(overrides?: CallOverrides): Promise<BigNumber>;
|
|
142
|
+
name(overrides?: CallOverrides): Promise<BigNumber>;
|
|
143
|
+
symbol(overrides?: CallOverrides): Promise<BigNumber>;
|
|
144
|
+
totalSupply(overrides?: CallOverrides): Promise<BigNumber>;
|
|
145
|
+
transfer(_to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
146
|
+
from?: string | Promise<string>;
|
|
147
|
+
}): Promise<BigNumber>;
|
|
148
|
+
transferFrom(_from: string, _to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
149
|
+
from?: string | Promise<string>;
|
|
150
|
+
}): Promise<BigNumber>;
|
|
151
|
+
};
|
|
152
|
+
populateTransaction: {
|
|
153
|
+
allowance(_owner: string, _spender: string, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
154
|
+
allowed(arg0: string, arg1: string, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
155
|
+
approve(_spender: string, _value: BigNumberish, overrides?: Overrides & {
|
|
156
|
+
from?: string | Promise<string>;
|
|
157
|
+
}): Promise<PopulatedTransaction>;
|
|
158
|
+
balanceOf(_owner: string, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
159
|
+
balances(arg0: string, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
160
|
+
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
161
|
+
name(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
162
|
+
symbol(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
163
|
+
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
164
|
+
transfer(_to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
165
|
+
from?: string | Promise<string>;
|
|
166
|
+
}): Promise<PopulatedTransaction>;
|
|
167
|
+
transferFrom(_from: string, _to: string, _value: BigNumberish, overrides?: Overrides & {
|
|
168
|
+
from?: string | Promise<string>;
|
|
169
|
+
}): Promise<PopulatedTransaction>;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getShortenedAddress: (address: string) => string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
+
export declare function createAssociatedTokenAccountInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
+
export declare enum TokenInstruction {
|
|
3
|
+
InitializeMint = 0,
|
|
4
|
+
InitializeAccount = 1,
|
|
5
|
+
InitializeMultisig = 2,
|
|
6
|
+
Transfer = 3,
|
|
7
|
+
Approve = 4,
|
|
8
|
+
Revoke = 5,
|
|
9
|
+
SetAuthority = 6,
|
|
10
|
+
MintTo = 7,
|
|
11
|
+
Burn = 8,
|
|
12
|
+
CloseAccount = 9,
|
|
13
|
+
FreezeAccount = 10,
|
|
14
|
+
ThawAccount = 11,
|
|
15
|
+
TransferChecked = 12,
|
|
16
|
+
ApproveChecked = 13,
|
|
17
|
+
MintToChecked = 14,
|
|
18
|
+
BurnChecked = 15,
|
|
19
|
+
InitializeAccount2 = 16,
|
|
20
|
+
SyncNative = 17,
|
|
21
|
+
InitializeAccount3 = 18,
|
|
22
|
+
InitializeMultisig2 = 19,
|
|
23
|
+
InitializeMint2 = 20
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Construct a Transfer instruction
|
|
27
|
+
*
|
|
28
|
+
* @param source Source account
|
|
29
|
+
* @param destination Destination account
|
|
30
|
+
* @param owner Owner of the source account
|
|
31
|
+
* @param amount Number of tokens to transfer
|
|
32
|
+
* @param multiSigners Signing accounts if `owner` is a multisig
|
|
33
|
+
* @param programId SPL Token program account
|
|
34
|
+
*
|
|
35
|
+
* @return Instruction to add to a transaction
|
|
36
|
+
*/
|
|
37
|
+
export declare function createTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
|
|
38
|
+
export declare function createApproveTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
|
|
39
|
+
export declare function addSigners(keys: AccountMeta[], ownerOrAuthority: PublicKey, multiSigners: Signer[]): AccountMeta[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Connection, PublicKey, Commitment } from '@solana/web3.js';
|
|
2
|
+
export declare enum AccountState {
|
|
3
|
+
Uninitialized = 0,
|
|
4
|
+
Initialized = 1,
|
|
5
|
+
Frozen = 2
|
|
6
|
+
}
|
|
7
|
+
export declare function getAccountInfo(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<{
|
|
8
|
+
address: PublicKey;
|
|
9
|
+
mint: PublicKey;
|
|
10
|
+
owner: PublicKey;
|
|
11
|
+
amount: bigint;
|
|
12
|
+
delegate: PublicKey | null;
|
|
13
|
+
delegatedAmount: bigint;
|
|
14
|
+
isInitialized: boolean;
|
|
15
|
+
isFrozen: boolean;
|
|
16
|
+
isNative: boolean;
|
|
17
|
+
rentExemptReserve: bigint | null;
|
|
18
|
+
closeAuthority: PublicKey | null;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Connection, PublicKey, Commitment } from '@solana/web3.js';
|
|
2
|
+
export declare function getOrCreateAssociatedTokenAccount(connection: Connection, payer: PublicKey, mint: PublicKey, owner: PublicKey, signTransaction: any, allowOwnerOffCurve?: boolean, commitment?: Commitment, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<{
|
|
3
|
+
address: PublicKey;
|
|
4
|
+
mint: PublicKey;
|
|
5
|
+
owner: PublicKey;
|
|
6
|
+
amount: bigint;
|
|
7
|
+
delegate: PublicKey | null;
|
|
8
|
+
delegatedAmount: bigint;
|
|
9
|
+
isInitialized: boolean;
|
|
10
|
+
isFrozen: boolean;
|
|
11
|
+
isNative: boolean;
|
|
12
|
+
rentExemptReserve: bigint | null;
|
|
13
|
+
closeAuthority: PublicKey | null;
|
|
14
|
+
}>;
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kimafinance/kima-transaction-widget",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Kima Transaction Widget",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "https://github.com/kima-finance/kima-transaction-widget",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"module": "dist/index.modern.js",
|
|
10
|
+
"source": "src/index.tsx",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=10"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "microbundle-crl --no-compress --format modern,cjs --css-modules false",
|
|
16
|
+
"start": "microbundle-crl watch --no-compress --format modern,cjs --css-modules false",
|
|
17
|
+
"sass": "node-sass src/styles/main.scss src/index.css -w"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": "^16.5.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@testing-library/react": "^13.4.0",
|
|
24
|
+
"@types/jest": "^29.1.2",
|
|
25
|
+
"@types/node": "^18.8.3",
|
|
26
|
+
"@types/react": "^18.0.21",
|
|
27
|
+
"@types/react-dom": "^18.0.6",
|
|
28
|
+
"@types/react-redux": "^7.1.24",
|
|
29
|
+
"cross-env": "^7.0.2",
|
|
30
|
+
"gh-pages": "^4.0.0",
|
|
31
|
+
"microbundle-crl": "^0.13.10",
|
|
32
|
+
"npm-run-all": "^4.1.5",
|
|
33
|
+
"prettier": "^2.0.4",
|
|
34
|
+
"react": "^18.2.0",
|
|
35
|
+
"react-dom": "^18.2.0",
|
|
36
|
+
"react-scripts": "^5.0.1",
|
|
37
|
+
"typescript": "^4.8.4"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@ethersproject/constants": "^5.7.0",
|
|
44
|
+
"@ethersproject/contracts": "^5.7.0",
|
|
45
|
+
"@ethersproject/providers": "^5.7.2",
|
|
46
|
+
"@ethersproject/units": "^5.7.0",
|
|
47
|
+
"@metamask/detect-provider": "^2.0.0",
|
|
48
|
+
"@reduxjs/toolkit": "^1.8.6",
|
|
49
|
+
"@solana/spl-token": "^0.3.5",
|
|
50
|
+
"@solana/wallet-adapter-base": "^0.9.18",
|
|
51
|
+
"@solana/wallet-adapter-react": "^0.15.20",
|
|
52
|
+
"@solana/wallet-adapter-wallets": "^0.19.3",
|
|
53
|
+
"@solana/web3.js": "^1.66.1",
|
|
54
|
+
"animated-number-react": "^0.1.2",
|
|
55
|
+
"better-sqlite3": "^7.6.2",
|
|
56
|
+
"buffer-layout": "^1.2.2",
|
|
57
|
+
"crypto-browserify": "^3.12.0",
|
|
58
|
+
"ethers": "^5.7.2",
|
|
59
|
+
"https-browserify": "^1.0.0",
|
|
60
|
+
"node-sass": "^7.0.3",
|
|
61
|
+
"os-browserify": "^0.3.0",
|
|
62
|
+
"react-redux": "^8.0.4",
|
|
63
|
+
"redux": "^4.2.0",
|
|
64
|
+
"stream-browserify": "^3.0.0",
|
|
65
|
+
"stream-http": "^3.2.0",
|
|
66
|
+
"url": "^0.11.0",
|
|
67
|
+
"web3": "1.7.4"
|
|
68
|
+
}
|
|
69
|
+
}
|