@xswap-link/sdk 0.0.13 → 0.1.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/.github/workflows/main.yml +2 -1
- package/.github/workflows/publish.yml +2 -1
- package/.prettierrc +7 -0
- package/CHANGELOG.md +27 -1
- package/README.md +23 -14
- package/dist/index.css +1108 -0
- package/dist/index.d.mts +212 -52
- package/dist/index.d.ts +212 -52
- package/dist/index.js +2184 -85
- package/dist/index.mjs +2148 -76
- package/nodemon.json +5 -0
- package/package.json +20 -3
- package/postcss.config.js +3 -0
- package/src/components/Alert/index.tsx +9 -0
- package/src/components/Skeleton/index.tsx +10 -0
- package/src/components/TxConfigForm/BalanceComponent.tsx +51 -0
- package/src/components/TxConfigForm/ChainListElement.tsx +36 -0
- package/src/components/TxConfigForm/Description.tsx +15 -0
- package/src/components/TxConfigForm/ErrorField.tsx +17 -0
- package/src/components/TxConfigForm/FeesDetails.tsx +105 -0
- package/src/components/TxConfigForm/Form.tsx +250 -0
- package/src/components/TxConfigForm/History.tsx +155 -0
- package/src/components/TxConfigForm/HistoryCard.tsx +209 -0
- package/src/components/TxConfigForm/Settings.tsx +137 -0
- package/src/components/TxConfigForm/Summary.tsx +57 -0
- package/src/components/TxConfigForm/SwapPanel.tsx +191 -0
- package/src/components/TxConfigForm/TokenPicker.tsx +171 -0
- package/src/components/TxConfigForm/TopBar.tsx +53 -0
- package/src/components/TxConfigForm/index.tsx +121 -0
- package/src/components/global.css +34 -0
- package/src/components/icons/ArrowDownIcon.tsx +16 -0
- package/src/components/icons/ArrowRightIcon.tsx +11 -0
- package/src/components/icons/ArrowUpRightIcon.tsx +11 -0
- package/src/components/icons/ChainlinkCCIPIcon.tsx +23 -0
- package/src/components/icons/CheckIcon.tsx +11 -0
- package/src/components/icons/ChevronDownIcon.tsx +15 -0
- package/src/components/icons/ChevronUpIcon.tsx +15 -0
- package/src/components/icons/CircularProgressIcon.tsx +24 -0
- package/src/components/icons/CloseIcon.tsx +15 -0
- package/src/components/icons/CoinsIcon.tsx +17 -0
- package/src/components/icons/DownArrorIcon.tsx +17 -0
- package/src/components/icons/HistoryIcon.tsx +16 -0
- package/src/components/icons/HourGlassIcon.tsx +11 -0
- package/src/components/icons/InfoIcon.tsx +13 -0
- package/src/components/icons/PercentageIcon.tsx +29 -0
- package/src/components/icons/SearchIcon.tsx +15 -0
- package/src/components/icons/SettingsIcon.tsx +16 -0
- package/src/components/icons/TimerIcon.tsx +15 -0
- package/src/components/icons/XMarkIcon.tsx +11 -0
- package/src/components/icons/XSwapBadgeIcon.tsx +23 -0
- package/src/components/icons/index.ts +20 -0
- package/src/components/index.ts +3 -0
- package/src/config/index.ts +1 -0
- package/src/config/wagmiConfig.ts +45 -0
- package/src/constants/index.ts +9 -5
- package/src/contracts/abi/BatchQuery.json +52 -0
- package/src/contracts/abi/index.ts +2 -0
- package/src/contracts/addresses.ts +34 -0
- package/src/contracts/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDebounce.tsx +21 -0
- package/src/index.ts +6 -0
- package/src/models/Addresses.ts +12 -0
- package/src/models/Route.ts +17 -5
- package/src/models/TokenData.ts +45 -0
- package/src/models/TransactionHistory.ts +48 -0
- package/src/models/XSwapConfig.ts +3 -0
- package/src/models/forms/TxConfigFormData.ts +8 -0
- package/src/models/forms/index.ts +1 -0
- package/src/models/index.ts +6 -6
- package/src/models/integrations/GenerateStakingCallsParams.ts +8 -0
- package/src/models/integrations/index.ts +1 -0
- package/src/models/payloads/GetPricesPayload.ts +4 -0
- package/src/models/payloads/GetRoutePayload.ts +1 -3
- package/src/models/payloads/GetSwapTxPayload.ts +8 -0
- package/src/models/payloads/index.ts +2 -0
- package/src/services/api.ts +46 -64
- package/src/services/index.ts +1 -0
- package/src/services/integrations/customCalls/index.ts +1 -0
- package/src/services/integrations/customCalls/staking.ts +83 -0
- package/src/services/integrations/index.ts +2 -0
- package/src/services/integrations/transactions.ts +30 -0
- package/src/utils/contracts.ts +153 -11
- package/src/utils/index.ts +49 -1
- package/src/utils/numbers.ts +47 -0
- package/src/utils/strings.ts +6 -0
- package/tailwind.config.js +19 -0
- package/test/api.test.ts +1 -1
- package/tsconfig.json +10 -1
- package/xswap.config.ts +18 -0
- package/index.ts +0 -5
- package/src/models/ApiOverrides.ts +0 -3
- package/src/models/Chain.ts +0 -20
- package/src/models/Prices.ts +0 -9
- package/src/models/Token.ts +0 -10
- package/src/models/XSwapFee.ts +0 -4
- package/src/models/XSwapFees.ts +0 -7
- package/src/utils/bigNumbers.ts +0 -7
package/tsconfig.json
CHANGED
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
"noUncheckedIndexedAccess": true,
|
|
12
12
|
"moduleResolution": "Bundler",
|
|
13
13
|
"module": "ESNext",
|
|
14
|
-
"noEmit": true
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
"paths": {
|
|
17
|
+
"@src/*": [
|
|
18
|
+
"./src/*"
|
|
19
|
+
],
|
|
20
|
+
"@src/global.css": [
|
|
21
|
+
"./src/components/global.css"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
15
24
|
}
|
|
16
25
|
}
|
package/xswap.config.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { XSwapConfig } from "@src/models";
|
|
2
|
+
|
|
3
|
+
const xSwapConfig: XSwapConfig = {
|
|
4
|
+
apiUrl: "https://xswap.link/api",
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
let xSwapConfigLocal = {};
|
|
8
|
+
try {
|
|
9
|
+
// eslint-disable-next-line
|
|
10
|
+
xSwapConfigLocal = require("./xswap.config.local").default;
|
|
11
|
+
} catch {
|
|
12
|
+
// There's no local config, nothing to override.
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
...xSwapConfig,
|
|
17
|
+
...xSwapConfigLocal,
|
|
18
|
+
};
|
package/index.ts
DELETED
package/src/models/Chain.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Web3Environment } from "./Web3Environment";
|
|
2
|
-
import { Token } from "./Token";
|
|
3
|
-
|
|
4
|
-
export type Chain = {
|
|
5
|
-
ecosystem: string;
|
|
6
|
-
chainId: string;
|
|
7
|
-
name: string;
|
|
8
|
-
displayName: string;
|
|
9
|
-
image: string;
|
|
10
|
-
web3Environment: Web3Environment;
|
|
11
|
-
tokenSymbol: string;
|
|
12
|
-
ccipChainId: string;
|
|
13
|
-
transactionExplorer: string;
|
|
14
|
-
bridgeSupported: boolean;
|
|
15
|
-
swapSupported: boolean;
|
|
16
|
-
tokens: Token[];
|
|
17
|
-
publicRpcUrls: string[];
|
|
18
|
-
privateRpcUrls?: string[];
|
|
19
|
-
scanApiURL?: string;
|
|
20
|
-
};
|
package/src/models/Prices.ts
DELETED
package/src/models/Token.ts
DELETED
package/src/models/XSwapFee.ts
DELETED
package/src/models/XSwapFees.ts
DELETED
package/src/utils/bigNumbers.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BigNumber as BigNumberJS } from "bignumber.js";
|
|
2
|
-
import { BigNumber } from "ethers";
|
|
3
|
-
|
|
4
|
-
export const safeBigNumberFrom = (value: string) => {
|
|
5
|
-
BigNumberJS.config({ DECIMAL_PLACES: 0 });
|
|
6
|
-
return BigNumber.from(new BigNumberJS(value).div(1).toFixed());
|
|
7
|
-
};
|