@ref-finance/ref-sdk 1.4.1 → 1.4.3

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.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { TokenMetadata, EstimateSwapView, Pool } from '../types';
3
3
  import './style.css';
4
+ import { SwapState } from './types';
4
5
  interface TokenAmountProps {
5
6
  balance?: string;
6
7
  reloading?: JSX.Element;
@@ -11,6 +12,7 @@ interface TokenAmountProps {
11
12
  price?: string;
12
13
  onForceUpdate?: () => void;
13
14
  poolFetchingState?: 'loading' | 'end';
15
+ minNearAmountLeftForGasFees: number;
14
16
  }
15
17
  export declare const getPriceImpact: (value: string, tokenIn: TokenMetadata, tokenInAmount: string) => JSX.Element;
16
18
  export declare const SmartRouteV2: ({ tokens: tokensRaw, p, pools, }: {
@@ -36,12 +38,11 @@ export declare const HalfAndMaxAmount: ({ max, onChangeAmount, token, amount, }:
36
38
  amount: string;
37
39
  }) => JSX.Element;
38
40
  export declare const TokenAmount: (props: TokenAmountProps) => JSX.Element;
39
- export declare const SlippageSelector: ({ slippageTolerance, onChangeSlippageTolerance, showSlip, setShowSlip, }: {
40
- slippageTolerance: number;
41
- onChangeSlippageTolerance: (slippageTolerance: number) => void;
42
- showSlip: boolean;
41
+ export declare const SlippageSelector: ({ slippageTolerance, onChangeSlippageTolerance, setShowSlip, }: {
42
+ slippageTolerance: string;
43
+ onChangeSlippageTolerance: (slippageTolerance: string) => void;
43
44
  setShowSlip: (showSlip: boolean) => void;
44
- }) => JSX.Element | null;
45
+ }) => JSX.Element;
45
46
  interface TokenListProps {
46
47
  tokens: TokenMetadata[];
47
48
  onClick: (token: TokenMetadata) => void;
@@ -74,14 +75,12 @@ export declare const Loading: () => JSX.Element;
74
75
  export declare const Warning: () => JSX.Element;
75
76
  export declare const Success: () => JSX.Element;
76
77
  export declare const RouterIcon: () => JSX.Element;
77
- export declare const Notification: ({ state, tx, detail, open, setOpen, setState, }: {
78
- state?: "success" | "fail" | null | undefined;
79
- setState?: ((state: 'success' | 'fail' | null) => void) | undefined;
78
+ export declare const Notification: ({ state, tx, detail, setSwapState, }: {
79
+ state: SwapState;
80
+ setSwapState: (state: SwapState) => void;
80
81
  tx?: string | undefined;
81
82
  detail?: string | undefined;
82
- open: boolean;
83
- setOpen: (open: boolean) => void;
84
- }) => JSX.Element | null;
83
+ }) => JSX.Element;
85
84
  export declare const ArrowRight: () => JSX.Element;
86
85
  export declare const AccountButton: ({ AccountId, onDisConnect, }: {
87
86
  AccountId: string;
@@ -2,6 +2,7 @@ import { EstimateSwapView } from '../types';
2
2
  import { Transaction } from '../types';
3
3
  import { TokenMetadata } from '../../dist/types';
4
4
  import { Theme } from './constant';
5
+ export declare type SwapState = 'success' | 'fail' | 'waitingForConfirmation' | null;
5
6
  export interface SwapWidgetProps {
6
7
  theme?: Theme;
7
8
  defaultTokenList?: TokenMetadata[];
@@ -19,12 +20,13 @@ export interface SwapWidgetProps {
19
20
  defaultTokenIn?: string;
20
21
  defaultTokenOut?: string;
21
22
  referralId?: string;
22
- transactionState?: {
23
- state: 'success' | 'fail' | null;
24
- setState: (state: 'success' | 'fail' | null) => void;
23
+ transactionState: {
24
+ state: SwapState;
25
+ setState: (state: SwapState) => void;
25
26
  tx?: string;
26
27
  detail?: string;
27
28
  };
29
+ minNearAmountLeftForGasFees?: number;
28
30
  onConnect: () => void;
29
31
  }
30
32
  export interface SwapOutParams {
package/dist/utils.d.ts CHANGED
@@ -66,7 +66,8 @@ export declare const subtraction: (initialValue: string, toBeSubtract: string) =
66
66
  export declare function getPoolAllocationPercents(pools: Pool[]): string[];
67
67
  export declare const isMobile: () => boolean;
68
68
  export declare function divide(numerator: string, denominator: string): string;
69
- export declare const getMax: (id: string, amount: string) => string;
69
+ export declare const getMax: (id: string, amount: string, minNearAmountLeftForGasFees: number) => string;
70
+ export declare const isValidSlippageTolerance: (value: number) => boolean;
70
71
  export declare function getPointByPrice(pointDelta: number, price: string, decimalRate: number, noNeedSlot?: boolean): number;
71
72
  export declare const feeToPointDelta: (fee: number) => 1 | 8 | 40 | 200;
72
73
  export declare const priceToPoint: ({ tokenA, tokenB, amountA, amountB, fee, }: {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.1",
2
+ "version": "1.4.3",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",