@alphafi/alphafi-sdk 0.0.9 → 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.
- package/.envrc +1 -0
- package/.eslintrc.json +21 -0
- package/.github/workflows/static.yml +51 -0
- package/.prettierrc.json +27 -0
- package/.prettierrc.json~ +30 -0
- package/__tests__/getAprs.test.ts~ +9 -0
- package/__tests__/getRebalanceHistory.test.ts~ +19 -0
- package/apr.org +11 -0
- package/babel.config.json +11 -0
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +42 -22
- package/dist/index.js.map +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +78 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1448 -0
- package/docs/functions/alphaLpBreakdown.html +1 -0
- package/docs/functions/cetusLpBreakdown.html +1 -0
- package/docs/functions/collectRewards.html +1 -0
- package/docs/functions/deposit.html +1 -0
- package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -0
- package/docs/functions/fetchCetusPools.html +1 -0
- package/docs/functions/fetchChainIdentifier.html +1 -0
- package/docs/functions/fetchNftHolders.html +1 -0
- package/docs/functions/fetchPools.html +1 -0
- package/docs/functions/fetchPortfolioData.html +1 -0
- package/docs/functions/fetchProtocolData.html +1 -0
- package/docs/functions/fetchUserVaultBalances.html +1 -0
- package/docs/functions/fetchUserVaults.html +1 -0
- package/docs/functions/fetchUserWalletData.html +1 -0
- package/docs/functions/getAirdropShare.html +1 -0
- package/docs/functions/getAllDoubleAssetVaults.html +1 -0
- package/docs/functions/getAllSingleAssetVaults.html +1 -0
- package/docs/functions/getAllVaults.html +1 -0
- package/docs/functions/getAlphaVaultBalance.html +1 -0
- package/docs/functions/getApr.html +1 -0
- package/docs/functions/getAprs.html +1 -0
- package/docs/functions/getApy.html +1 -0
- package/docs/functions/getApys.html +1 -0
- package/docs/functions/getDoubleAssetVaultBalance.html +1 -0
- package/docs/functions/getDoubleAssetVaults.html +1 -0
- package/docs/functions/getRebalanceHistories.html +1 -0
- package/docs/functions/getRebalanceHistory.html +1 -0
- package/docs/functions/getSingleAssetVaultBalance.html +1 -0
- package/docs/functions/getSingleAssetVaults.html +1 -0
- package/docs/functions/getVaultBalance.html +1 -0
- package/docs/functions/getVaults.html +1 -0
- package/docs/functions/lastAutocompoundTime.html +1 -0
- package/docs/functions/parseUserWalletData.html +1 -0
- package/docs/functions/withdraw.html +1 -0
- package/docs/index.html +40 -0
- package/docs/interfaces/Coin.html +5 -0
- package/docs/interfaces/CoinPair.html +3 -0
- package/docs/interfaces/RebalanceHistoryType.html +5 -0
- package/docs/modules.html +66 -0
- package/docs/types/AlphaFiDoubleAssetVault.html +1 -0
- package/docs/types/AlphaFiSingleAssetVault.html +1 -0
- package/docs/types/AlphaFiVault.html +1 -0
- package/docs/types/AlphaFiVaultBalance.html +1 -0
- package/docs/types/AlphaPoolType.html +1 -0
- package/docs/types/AlphaReceipt.html +1 -0
- package/docs/types/AlphaVaultBalance.html +1 -0
- package/docs/types/AutoCompoundingEventNode.html +1 -0
- package/docs/types/CetusInvestor.html +1 -0
- package/docs/types/CetusPoolType.html +1 -0
- package/docs/types/CetusSwapOptions.html +1 -0
- package/docs/types/CoinAmounts.html +1 -0
- package/docs/types/CoinName.html +1 -0
- package/docs/types/CoinType.html +1 -0
- package/docs/types/CreatePoolOptions.html +1 -0
- package/docs/types/DoubleAssetVaultBalance.html +1 -0
- package/docs/types/Icon.html +1 -0
- package/docs/types/LpBreakdownType.html +1 -0
- package/docs/types/ParentProtocolName.html +1 -0
- package/docs/types/PoolName.html +1 -0
- package/docs/types/PoolReceipt.html +1 -0
- package/docs/types/PoolType.html +1 -0
- package/docs/types/Receipt.html +1 -0
- package/docs/types/SingleAssetVaultBalance.html +1 -0
- package/docs/types/SuiNetwork.html +1 -0
- package/docs/types/SwapOptions.html +1 -0
- package/docs/types/TickSpacing.html +1 -0
- package/docs/types/TransactionBlockType.html +1 -0
- package/events.csv +61 -0
- package/events.csv~ +71 -0
- package/jest.config.js +5 -0
- package/package.json +30 -29
- package/package.json~ +56 -0
- package/tsconfig.json~ +16 -0
- package/tsconfig.test.json~ +17 -0
- package/typedoc.json +8 -0
- package/webpack.config.cjs~ +63 -0
- package/webpack.config.js +54 -0
- package/webpack.config.js~ +50 -0
- package/webpack.config.ts~ +64 -0
- package/dist/common/alphaTypes.d.ts +0 -110
- package/dist/common/alphaTypes.d.ts.map +0 -1
- package/dist/common/cetus_mainnet_config.d.ts +0 -3
- package/dist/common/cetus_mainnet_config.d.ts.map +0 -1
- package/dist/common/coins.d.ts +0 -5
- package/dist/common/coins.d.ts.map +0 -1
- package/dist/common/constants.d.ts +0 -294
- package/dist/common/constants.d.ts.map +0 -1
- package/dist/common/maps.d.ts +0 -32
- package/dist/common/maps.d.ts.map +0 -1
- package/dist/common/pyth.d.ts +0 -7
- package/dist/common/pyth.d.ts.map +0 -1
- package/dist/common/types.d.ts +0 -391
- package/dist/common/types.d.ts.map +0 -1
- package/dist/functions.d.ts +0 -26
- package/dist/functions.d.ts.map +0 -1
- package/dist/getAirdropShare.d.ts +0 -5
- package/dist/getAirdropShare.d.ts.map +0 -1
- package/dist/getAllVaults.d.ts +0 -4
- package/dist/getAllVaults.d.ts.map +0 -1
- package/dist/getVaultBalances.d.ts +0 -5
- package/dist/getVaultBalances.d.ts.map +0 -1
- package/dist/getVaults.d.ts +0 -5
- package/dist/getVaults.d.ts.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/portfolioAmount.d.ts +0 -36
- package/dist/portfolioAmount.d.ts.map +0 -1
- package/dist/price.d.ts +0 -19
- package/dist/price.d.ts.map +0 -1
- package/dist/vaultFunctions.d.ts +0 -15
- 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
|
package/.prettierrc.json
ADDED
|
@@ -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,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)
|