@alphafi/alphafi-sdk 0.0.10 → 0.0.11

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.
Files changed (131) hide show
  1. package/.envrc +1 -0
  2. package/.eslintrc.json +21 -0
  3. package/.github/workflows/static.yml +51 -0
  4. package/.prettierrc.json +27 -0
  5. package/.prettierrc.json~ +30 -0
  6. package/__tests__/getAprs.test.ts~ +9 -0
  7. package/__tests__/getRebalanceHistory.test.ts~ +19 -0
  8. package/apr.org +11 -0
  9. package/babel.config.json +11 -0
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.LICENSE.txt +42 -22
  12. package/dist/index.js.map +1 -1
  13. package/docs/.nojekyll +1 -0
  14. package/docs/assets/highlight.css +78 -0
  15. package/docs/assets/icons.js +18 -0
  16. package/docs/assets/icons.svg +1 -0
  17. package/docs/assets/main.js +60 -0
  18. package/docs/assets/navigation.js +1 -0
  19. package/docs/assets/search.js +1 -0
  20. package/docs/assets/style.css +1448 -0
  21. package/docs/functions/alphaLpBreakdown.html +1 -0
  22. package/docs/functions/cetusLpBreakdown.html +1 -0
  23. package/docs/functions/collectRewards.html +1 -0
  24. package/docs/functions/deposit.html +1 -0
  25. package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -0
  26. package/docs/functions/fetchCetusPools.html +1 -0
  27. package/docs/functions/fetchChainIdentifier.html +1 -0
  28. package/docs/functions/fetchNftHolders.html +1 -0
  29. package/docs/functions/fetchPools.html +1 -0
  30. package/docs/functions/fetchPortfolioData.html +1 -0
  31. package/docs/functions/fetchProtocolData.html +1 -0
  32. package/docs/functions/fetchUserVaultBalances.html +1 -0
  33. package/docs/functions/fetchUserVaults.html +1 -0
  34. package/docs/functions/fetchUserWalletData.html +1 -0
  35. package/docs/functions/getAirdropShare.html +1 -0
  36. package/docs/functions/getAllDoubleAssetVaults.html +1 -0
  37. package/docs/functions/getAllSingleAssetVaults.html +1 -0
  38. package/docs/functions/getAllVaults.html +1 -0
  39. package/docs/functions/getAlphaVaultBalance.html +1 -0
  40. package/docs/functions/getApr.html +1 -0
  41. package/docs/functions/getAprs.html +1 -0
  42. package/docs/functions/getApy.html +1 -0
  43. package/docs/functions/getApys.html +1 -0
  44. package/docs/functions/getDoubleAssetVaultBalance.html +1 -0
  45. package/docs/functions/getDoubleAssetVaults.html +1 -0
  46. package/docs/functions/getRebalanceHistories.html +1 -0
  47. package/docs/functions/getRebalanceHistory.html +1 -0
  48. package/docs/functions/getSingleAssetVaultBalance.html +1 -0
  49. package/docs/functions/getSingleAssetVaults.html +1 -0
  50. package/docs/functions/getVaultBalance.html +1 -0
  51. package/docs/functions/getVaults.html +1 -0
  52. package/docs/functions/lastAutocompoundTime.html +1 -0
  53. package/docs/functions/parseUserWalletData.html +1 -0
  54. package/docs/functions/withdraw.html +1 -0
  55. package/docs/index.html +40 -0
  56. package/docs/interfaces/Coin.html +5 -0
  57. package/docs/interfaces/CoinPair.html +3 -0
  58. package/docs/interfaces/RebalanceHistoryType.html +5 -0
  59. package/docs/modules.html +66 -0
  60. package/docs/types/AlphaFiDoubleAssetVault.html +1 -0
  61. package/docs/types/AlphaFiSingleAssetVault.html +1 -0
  62. package/docs/types/AlphaFiVault.html +1 -0
  63. package/docs/types/AlphaFiVaultBalance.html +1 -0
  64. package/docs/types/AlphaPoolType.html +1 -0
  65. package/docs/types/AlphaReceipt.html +1 -0
  66. package/docs/types/AlphaVaultBalance.html +1 -0
  67. package/docs/types/AutoCompoundingEventNode.html +1 -0
  68. package/docs/types/CetusInvestor.html +1 -0
  69. package/docs/types/CetusPoolType.html +1 -0
  70. package/docs/types/CetusSwapOptions.html +1 -0
  71. package/docs/types/CoinAmounts.html +1 -0
  72. package/docs/types/CoinName.html +1 -0
  73. package/docs/types/CoinType.html +1 -0
  74. package/docs/types/CreatePoolOptions.html +1 -0
  75. package/docs/types/DoubleAssetVaultBalance.html +1 -0
  76. package/docs/types/Icon.html +1 -0
  77. package/docs/types/LpBreakdownType.html +1 -0
  78. package/docs/types/ParentProtocolName.html +1 -0
  79. package/docs/types/PoolName.html +1 -0
  80. package/docs/types/PoolReceipt.html +1 -0
  81. package/docs/types/PoolType.html +1 -0
  82. package/docs/types/Receipt.html +1 -0
  83. package/docs/types/SingleAssetVaultBalance.html +1 -0
  84. package/docs/types/SuiNetwork.html +1 -0
  85. package/docs/types/SwapOptions.html +1 -0
  86. package/docs/types/TickSpacing.html +1 -0
  87. package/docs/types/TransactionBlockType.html +1 -0
  88. package/events.csv +61 -0
  89. package/events.csv~ +71 -0
  90. package/jest.config.js +5 -0
  91. package/package.json +30 -29
  92. package/package.json~ +56 -0
  93. package/tsconfig.json~ +16 -0
  94. package/tsconfig.test.json~ +17 -0
  95. package/typedoc.json +8 -0
  96. package/webpack.config.cjs~ +63 -0
  97. package/webpack.config.js +54 -0
  98. package/webpack.config.js~ +50 -0
  99. package/webpack.config.ts~ +64 -0
  100. package/dist/common/alphaTypes.d.ts +0 -110
  101. package/dist/common/alphaTypes.d.ts.map +0 -1
  102. package/dist/common/cetus_mainnet_config.d.ts +0 -3
  103. package/dist/common/cetus_mainnet_config.d.ts.map +0 -1
  104. package/dist/common/coins.d.ts +0 -5
  105. package/dist/common/coins.d.ts.map +0 -1
  106. package/dist/common/constants.d.ts +0 -294
  107. package/dist/common/constants.d.ts.map +0 -1
  108. package/dist/common/maps.d.ts +0 -32
  109. package/dist/common/maps.d.ts.map +0 -1
  110. package/dist/common/pyth.d.ts +0 -7
  111. package/dist/common/pyth.d.ts.map +0 -1
  112. package/dist/common/types.d.ts +0 -391
  113. package/dist/common/types.d.ts.map +0 -1
  114. package/dist/functions.d.ts +0 -26
  115. package/dist/functions.d.ts.map +0 -1
  116. package/dist/getAirdropShare.d.ts +0 -5
  117. package/dist/getAirdropShare.d.ts.map +0 -1
  118. package/dist/getAllVaults.d.ts +0 -4
  119. package/dist/getAllVaults.d.ts.map +0 -1
  120. package/dist/getVaultBalances.d.ts +0 -5
  121. package/dist/getVaultBalances.d.ts.map +0 -1
  122. package/dist/getVaults.d.ts +0 -5
  123. package/dist/getVaults.d.ts.map +0 -1
  124. package/dist/index.d.ts +0 -7
  125. package/dist/index.d.ts.map +0 -1
  126. package/dist/portfolioAmount.d.ts +0 -36
  127. package/dist/portfolioAmount.d.ts.map +0 -1
  128. package/dist/price.d.ts +0 -19
  129. package/dist/price.d.ts.map +0 -1
  130. package/dist/vaultFunctions.d.ts +0 -15
  131. package/dist/vaultFunctions.d.ts.map +0 -1
package/.envrc ADDED
@@ -0,0 +1 @@
1
+ export AWS_PROFILE=alphafi-mgmt-admin
package/.eslintrc.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "extends": [
4
+ "plugin:@typescript-eslint/recommended",
5
+ "plugin:import/errors",
6
+ "plugin:import/warnings",
7
+ "plugin:import/typescript",
8
+ "plugin:prettier/recommended" // Adds Prettier plugin recommendations at the end
9
+ ],
10
+ "parserOptions": {
11
+ "ecmaVersion": 2020,
12
+ "sourceType": "module"
13
+ },
14
+ "rules": {
15
+ "@typescript-eslint/no-explicit-any": "off",
16
+ "prettier/prettier": "error" // Ensures that Prettier mismatches are shown as errors
17
+ },
18
+ "plugins": [
19
+ "prettier" // Ensure this plugin is installed and included
20
+ ]
21
+ }
@@ -0,0 +1,51 @@
1
+ # Simple workflow for deploying docs to GitHub Pages
2
+ name: Deploy Documentation to GitHub Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches: ["main"]
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: false
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v4
34
+ - name: Set up Node.js
35
+ uses: actions/setup-node@v4
36
+ with:
37
+ node-version: 20
38
+ - name: Install dependencies
39
+ run: npm install
40
+ - name: Generate Documentation
41
+ run: npm run docs
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@v5
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v3
46
+ with:
47
+ # Upload entire repository
48
+ path: "./docs"
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,27 @@
1
+ {
2
+ "semi": true,
3
+ "printWidth": 80,
4
+ "tabWidth": 2,
5
+ "endOfLine": "lf",
6
+
7
+ "overrides": [
8
+ {
9
+ "files": "*.ts",
10
+ "options": {
11
+ "parser": "typescript"
12
+ }
13
+ },
14
+ {
15
+ "files": "*.tsx",
16
+ "options": {
17
+ "parser": "typescript"
18
+ }
19
+ },
20
+ {
21
+ "files": "*.graphql",
22
+ "options": {
23
+ "parser": "graphql"
24
+ }
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": true,
5
+ "printWidth": 80,
6
+ "tabWidth": 2,
7
+ "arrowParens": "avoid",
8
+ "endOfLine": "lf",
9
+ "bracketSpacing": true,
10
+ "overrides": [
11
+ {
12
+ "files": "*.ts",
13
+ "options": {
14
+ "parser": "typescript"
15
+ }
16
+ },
17
+ {
18
+ "files": "*.tsx",
19
+ "options": {
20
+ "parser": "typescript"
21
+ }
22
+ },
23
+ {
24
+ "files": "*.graphql",
25
+ "options": {
26
+ "parser": "graphql"
27
+ }
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,9 @@
1
+ import { getApr, getAprs } from "../dist";
2
+
3
+ describe("getApr", () => {
4
+ it("should return the correct value", async () => {
5
+ return getApr("USDT-USDC").then((apr) => {
6
+ expect(apr).toBeDefined();
7
+ });
8
+ });
9
+ });
@@ -0,0 +1,19 @@
1
+ import { getRebalanceHistory, getRebalanceHistories } from "../dist";
2
+
3
+ describe("getRebalanceHistory", () => {
4
+ it("should return the correct value", async () => {
5
+ return getRebalanceHistory("USDT-USDC").then((history) => {
6
+ console.log(history);
7
+ expect(history).toBeDefined();
8
+ });
9
+ });
10
+ });
11
+
12
+ describe("getRebalanceHistories", () => {
13
+ it("should return the correct value", async () => {
14
+ return getRebalanceHistories(["USDT-USDC"]).then((historyMap) => {
15
+ console.log(historyMap);
16
+ expect(historyMap).toBeDefined();
17
+ });
18
+ });
19
+ });
package/apr.org ADDED
@@ -0,0 +1,11 @@
1
+ If g1, g2, ..., gn are growths in intervals t1, t2, ..., tn. Here t1, t2, ..., tn are fraction of a day in milliseconds. Then which one is the best way to calculate APR. Assume that T is number of milliseconds in a day.
2
+
3
+ Option-1
4
+ --------
5
+
6
+ (g1*t1 + g2*t2 + ... + gn*tn) / (t1 + t2 + ... + tn)
7
+
8
+ Option-2
9
+ --------
10
+
11
+ (g1*t1/T + g2*t2/T + ... + gn*t2/T) / (t1/T + t2/T + ... + tn/T)
@@ -0,0 +1,11 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": "> 0.25%, not dead"
7
+ }
8
+ ],
9
+ "@babel/preset-typescript"
10
+ ]
11
+ }