@typus/typus-sdk 1.4.3-c → 1.4.3-e
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/package.json +10 -2
- package/src/_dependencies/source/0x1/ascii/structs.ts +135 -0
- package/src/_dependencies/source/0x1/bit-vector/structs.ts +70 -0
- package/src/_dependencies/source/0x1/fixed-point32/structs.ts +69 -0
- package/src/_dependencies/source/0x1/index.ts +1 -0
- package/src/_dependencies/source/0x1/init.ts +16 -0
- package/src/_dependencies/source/0x1/option/structs.ts +74 -0
- package/src/_dependencies/source/0x1/string/structs.ts +70 -0
- package/src/_dependencies/source/0x1/type-name/structs.ts +70 -0
- package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/index.ts +1 -0
- package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/init.ts +14 -0
- package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/oracle/structs.ts +203 -0
- package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/pyth-parser/structs.ts +317 -0
- package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/supra/structs.ts +69 -0
- package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/switchboard-feed-parser/structs.ts +69 -0
- package/src/_dependencies/source/0x2/authenticator-state/structs.ts +332 -0
- package/src/_dependencies/source/0x2/bag/structs.ts +70 -0
- package/src/_dependencies/source/0x2/balance/structs.ts +134 -0
- package/src/_dependencies/source/0x2/bcs/structs.ts +70 -0
- package/src/_dependencies/source/0x2/bls12381/structs.ts +264 -0
- package/src/_dependencies/source/0x2/borrow/structs.ts +138 -0
- package/src/_dependencies/source/0x2/clock/structs.ts +70 -0
- package/src/_dependencies/source/0x2/coin/structs.ts +400 -0
- package/src/_dependencies/source/0x2/deny-list/structs.ts +139 -0
- package/src/_dependencies/source/0x2/display/structs.ts +202 -0
- package/src/_dependencies/source/0x2/dynamic-field/structs.ts +70 -0
- package/src/_dependencies/source/0x2/dynamic-object-field/structs.ts +71 -0
- package/src/_dependencies/source/0x2/groth16/structs.ts +265 -0
- package/src/_dependencies/source/0x2/group-ops/structs.ts +70 -0
- package/src/_dependencies/source/0x2/index.ts +1 -0
- package/src/_dependencies/source/0x2/init.ts +125 -0
- package/src/_dependencies/source/0x2/kiosk/structs.ts +658 -0
- package/src/_dependencies/source/0x2/kiosk-extension/structs.ts +135 -0
- package/src/_dependencies/source/0x2/linked-table/structs.ts +136 -0
- package/src/_dependencies/source/0x2/object/structs.ts +134 -0
- package/src/_dependencies/source/0x2/object-bag/structs.ts +70 -0
- package/src/_dependencies/source/0x2/object-table/structs.ts +70 -0
- package/src/_dependencies/source/0x2/package/structs.ts +267 -0
- package/src/_dependencies/source/0x2/priority-queue/structs.ts +139 -0
- package/src/_dependencies/source/0x2/random/structs.ts +202 -0
- package/src/_dependencies/source/0x2/sui/structs.ts +69 -0
- package/src/_dependencies/source/0x2/table/structs.ts +70 -0
- package/src/_dependencies/source/0x2/table-vec/structs.ts +71 -0
- package/src/_dependencies/source/0x2/token/structs.ts +401 -0
- package/src/_dependencies/source/0x2/transfer/structs.ts +70 -0
- package/src/_dependencies/source/0x2/transfer-policy/structs.ts +400 -0
- package/src/_dependencies/source/0x2/tx-context/structs.ts +70 -0
- package/src/_dependencies/source/0x2/url/structs.ts +70 -0
- package/src/_dependencies/source/0x2/vec-map/structs.ts +135 -0
- package/src/_dependencies/source/0x2/vec-set/structs.ts +72 -0
- package/src/_dependencies/source/0x2/versioned/structs.ts +135 -0
- package/src/_dependencies/source/0x2/zklogin-verified-id/structs.ts +71 -0
- package/src/_dependencies/source/0x2/zklogin-verified-issuer/structs.ts +71 -0
- package/src/_dependencies/source/0x277f90d256d1015a78cad646db091bec451c5bbab834b9fb70bace7885b5c698/index.ts +1 -0
- package/src/_dependencies/source/0x277f90d256d1015a78cad646db091bec451c5bbab834b9fb70bace7885b5c698/init.ts +5 -0
- package/src/_dependencies/source/0x277f90d256d1015a78cad646db091bec451c5bbab834b9fb70bace7885b5c698/validator/structs.ts +70 -0
- package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/index.ts +1 -0
- package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/init.ts +8 -0
- package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/price-data-pull/structs.ts +69 -0
- package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/suprasvaluefeed/structs.ts +135 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/airdrop/structs.ts +400 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/big-vector/structs.ts +372 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/critbit/structs.ts +205 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/ecosystem/structs.ts +333 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.ts +1 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/init.ts +48 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/leaderboard/structs.ts +465 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/linked-object-table/structs.ts +136 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/linked-set/structs.ts +140 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/tgld/structs.ts +268 -0
- package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/user/structs.ts +332 -0
- package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/discount-mint/structs.ts +466 -0
- package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/index.ts +1 -0
- package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/init.ts +36 -0
- package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/royalty-rule/structs.ts +134 -0
- package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/staking/structs.ts +333 -0
- package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/table-vec/structs.ts +71 -0
- package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/typus-nft/structs.ts +856 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/auto-bid/structs.ts +1049 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/index.ts +1 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/init.ts +104 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tails-staking/structs.ts +1054 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-authorized-entry/structs.ts +592 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-fee-pool-entry/structs.ts +461 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-registry-authorized-entry/structs.ts +592 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-view-function/structs.ts +69 -0
- package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/typus-dov-single/structs.ts +2351 -0
- package/src/_dependencies/source/0x7237ec8436ef7e927c45470db6db3a834dd84cf903aedee3844e847fe4805399/index.ts +1 -0
- package/src/_dependencies/source/0x7237ec8436ef7e927c45470db6db3a834dd84cf903aedee3844e847fe4805399/init.ts +3 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/authority/structs.ts +71 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/balance-pool/structs.ts +203 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/big-vector/structs.ts +70 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/dutch/structs.ts +528 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/i64/structs.ts +69 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.ts +1 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/init.ts +54 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/linked-list/structs.ts +136 -0
- package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/vault/structs.ts +1829 -0
- package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/aggregator/structs.ts +398 -0
- package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.ts +1 -0
- package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/init.ts +18 -0
- package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/job/structs.ts +71 -0
- package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/math/structs.ts +69 -0
- package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/quote/structs.ts +71 -0
- package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/switchboard/structs.ts +70 -0
- package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/index.ts +1 -0
- package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/init.ts +11 -0
- package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/kiosk-lock-rule/structs.ts +134 -0
- package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/royalty-rule/structs.ts +134 -0
- package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/witness-rule/structs.ts +69 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/bytes20/structs.ts +70 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/bytes32/structs.ts +70 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/consumed-vaas/structs.ts +72 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/cursor/structs.ts +72 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/emitter/structs.ts +200 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/external-address/structs.ts +70 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/fee-collector/structs.ts +72 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/governance-message/structs.ts +137 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/guardian/structs.ts +70 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/guardian-set/structs.ts +71 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/guardian-signature/structs.ts +70 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/index.ts +1 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/init.ts +65 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/migrate/structs.ts +70 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/package-utils/structs.ts +266 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/publish-message/structs.ts +136 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/set/structs.ts +136 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/set-fee/structs.ts +134 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/setup/structs.ts +70 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/state/structs.ts +142 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/transfer-fee/structs.ts +134 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/update-guardian-set/structs.ts +201 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/upgrade-contract/structs.ts +201 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/vaa/structs.ts +72 -0
- package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/version-control/structs.ts +134 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/batch-price-attestation/structs.ts +136 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/contract-upgrade/structs.ts +136 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/data-source/structs.ts +70 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/event/structs.ts +135 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/governance/structs.ts +71 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/governance-action/structs.ts +69 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/governance-instruction/structs.ts +71 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/hot-potato-vector/structs.ts +72 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/i64/structs.ts +69 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/index.ts +1 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/init.ts +59 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/migrate/structs.ts +70 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price/structs.ts +70 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-feed/structs.ts +71 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-identifier/structs.ts +70 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-info/structs.ts +136 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-status/structs.ts +69 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set/structs.ts +138 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-data-sources/structs.ts +71 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-fee-recipient/structs.ts +69 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-governance-data-source/structs.ts +70 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-stale-price-threshold/structs.ts +69 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-update-fee/structs.ts +69 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/setup/structs.ts +70 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/state/structs.ts +203 -0
- package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/version-control/structs.ts +134 -0
- package/src/_framework/init-source.ts +39 -0
- package/src/_framework/loader.ts +69 -0
- package/src/_framework/reified.ts +442 -0
- package/src/_framework/util.ts +265 -0
- package/src/airdrop/authority-entry.ts +101 -0
- package/src/airdrop/index.ts +3 -0
- package/src/airdrop/user-entry.ts +24 -0
- package/src/airdrop/view-function.ts +36 -0
- package/src/auto-bid/index.ts +2 -0
- package/src/auto-bid/user-entry.ts +256 -0
- package/src/auto-bid/view-function.ts +285 -0
- package/src/constants/constant.ts +32 -0
- package/src/constants/index.ts +2 -0
- package/src/constants/token.ts +194 -0
- package/src/index.ts +11 -0
- package/src/leaderboard/authority-entry.ts +63 -0
- package/src/leaderboard/index.ts +2 -0
- package/src/leaderboard/view-function.ts +66 -0
- package/src/tails-exp-dice/api.ts +46 -0
- package/src/tails-exp-dice/fetch.ts +347 -0
- package/src/tails-exp-dice/index.ts +4 -0
- package/src/tails-exp-dice/user-entry.ts +241 -0
- package/src/tails-exp-dice/view-function.ts +111 -0
- package/src/tails-staking/authority-entry.ts +333 -0
- package/src/tails-staking/index.ts +3 -0
- package/src/tails-staking/user-entry.ts +401 -0
- package/src/tails-staking/view-function.ts +86 -0
- package/src/typus-dov-single-v2/entry/authority-entry.ts +171 -0
- package/src/typus-dov-single-v2/entry/index.ts +3 -0
- package/src/typus-dov-single-v2/entry/mfud-user-entry.ts +591 -0
- package/src/typus-dov-single-v2/entry/user-entry.ts +573 -0
- package/src/typus-dov-single-v2/function/bidding.ts +823 -0
- package/src/typus-dov-single-v2/function/index.ts +3 -0
- package/src/typus-dov-single-v2/function/token.ts +38 -0
- package/src/typus-dov-single-v2/function/vault.ts +24 -0
- package/src/typus-dov-single-v2/history/index.ts +2 -0
- package/src/typus-dov-single-v2/history/user-history.ts +929 -0
- package/src/typus-dov-single-v2/history/vault-history.ts +452 -0
- package/src/typus-dov-single-v2/index.ts +4 -0
- package/src/typus-dov-single-v2/view-function.ts +705 -0
- package/src/typus-nft/fetch.ts +428 -0
- package/src/typus-nft/index.ts +2 -0
- package/src/typus-nft/user-entry.ts +113 -0
- package/src/typus-perp/admin/functions.ts +141 -0
- package/src/typus-perp/admin/structs.ts +793 -0
- package/src/typus-perp/fetch.ts +253 -0
- package/src/typus-perp/index.ts +9 -0
- package/src/typus-perp/init.ts +96 -0
- package/src/typus-perp/lp-pool/functions.ts +694 -0
- package/src/typus-perp/lp-pool/structs.ts +3884 -0
- package/src/typus-perp/math/functions.ts +53 -0
- package/src/typus-perp/oracle/functions.ts +32 -0
- package/src/typus-perp/oracle/structs.ts +317 -0
- package/src/typus-perp/position/functions.ts +887 -0
- package/src/typus-perp/position/structs.ts +1637 -0
- package/src/typus-perp/readVec.ts +118 -0
- package/src/typus-perp/stake-pool/functions.ts +421 -0
- package/src/typus-perp/stake-pool/structs.ts +3873 -0
- package/src/typus-perp/symbol/functions.ts +24 -0
- package/src/typus-perp/symbol/structs.ts +165 -0
- package/src/typus-perp/tlp/functions.ts +50 -0
- package/src/typus-perp/tlp/structs.ts +287 -0
- package/src/typus-perp/token-interface/functions.ts +29 -0
- package/src/typus-perp/trading/functions.ts +1046 -0
- package/src/typus-perp/trading/structs.ts +4541 -0
- package/src/typus-perp/treasury-caps/functions.ts +36 -0
- package/src/typus-perp/treasury-caps/structs.ts +151 -0
- package/src/typus-perp/user/order.ts +221 -0
- package/src/typus-perp/user/orderWithBidReceipt.ts +176 -0
- package/src/typus-perp/user/tlp.ts +234 -0
- package/src/user/index.ts +1 -0
- package/src/user/view-function.ts +33 -0
- package/src/utils/.DS_Store +0 -0
- package/src/utils/api/defillama/index.ts +1 -0
- package/src/utils/api/defillama/tvl.ts +11 -0
- package/src/utils/api/index.ts +3 -0
- package/src/utils/api/price.ts +101 -0
- package/src/utils/api/sentio/index.ts +2 -0
- package/src/utils/api/sentio/leader-board.ts +259 -0
- package/src/utils/api/sentio/reward-generated.ts +392 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/load_env.ts +5 -0
- package/src/utils/mint.ts +16 -0
- package/src/utils/pyth/constant.ts +71 -0
- package/src/utils/pyth/index.ts +2 -0
- package/src/utils/pyth/pythClient.ts +52 -0
- package/src/utils/tools.ts +38 -0
|
@@ -0,0 +1,929 @@
|
|
|
1
|
+
import { EventId, SuiClient, SuiEvent, SuiEventFilter } from "@mysten/sui.js/client";
|
|
2
|
+
import { Vault } from "../view-function";
|
|
3
|
+
import { assetToDecimal, typeArgToAsset } from "src/constants/token";
|
|
4
|
+
import BigNumber from "bignumber.js";
|
|
5
|
+
|
|
6
|
+
export async function getUserEvents(
|
|
7
|
+
provider: SuiClient,
|
|
8
|
+
sender: string,
|
|
9
|
+
cursor?: EventId | null
|
|
10
|
+
): Promise<[SuiEvent[], EventId | null | undefined]> {
|
|
11
|
+
const senderFilter: SuiEventFilter = {
|
|
12
|
+
Sender: sender,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var hasNextPage = true;
|
|
16
|
+
|
|
17
|
+
const datas: SuiEvent[] = [];
|
|
18
|
+
|
|
19
|
+
while (hasNextPage) {
|
|
20
|
+
const result = await provider.queryEvents({
|
|
21
|
+
query: senderFilter,
|
|
22
|
+
order: "ascending",
|
|
23
|
+
cursor,
|
|
24
|
+
});
|
|
25
|
+
// console.log(result);
|
|
26
|
+
|
|
27
|
+
hasNextPage = result.hasNextPage;
|
|
28
|
+
cursor = result.nextCursor;
|
|
29
|
+
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
datas = datas.concat(result.data);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return [datas, cursor];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function getAutoBidEvents(provider: SuiClient, originPackage: string, startTimeMs: number): Promise<SuiEvent[]> {
|
|
38
|
+
const moduleFilter: SuiEventFilter = {
|
|
39
|
+
MoveModule: { package: originPackage, module: "auto_bid" },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var hasNextPage = true;
|
|
43
|
+
var cursor: any | undefined = undefined;
|
|
44
|
+
|
|
45
|
+
const datas: SuiEvent[] = [];
|
|
46
|
+
|
|
47
|
+
while (hasNextPage) {
|
|
48
|
+
const result = await provider.queryEvents({
|
|
49
|
+
query: moduleFilter,
|
|
50
|
+
order: "descending",
|
|
51
|
+
cursor,
|
|
52
|
+
});
|
|
53
|
+
// console.log(result);
|
|
54
|
+
|
|
55
|
+
hasNextPage = result.hasNextPage;
|
|
56
|
+
cursor = result.nextCursor;
|
|
57
|
+
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
datas = datas.concat(result.data);
|
|
60
|
+
|
|
61
|
+
if (hasNextPage && Number(result.data[result.data.length - 1].timestampMs) < startTimeMs) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return datas;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface TxHistory {
|
|
70
|
+
Index: string | undefined;
|
|
71
|
+
Action: string | undefined;
|
|
72
|
+
Period: string | undefined;
|
|
73
|
+
Amount: string | undefined;
|
|
74
|
+
Vault: string | undefined;
|
|
75
|
+
RiskLevel: string | undefined;
|
|
76
|
+
Tails: string | undefined;
|
|
77
|
+
Exp: string | undefined;
|
|
78
|
+
Date: Date;
|
|
79
|
+
txDigest: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function parseTxHistory(
|
|
83
|
+
datas: Array<any>,
|
|
84
|
+
originPackage: string,
|
|
85
|
+
vaults: { [key: string]: Vault }
|
|
86
|
+
): Promise<Array<TxHistory>> {
|
|
87
|
+
const results = await datas
|
|
88
|
+
.filter((event) => {
|
|
89
|
+
const type: string = event.type;
|
|
90
|
+
return (
|
|
91
|
+
event.packageId == originPackage ||
|
|
92
|
+
type.includes("typus_nft::First") ||
|
|
93
|
+
type.includes("typus_nft::ExpUpEvent") ||
|
|
94
|
+
type.includes("tails_staking")
|
|
95
|
+
);
|
|
96
|
+
})
|
|
97
|
+
.sort((a, b) => {
|
|
98
|
+
// From Old to New!
|
|
99
|
+
if (a.timestampMs == b.timestampMs) {
|
|
100
|
+
return Number(a.id.eventSeq) - Number(b.id.eventSeq);
|
|
101
|
+
} else {
|
|
102
|
+
return Number(a.timestampMs) - Number(b.timestampMs);
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
.reduce(async (promise, event) => {
|
|
106
|
+
let txHistory: TxHistory[] = await promise;
|
|
107
|
+
// console.log(event);
|
|
108
|
+
const functionType = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type)?.slice(1, 4)!;
|
|
109
|
+
const action = functionType[2];
|
|
110
|
+
|
|
111
|
+
let Action: string | undefined;
|
|
112
|
+
let Amount: string | undefined;
|
|
113
|
+
let Index: string | undefined;
|
|
114
|
+
let Period: string | undefined;
|
|
115
|
+
let Vault: string | undefined;
|
|
116
|
+
let RiskLevel: string | undefined;
|
|
117
|
+
var Tails: string | undefined = undefined;
|
|
118
|
+
let Exp: string | undefined;
|
|
119
|
+
var d_token: string | undefined;
|
|
120
|
+
var b_token: string | undefined;
|
|
121
|
+
var o_token: string | undefined;
|
|
122
|
+
|
|
123
|
+
Index = event.parsedJson!.index || event.parsedJson!.vault_index;
|
|
124
|
+
if (Index) {
|
|
125
|
+
[Period, Vault, RiskLevel, d_token, b_token, o_token] = parseVaultInfo(vaults, Index, action, event.parsedJson!.log);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
switch (action) {
|
|
129
|
+
// new version events
|
|
130
|
+
case "StakeTailsEvent":
|
|
131
|
+
Action = "Stake";
|
|
132
|
+
Amount = "0.05 SUI";
|
|
133
|
+
Tails = `#${event.parsedJson!.log[0]}`;
|
|
134
|
+
break;
|
|
135
|
+
case "UnstakeTailsEvent":
|
|
136
|
+
Action = "Unstake";
|
|
137
|
+
Tails = `#${event.parsedJson!.log[0]}`;
|
|
138
|
+
break;
|
|
139
|
+
case "DailySignUpEvent":
|
|
140
|
+
Action = "Check In";
|
|
141
|
+
Tails = event.parsedJson!.tails.map((num) => `#${num}`).join(" ");
|
|
142
|
+
Exp = event.parsedJson!.log[0];
|
|
143
|
+
break;
|
|
144
|
+
case "TransferTailsEvent":
|
|
145
|
+
Action = "Transfer";
|
|
146
|
+
Amount = "0.01 SUI";
|
|
147
|
+
Tails = `#${event.parsedJson!.log[0]}`;
|
|
148
|
+
break;
|
|
149
|
+
case "ExpUpEvent":
|
|
150
|
+
if (event.parsedJson!.log) {
|
|
151
|
+
Action = "Train Tail";
|
|
152
|
+
Tails = `#${event.parsedJson!.log[0]}`;
|
|
153
|
+
Exp = event.parsedJson!.log[1];
|
|
154
|
+
if (Number(Exp) == 0) {
|
|
155
|
+
return txHistory;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
case "LevelUpEvent":
|
|
160
|
+
if (event.parsedJson!.log) {
|
|
161
|
+
Action = `Level Up to Level ${event.parsedJson!.log[1]}`;
|
|
162
|
+
Tails = `#${event.parsedJson!.log[0]}`;
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
case "ClaimProfitSharingEvent":
|
|
166
|
+
if (event.parsedJson!.profit_asset) {
|
|
167
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.profit_asset.name);
|
|
168
|
+
var amount = Number(event.parsedJson!.log[0]) / 10 ** assetToDecimal(token)!;
|
|
169
|
+
Action = "Harvest Dice Profit";
|
|
170
|
+
Tails = event.parsedJson!.tails.map((num) => `#${num}`).join(" ");
|
|
171
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
// old version events
|
|
175
|
+
case "StakeNftEvent":
|
|
176
|
+
Action = "Stake";
|
|
177
|
+
Amount = "0.05 SUI";
|
|
178
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
179
|
+
break;
|
|
180
|
+
case "UnstakeNftEvent":
|
|
181
|
+
Action = "Unstake";
|
|
182
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
183
|
+
break;
|
|
184
|
+
case "ExpUpEvent":
|
|
185
|
+
var i = txHistory.findIndex(
|
|
186
|
+
(x) => x.txDigest == event.id.txDigest && x.Action != "First Deposit" && x.Action != "Stake"
|
|
187
|
+
);
|
|
188
|
+
if (i != -1 && txHistory[i].Tails == undefined) {
|
|
189
|
+
txHistory[i].Tails = `#${event.parsedJson!.number}`;
|
|
190
|
+
txHistory[i].Exp = event.parsedJson!.exp_earn;
|
|
191
|
+
return txHistory;
|
|
192
|
+
} else if (event.id.eventSeq == 0) {
|
|
193
|
+
Action = "Collect EXP";
|
|
194
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
195
|
+
Exp = event.parsedJson!.exp_earn;
|
|
196
|
+
} else {
|
|
197
|
+
return txHistory;
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
case "TransferNftEvent":
|
|
201
|
+
Action = "Transfer";
|
|
202
|
+
Amount = "0.01 SUI";
|
|
203
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
204
|
+
break;
|
|
205
|
+
case "DailyAttendEvent":
|
|
206
|
+
var i = txHistory.findIndex((x) => x.txDigest == event.id.txDigest && x.Action == "Collect EXP");
|
|
207
|
+
if (i != -1) {
|
|
208
|
+
txHistory[i].Action = "Check In";
|
|
209
|
+
return txHistory;
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
case "FirstDepositEvent":
|
|
213
|
+
Action = "First Deposit";
|
|
214
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
215
|
+
Exp = event.parsedJson!.exp_earn;
|
|
216
|
+
break;
|
|
217
|
+
case "FirstBidEvent":
|
|
218
|
+
Action = "First Bid";
|
|
219
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
220
|
+
Exp = event.parsedJson!.exp_earn;
|
|
221
|
+
break;
|
|
222
|
+
case "LevelUpEvent":
|
|
223
|
+
Action = `Level Up to Level ${event.parsedJson!.level}`;
|
|
224
|
+
if (event.parsedJson!.number) {
|
|
225
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
226
|
+
break;
|
|
227
|
+
} else {
|
|
228
|
+
return txHistory;
|
|
229
|
+
}
|
|
230
|
+
case "DepositEvent":
|
|
231
|
+
case "WithdrawEvent":
|
|
232
|
+
case "UnsubscribeEvent":
|
|
233
|
+
case "ClaimEvent":
|
|
234
|
+
case "CompoundEvent":
|
|
235
|
+
case "HarvestEvent":
|
|
236
|
+
var i = txHistory.findIndex((x) => x.txDigest == event.id.txDigest && x.Action == "Collect EXP");
|
|
237
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.token.name);
|
|
238
|
+
var amount = Number(event.parsedJson!.amount) / 10 ** Number(event.parsedJson!.decimal);
|
|
239
|
+
Action = action.slice(0, action.length - 5);
|
|
240
|
+
if (Action == "Harvest") {
|
|
241
|
+
Action = "Harvest Reward";
|
|
242
|
+
}
|
|
243
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
244
|
+
Index = Index;
|
|
245
|
+
if (i != -1) {
|
|
246
|
+
txHistory[i].Action = Action;
|
|
247
|
+
txHistory[i].Amount = Amount;
|
|
248
|
+
txHistory[i].Vault = Vault;
|
|
249
|
+
txHistory[i].RiskLevel = RiskLevel;
|
|
250
|
+
txHistory[i].Index = Index;
|
|
251
|
+
return txHistory;
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
case "RaiseFundEvent":
|
|
255
|
+
Index = event.parsedJson!.log[0];
|
|
256
|
+
[Period, Vault, RiskLevel, d_token, b_token, o_token] = parseVaultInfo(vaults, Index!, action, event.parsedJson!.log);
|
|
257
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.token.name);
|
|
258
|
+
if (event.parsedJson!.log[4] > 0) {
|
|
259
|
+
// deposit
|
|
260
|
+
Action = "Deposit";
|
|
261
|
+
var amount = Number(event.parsedJson!.log[4]) / 10 ** assetToDecimal(token)!;
|
|
262
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
263
|
+
} else if (event.parsedJson!.log[5] > 0) {
|
|
264
|
+
// compound
|
|
265
|
+
Action = "Compound";
|
|
266
|
+
var amount = Number(event.parsedJson!.log[5]) / 10 ** assetToDecimal(token)!;
|
|
267
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
268
|
+
}
|
|
269
|
+
break;
|
|
270
|
+
case "ReduceFundEvent":
|
|
271
|
+
Index = event.parsedJson!.log[0];
|
|
272
|
+
[Period, Vault, RiskLevel, d_token, b_token, o_token] = parseVaultInfo(vaults, Index!, action, event.parsedJson!.log);
|
|
273
|
+
if (event.parsedJson!.log[4] > 0) {
|
|
274
|
+
// withdraw
|
|
275
|
+
Action = "Withdraw";
|
|
276
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.d_token.name);
|
|
277
|
+
var amount = Number(event.parsedJson!.log[4]) / 10 ** assetToDecimal(token)!;
|
|
278
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
279
|
+
txHistory.push({
|
|
280
|
+
Index,
|
|
281
|
+
Period,
|
|
282
|
+
Action,
|
|
283
|
+
Amount,
|
|
284
|
+
Vault,
|
|
285
|
+
RiskLevel,
|
|
286
|
+
Tails,
|
|
287
|
+
Exp,
|
|
288
|
+
Date: new Date(Number(event.timestampMs)),
|
|
289
|
+
txDigest: event.id.txDigest,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
if (event.parsedJson!.log[5] > 0) {
|
|
293
|
+
// unsubscribe
|
|
294
|
+
Action = "Unsubscribe";
|
|
295
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.d_token.name);
|
|
296
|
+
var amount = Number(event.parsedJson!.log[5]) / 10 ** assetToDecimal(token)!;
|
|
297
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
298
|
+
txHistory.push({
|
|
299
|
+
Index,
|
|
300
|
+
Period,
|
|
301
|
+
Action,
|
|
302
|
+
Amount,
|
|
303
|
+
Vault,
|
|
304
|
+
RiskLevel,
|
|
305
|
+
Tails,
|
|
306
|
+
Exp,
|
|
307
|
+
Date: new Date(Number(event.timestampMs)),
|
|
308
|
+
txDigest: event.id.txDigest,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
if (event.parsedJson!.log[9] > 0) {
|
|
312
|
+
// claim
|
|
313
|
+
Action = "Claim";
|
|
314
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.d_token.name);
|
|
315
|
+
var amount = Number(event.parsedJson!.log[9]) / 10 ** assetToDecimal(token)!;
|
|
316
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
317
|
+
txHistory.push({
|
|
318
|
+
Index,
|
|
319
|
+
Period,
|
|
320
|
+
Action,
|
|
321
|
+
Amount,
|
|
322
|
+
Vault,
|
|
323
|
+
RiskLevel,
|
|
324
|
+
Tails,
|
|
325
|
+
Exp,
|
|
326
|
+
Date: new Date(Number(event.timestampMs)),
|
|
327
|
+
txDigest: event.id.txDigest,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
if (event.parsedJson!.log[6] > 0 && event.parsedJson!.log[10] > 0) {
|
|
331
|
+
// Harvest d token and i token
|
|
332
|
+
Action = "Harvest Reward";
|
|
333
|
+
var b_token_name = typeArgToAsset("0x" + event.parsedJson!.b_token.name);
|
|
334
|
+
var b_token_amount = Number(event.parsedJson!.log[6]) / 10 ** assetToDecimal(b_token_name)!;
|
|
335
|
+
|
|
336
|
+
var i_token_name = typeArgToAsset("0x" + event.parsedJson!.i_token.name);
|
|
337
|
+
var i_token_amount = Number(event.parsedJson!.log[10]) / 10 ** assetToDecimal(i_token_name)!;
|
|
338
|
+
|
|
339
|
+
Amount = `${BigNumber(b_token_amount).toFixed()} ${b_token_name!}\n${BigNumber(i_token_amount).toFixed()} ${i_token_name!}`;
|
|
340
|
+
|
|
341
|
+
// var amount =
|
|
342
|
+
// Number(event.parsedJson!.log[6]) / 10 ** assetToDecimal(token)!
|
|
343
|
+
// Number(event.parsedJson!.log[10]) / 10 ** assetToDecimal(token)!;
|
|
344
|
+
// Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
345
|
+
txHistory.push({
|
|
346
|
+
Index,
|
|
347
|
+
Period,
|
|
348
|
+
Action,
|
|
349
|
+
Amount,
|
|
350
|
+
Vault,
|
|
351
|
+
RiskLevel,
|
|
352
|
+
Tails,
|
|
353
|
+
Exp,
|
|
354
|
+
Date: new Date(Number(event.timestampMs)),
|
|
355
|
+
txDigest: event.id.txDigest,
|
|
356
|
+
});
|
|
357
|
+
} else {
|
|
358
|
+
if (event.parsedJson!.log[6] > 0) {
|
|
359
|
+
// harvest
|
|
360
|
+
Action = "Harvest Reward";
|
|
361
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.b_token.name);
|
|
362
|
+
var amount = Number(event.parsedJson!.log[6]) / 10 ** assetToDecimal(token)!;
|
|
363
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
364
|
+
txHistory.push({
|
|
365
|
+
Index,
|
|
366
|
+
Period,
|
|
367
|
+
Action,
|
|
368
|
+
Amount,
|
|
369
|
+
Vault,
|
|
370
|
+
RiskLevel,
|
|
371
|
+
Tails,
|
|
372
|
+
Exp,
|
|
373
|
+
Date: new Date(Number(event.timestampMs)),
|
|
374
|
+
txDigest: event.id.txDigest,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
if (event.parsedJson!.log[10] > 0) {
|
|
378
|
+
// redeem
|
|
379
|
+
Action = "Harvest Reward";
|
|
380
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.i_token.name);
|
|
381
|
+
var amount = Number(event.parsedJson!.log[10]) / 10 ** assetToDecimal(token)!;
|
|
382
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
383
|
+
txHistory.push({
|
|
384
|
+
Index,
|
|
385
|
+
Period,
|
|
386
|
+
Action,
|
|
387
|
+
Amount,
|
|
388
|
+
Vault,
|
|
389
|
+
RiskLevel,
|
|
390
|
+
Tails,
|
|
391
|
+
Exp,
|
|
392
|
+
Date: new Date(Number(event.timestampMs)),
|
|
393
|
+
txDigest: event.id.txDigest,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return txHistory;
|
|
399
|
+
case "NewStrategyEventV2":
|
|
400
|
+
Action = "Create Strategy";
|
|
401
|
+
var deposit_amount = Number(event.parsedJson!.deposit_amount) / 10 ** assetToDecimal(b_token!)!;
|
|
402
|
+
Amount = `${BigNumber(deposit_amount).toFixed()} ${b_token!}`;
|
|
403
|
+
break;
|
|
404
|
+
case "UpdateStrategyEvent":
|
|
405
|
+
Action = "Update Strategy";
|
|
406
|
+
var deposit_amount = Number(event.parsedJson!.deposit_amount) / 10 ** assetToDecimal(b_token!)!;
|
|
407
|
+
Amount = `${BigNumber(deposit_amount).toFixed()} ${b_token!}`;
|
|
408
|
+
break;
|
|
409
|
+
case "CloseStrategyEventV2":
|
|
410
|
+
Action = "Close Strategy";
|
|
411
|
+
if (b_token == d_token) {
|
|
412
|
+
var balance =
|
|
413
|
+
(Number(event.parsedJson!.u64_padding[0]) + Number(event.parsedJson!.u64_padding[1])) /
|
|
414
|
+
10 ** assetToDecimal(b_token!)!;
|
|
415
|
+
Amount = `${BigNumber(balance).toFixed()} ${b_token!}`;
|
|
416
|
+
} else {
|
|
417
|
+
var balance = Number(event.parsedJson!.u64_padding[0]) / 10 ** assetToDecimal(b_token!)!;
|
|
418
|
+
var profit = Number(event.parsedJson!.u64_padding[1]) / 10 ** assetToDecimal(d_token!)!;
|
|
419
|
+
Amount = `${BigNumber(balance).toFixed()} ${b_token!}\n${BigNumber(profit).toFixed()} ${d_token!}`;
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
422
|
+
case "WithdrawProfitEvent":
|
|
423
|
+
Action = "Harvest Gain";
|
|
424
|
+
var profit = Number(event.parsedJson!.profit) / 10 ** assetToDecimal(d_token!)!;
|
|
425
|
+
Amount = `${BigNumber(profit).toFixed()} ${d_token!}`;
|
|
426
|
+
break;
|
|
427
|
+
case "RedeemEvent":
|
|
428
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.token.name);
|
|
429
|
+
var amount = Number(event.parsedJson!.amount) / 10 ** assetToDecimal(token)!;
|
|
430
|
+
Action = "Harvest Reward";
|
|
431
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
432
|
+
Index = Index;
|
|
433
|
+
break;
|
|
434
|
+
case "TransferBidReceiptEvent":
|
|
435
|
+
var amount = Number(event.parsedJson!.amount) / 10 ** Number(event.parsedJson!.decimal);
|
|
436
|
+
Action = "Transfer Receipt";
|
|
437
|
+
Amount = `${BigNumber(amount).toFixed()} ${o_token}`;
|
|
438
|
+
break;
|
|
439
|
+
case "ExerciseEvent":
|
|
440
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.token.name);
|
|
441
|
+
var amount = Number(event.parsedJson!.amount) / 10 ** Number(event.parsedJson!.decimal);
|
|
442
|
+
Action = "Exercise";
|
|
443
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
444
|
+
if (event.parsedJson!.u64_padding[0]) {
|
|
445
|
+
var size = Number(event.parsedJson!.u64_padding[0]) / 10 ** assetToDecimal(o_token!)!;
|
|
446
|
+
Action = `Exercise ${size} ${o_token}`;
|
|
447
|
+
}
|
|
448
|
+
if (event.sender != event.parsedJson!.signer) {
|
|
449
|
+
Action = "Auto " + Action;
|
|
450
|
+
}
|
|
451
|
+
break;
|
|
452
|
+
case "RefundEvent":
|
|
453
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.token.name);
|
|
454
|
+
var amount = Number(event.parsedJson!.amount) / 10 ** assetToDecimal(token)!;
|
|
455
|
+
Action = "Rebate";
|
|
456
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
457
|
+
break;
|
|
458
|
+
// case "ClaimProfitSharingEvent":
|
|
459
|
+
// var token = typeArgToAsset("0x" + event.parsedJson!.token.name);
|
|
460
|
+
// var amount = Number(event.parsedJson!.value) / 10 ** assetToDecimal(token)!;
|
|
461
|
+
// Action = "Claim Profit Sharing";
|
|
462
|
+
// Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
463
|
+
// Tails = `#${event.parsedJson!.number}`;
|
|
464
|
+
// break;
|
|
465
|
+
case "ClaimProfitSharingEventV2":
|
|
466
|
+
var token = typeArgToAsset("0x" + event.parsedJson!.token.name);
|
|
467
|
+
var amount = Number(event.parsedJson!.value) / 10 ** assetToDecimal(token)!;
|
|
468
|
+
// dice_profit, exp_profit
|
|
469
|
+
// TODO: filter amount != 0
|
|
470
|
+
switch (event.parsedJson!.name) {
|
|
471
|
+
case "dice_profit":
|
|
472
|
+
Action = "Harvest Dice Profit";
|
|
473
|
+
break;
|
|
474
|
+
case "exp_profit":
|
|
475
|
+
Action = "Harvest Leaderboard Prize";
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
479
|
+
Tails = `#${event.parsedJson!.number}`;
|
|
480
|
+
break;
|
|
481
|
+
case "NewBidEvent":
|
|
482
|
+
o_token = typeArgToAsset("0x" + event.parsedJson!.o_token.name);
|
|
483
|
+
b_token = typeArgToAsset("0x" + event.parsedJson!.b_token.name);
|
|
484
|
+
|
|
485
|
+
var size = Number(event.parsedJson!.size) / 10 ** assetToDecimal(o_token)!;
|
|
486
|
+
var bidder_balance = Number(event.parsedJson!.bidder_balance) / 10 ** assetToDecimal(b_token)!;
|
|
487
|
+
|
|
488
|
+
Action = action.slice(0, action.length - 5) + ` ${size} ${o_token}`;
|
|
489
|
+
Amount = `${BigNumber(bidder_balance).toFixed()} ${b_token}`;
|
|
490
|
+
|
|
491
|
+
if (event.sender != event.parsedJson!.signer) {
|
|
492
|
+
Action = "Auto " + Action;
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
default:
|
|
496
|
+
return txHistory;
|
|
497
|
+
}
|
|
498
|
+
txHistory.push({
|
|
499
|
+
Index,
|
|
500
|
+
Period,
|
|
501
|
+
Action,
|
|
502
|
+
Amount,
|
|
503
|
+
Vault,
|
|
504
|
+
RiskLevel,
|
|
505
|
+
Tails,
|
|
506
|
+
Exp,
|
|
507
|
+
Date: new Date(Number(event.timestampMs)),
|
|
508
|
+
txDigest: event.id.txDigest,
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
return txHistory;
|
|
512
|
+
}, Promise.resolve(new Array<TxHistory>()));
|
|
513
|
+
|
|
514
|
+
return results.filter((result) => result.Action);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export async function getFromSentio(event: string, userAddress: string, startTimestamp: string): Promise<any[]> {
|
|
518
|
+
const apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
519
|
+
|
|
520
|
+
const headers = {
|
|
521
|
+
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
522
|
+
"Content-Type": "application/json",
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
const requestData = {
|
|
526
|
+
sqlQuery: {
|
|
527
|
+
sql: `
|
|
528
|
+
SELECT *
|
|
529
|
+
FROM ${event}
|
|
530
|
+
WHERE distinct_id = "${userAddress}" && timestamp >= ${startTimestamp}
|
|
531
|
+
ORDER BY timestamp DESC;
|
|
532
|
+
`,
|
|
533
|
+
size: 1000,
|
|
534
|
+
},
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
const jsonData = JSON.stringify(requestData);
|
|
538
|
+
|
|
539
|
+
let response = await fetch(apiUrl, {
|
|
540
|
+
method: "POST",
|
|
541
|
+
headers,
|
|
542
|
+
body: jsonData,
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
let data = await response.json();
|
|
546
|
+
|
|
547
|
+
return data.result.rows as any[];
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
export async function getNewBidFromSentio(vaults: { [key: string]: Vault }, userAddress: string, startTimestamp: number) {
|
|
551
|
+
const apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
552
|
+
|
|
553
|
+
const headers = {
|
|
554
|
+
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
555
|
+
"Content-Type": "application/json",
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
const requestData = {
|
|
559
|
+
sqlQuery: {
|
|
560
|
+
sql: `
|
|
561
|
+
SELECT *
|
|
562
|
+
FROM NewBid N
|
|
563
|
+
LEFT JOIN (
|
|
564
|
+
SELECT number, distinct_id, exp_earn, transaction_hash, log_index
|
|
565
|
+
FROM ExpUp
|
|
566
|
+
) S ON N.transaction_hash = S.transaction_hash && N.log_index + 1 = S.log_index
|
|
567
|
+
WHERE N.distinct_id = "${userAddress}" && N.timestamp >= ${startTimestamp}
|
|
568
|
+
ORDER BY N.timestamp DESC;
|
|
569
|
+
`,
|
|
570
|
+
size: 1000,
|
|
571
|
+
},
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
const jsonData = JSON.stringify(requestData);
|
|
575
|
+
|
|
576
|
+
let response = await fetch(apiUrl, {
|
|
577
|
+
method: "POST",
|
|
578
|
+
headers,
|
|
579
|
+
body: jsonData,
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
let data = await response.json();
|
|
583
|
+
|
|
584
|
+
return data.result.rows.map((x) => {
|
|
585
|
+
let [Period, Vault, RiskLevel, d_token, b_token, o_token] = parseVaultInfo(vaults, x.index, "NewBidEvent");
|
|
586
|
+
|
|
587
|
+
if (x.number == "0" && x.exp_earn == "0") {
|
|
588
|
+
x.number = undefined;
|
|
589
|
+
x.exp_earn = undefined;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
let txHistory: TxHistory = {
|
|
593
|
+
Index: x.index,
|
|
594
|
+
Period,
|
|
595
|
+
Vault,
|
|
596
|
+
RiskLevel,
|
|
597
|
+
Action: "Auto Bid" + ` ${x.size} ${x.o_token}`,
|
|
598
|
+
Amount: x.bidder_balance + ` ${x.b_token}`,
|
|
599
|
+
Tails: x.number,
|
|
600
|
+
Exp: x.exp_earn,
|
|
601
|
+
Date: new Date(Number(x.ts_ms)),
|
|
602
|
+
txDigest: x.transaction_hash,
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
return txHistory;
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export async function getExerciseFromSentio(vaults: { [key: string]: Vault }, userAddress: string, startTimestamp: number) {
|
|
610
|
+
const apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
611
|
+
|
|
612
|
+
const headers = {
|
|
613
|
+
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
614
|
+
"Content-Type": "application/json",
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
const requestData = {
|
|
618
|
+
sqlQuery: {
|
|
619
|
+
sql: `
|
|
620
|
+
SELECT *
|
|
621
|
+
FROM Exercise N
|
|
622
|
+
WHERE N.distinct_id = "${userAddress}" && N.timestamp >= ${startTimestamp}
|
|
623
|
+
ORDER BY N.timestamp DESC;
|
|
624
|
+
`,
|
|
625
|
+
size: 1000,
|
|
626
|
+
},
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
const jsonData = JSON.stringify(requestData);
|
|
630
|
+
|
|
631
|
+
let response = await fetch(apiUrl, {
|
|
632
|
+
method: "POST",
|
|
633
|
+
headers,
|
|
634
|
+
body: jsonData,
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
let data = await response.json();
|
|
638
|
+
|
|
639
|
+
return data.result.rows.map((x) => {
|
|
640
|
+
let [Period, Vault, RiskLevel, d_token, b_token, o_token] = parseVaultInfo(vaults, x.index, "ExerciseEvent");
|
|
641
|
+
|
|
642
|
+
// console.log(x);
|
|
643
|
+
var Action = "Auto Exercise";
|
|
644
|
+
if (x.raw_share) {
|
|
645
|
+
var size = Number(x.raw_share) / 10 ** assetToDecimal(o_token!)!;
|
|
646
|
+
Action = `Auto Exercise ${size} ${o_token}`;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
let txHistory: TxHistory = {
|
|
650
|
+
Index: x.index,
|
|
651
|
+
Period,
|
|
652
|
+
Vault,
|
|
653
|
+
RiskLevel,
|
|
654
|
+
Action,
|
|
655
|
+
Amount: `${x.amount} ${x.coin_symbol}`,
|
|
656
|
+
Tails: x.number,
|
|
657
|
+
Exp: x.exp_earn,
|
|
658
|
+
Date: new Date(x.timestamp),
|
|
659
|
+
txDigest: x.transaction_hash,
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
return txHistory;
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function parseVaultInfo(vaults: { [key: string]: Vault }, Index: string, action: string, eventLog?: string[]) {
|
|
667
|
+
let v = vaults[Index];
|
|
668
|
+
|
|
669
|
+
let Period: string | undefined;
|
|
670
|
+
let Vault: string | undefined;
|
|
671
|
+
let RiskLevel: string | undefined;
|
|
672
|
+
var d_token: string | undefined;
|
|
673
|
+
var b_token: string | undefined;
|
|
674
|
+
var o_token: string | undefined;
|
|
675
|
+
|
|
676
|
+
let period: string;
|
|
677
|
+
|
|
678
|
+
if (v) {
|
|
679
|
+
switch (v.info.period) {
|
|
680
|
+
case "0":
|
|
681
|
+
period = "Daily";
|
|
682
|
+
break;
|
|
683
|
+
case "1":
|
|
684
|
+
period = "Weekly";
|
|
685
|
+
break;
|
|
686
|
+
case "2":
|
|
687
|
+
period = "Monthly";
|
|
688
|
+
break;
|
|
689
|
+
case "3":
|
|
690
|
+
period = "Hourly";
|
|
691
|
+
break;
|
|
692
|
+
case "4":
|
|
693
|
+
period = "10 Minutes";
|
|
694
|
+
break;
|
|
695
|
+
default:
|
|
696
|
+
period = "";
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
Period = period;
|
|
700
|
+
let optionType: string;
|
|
701
|
+
switch (v.info.optionType) {
|
|
702
|
+
case "0":
|
|
703
|
+
switch (action) {
|
|
704
|
+
case "DepositEvent":
|
|
705
|
+
case "WithdrawEvent":
|
|
706
|
+
case "UnsubscribeEvent":
|
|
707
|
+
case "ClaimEvent":
|
|
708
|
+
case "CompoundEvent":
|
|
709
|
+
case "HarvestEvent":
|
|
710
|
+
case "RedeemEvent":
|
|
711
|
+
case "ReduceFundEvent":
|
|
712
|
+
case "RaiseFundEvent":
|
|
713
|
+
optionType = "Covered Call";
|
|
714
|
+
break;
|
|
715
|
+
default:
|
|
716
|
+
optionType = "Call";
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
break;
|
|
720
|
+
case "1":
|
|
721
|
+
switch (action) {
|
|
722
|
+
case "DepositEvent":
|
|
723
|
+
case "WithdrawEvent":
|
|
724
|
+
case "UnsubscribeEvent":
|
|
725
|
+
case "ClaimEvent":
|
|
726
|
+
case "CompoundEvent":
|
|
727
|
+
case "HarvestEvent":
|
|
728
|
+
case "RedeemEvent":
|
|
729
|
+
case "ReduceFundEvent":
|
|
730
|
+
case "RaiseFundEvent":
|
|
731
|
+
optionType = "Put Selling";
|
|
732
|
+
break;
|
|
733
|
+
default:
|
|
734
|
+
optionType = "Put";
|
|
735
|
+
break;
|
|
736
|
+
}
|
|
737
|
+
break;
|
|
738
|
+
case "2":
|
|
739
|
+
optionType = "Call Spread";
|
|
740
|
+
break;
|
|
741
|
+
case "3":
|
|
742
|
+
optionType = "Put Spread";
|
|
743
|
+
break;
|
|
744
|
+
case "4":
|
|
745
|
+
optionType = "Capped Call";
|
|
746
|
+
break;
|
|
747
|
+
case "5":
|
|
748
|
+
optionType = "Capped Put";
|
|
749
|
+
break;
|
|
750
|
+
case "6":
|
|
751
|
+
switch (action) {
|
|
752
|
+
case "DepositEvent":
|
|
753
|
+
case "WithdrawEvent":
|
|
754
|
+
case "UnsubscribeEvent":
|
|
755
|
+
case "ClaimEvent":
|
|
756
|
+
case "CompoundEvent":
|
|
757
|
+
case "HarvestEvent":
|
|
758
|
+
case "RedeemEvent":
|
|
759
|
+
case "ReduceFundEvent":
|
|
760
|
+
case "RaiseFundEvent":
|
|
761
|
+
// for depositor
|
|
762
|
+
optionType = "Call Selling";
|
|
763
|
+
break;
|
|
764
|
+
default:
|
|
765
|
+
// for bidder
|
|
766
|
+
optionType = "Capped Call";
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
break;
|
|
770
|
+
default:
|
|
771
|
+
optionType = "";
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
switch (v.config.riskLevel) {
|
|
775
|
+
case "1":
|
|
776
|
+
RiskLevel = "Conservative";
|
|
777
|
+
break;
|
|
778
|
+
case "2":
|
|
779
|
+
RiskLevel = "Moderate";
|
|
780
|
+
break;
|
|
781
|
+
case "3":
|
|
782
|
+
RiskLevel = "Aggressive";
|
|
783
|
+
break;
|
|
784
|
+
default:
|
|
785
|
+
RiskLevel = "";
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
Vault = `${v.info.settlementBaseName} ${period} ${optionType}`;
|
|
789
|
+
d_token = typeArgToAsset("0x" + v.info.depositToken);
|
|
790
|
+
b_token = typeArgToAsset("0x" + v.info.bidToken);
|
|
791
|
+
o_token = typeArgToAsset("0x" + v.info.settlementBase);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
return [Period, Vault, RiskLevel, d_token, b_token, o_token];
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
export function getDepositorCashFlows(userHistory: TxHistory[]) {
|
|
798
|
+
let depositorCashFlows = new Map<string, DepositorCashFlow>();
|
|
799
|
+
|
|
800
|
+
for (let history of userHistory) {
|
|
801
|
+
const index = history.Index!;
|
|
802
|
+
|
|
803
|
+
if (history.Action!.startsWith("Harvest Reward")) {
|
|
804
|
+
let historyAmounts = history.Amount?.split("\n")!;
|
|
805
|
+
for (let historyAmount of historyAmounts) {
|
|
806
|
+
const [amount, token] = historyAmount.split(" ")!;
|
|
807
|
+
if (depositorCashFlows.has(index)) {
|
|
808
|
+
let depositorCashFlow = depositorCashFlows.get(index)!;
|
|
809
|
+
let totalHarvest = depositorCashFlow.totalHarvest;
|
|
810
|
+
if (totalHarvest.has(token)) {
|
|
811
|
+
let sum = totalHarvest.get(token)!;
|
|
812
|
+
totalHarvest.set(token, sum + Number(amount));
|
|
813
|
+
} else {
|
|
814
|
+
totalHarvest.set(token, Number(amount));
|
|
815
|
+
}
|
|
816
|
+
depositorCashFlow.totalHarvest = totalHarvest;
|
|
817
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
818
|
+
} else {
|
|
819
|
+
let totalHarvest = new Map();
|
|
820
|
+
totalHarvest.set(token, Number(amount));
|
|
821
|
+
let depositorCashFlow: DepositorCashFlow = {
|
|
822
|
+
D_TOKEN: undefined,
|
|
823
|
+
totalDeposit: 0,
|
|
824
|
+
totalWithdraw: 0,
|
|
825
|
+
totalClaim: 0,
|
|
826
|
+
totalCompound: 0,
|
|
827
|
+
netDeposit: undefined,
|
|
828
|
+
totalHarvest,
|
|
829
|
+
};
|
|
830
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
} else if (history.Action!.startsWith("Deposit")) {
|
|
834
|
+
const [amount, token] = history.Amount?.split(" ")!;
|
|
835
|
+
if (depositorCashFlows.has(index)) {
|
|
836
|
+
let depositorCashFlow = depositorCashFlows.get(index)!;
|
|
837
|
+
depositorCashFlow.D_TOKEN = token;
|
|
838
|
+
depositorCashFlow.totalDeposit += Number(amount);
|
|
839
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
840
|
+
} else {
|
|
841
|
+
let depositorCashFlow: DepositorCashFlow = {
|
|
842
|
+
D_TOKEN: token,
|
|
843
|
+
totalDeposit: Number(amount),
|
|
844
|
+
totalWithdraw: 0,
|
|
845
|
+
totalClaim: 0,
|
|
846
|
+
totalCompound: 0,
|
|
847
|
+
netDeposit: undefined,
|
|
848
|
+
totalHarvest: new Map(),
|
|
849
|
+
};
|
|
850
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
851
|
+
}
|
|
852
|
+
} else if (history.Action!.startsWith("Withdraw")) {
|
|
853
|
+
const [amount, token] = history.Amount?.split(" ")!;
|
|
854
|
+
if (depositorCashFlows.has(index)) {
|
|
855
|
+
let depositorCashFlow = depositorCashFlows.get(index)!;
|
|
856
|
+
depositorCashFlow.D_TOKEN = token;
|
|
857
|
+
depositorCashFlow.totalWithdraw += Number(amount);
|
|
858
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
859
|
+
} else {
|
|
860
|
+
let depositorCashFlow: DepositorCashFlow = {
|
|
861
|
+
D_TOKEN: token,
|
|
862
|
+
totalDeposit: 0,
|
|
863
|
+
totalWithdraw: Number(amount),
|
|
864
|
+
totalClaim: 0,
|
|
865
|
+
totalCompound: 0,
|
|
866
|
+
netDeposit: undefined,
|
|
867
|
+
totalHarvest: new Map(),
|
|
868
|
+
};
|
|
869
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
870
|
+
}
|
|
871
|
+
} else if (history.Action! == "Claim") {
|
|
872
|
+
const [amount, token] = history.Amount?.split(" ")!;
|
|
873
|
+
if (depositorCashFlows.has(index)) {
|
|
874
|
+
let depositorCashFlow = depositorCashFlows.get(index)!;
|
|
875
|
+
depositorCashFlow.D_TOKEN = token;
|
|
876
|
+
depositorCashFlow.totalClaim += Number(amount);
|
|
877
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
878
|
+
} else {
|
|
879
|
+
let depositorCashFlow: DepositorCashFlow = {
|
|
880
|
+
D_TOKEN: token,
|
|
881
|
+
totalDeposit: 0,
|
|
882
|
+
totalWithdraw: 0,
|
|
883
|
+
totalClaim: Number(amount),
|
|
884
|
+
totalCompound: 0,
|
|
885
|
+
netDeposit: undefined,
|
|
886
|
+
totalHarvest: new Map(),
|
|
887
|
+
};
|
|
888
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
889
|
+
}
|
|
890
|
+
} else if (history.Action! == "Compound") {
|
|
891
|
+
const [amount, token] = history.Amount?.split(" ")!;
|
|
892
|
+
if (depositorCashFlows.has(index)) {
|
|
893
|
+
let depositorCashFlow = depositorCashFlows.get(index)!;
|
|
894
|
+
depositorCashFlow.D_TOKEN = token;
|
|
895
|
+
depositorCashFlow.totalCompound += Number(amount);
|
|
896
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
897
|
+
} else {
|
|
898
|
+
let depositorCashFlow: DepositorCashFlow = {
|
|
899
|
+
D_TOKEN: token,
|
|
900
|
+
totalDeposit: 0,
|
|
901
|
+
totalWithdraw: 0,
|
|
902
|
+
totalClaim: 0,
|
|
903
|
+
totalCompound: Number(amount),
|
|
904
|
+
netDeposit: undefined,
|
|
905
|
+
totalHarvest: new Map(),
|
|
906
|
+
};
|
|
907
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
// console.log(depositorCashFlows);
|
|
912
|
+
|
|
913
|
+
for (let [index, share] of depositorCashFlows.entries()) {
|
|
914
|
+
share.netDeposit = share.totalDeposit + share.totalCompound - share.totalWithdraw - share.totalClaim;
|
|
915
|
+
depositorCashFlows.set(index, share);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
return depositorCashFlows;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
export interface DepositorCashFlow {
|
|
922
|
+
D_TOKEN: string | undefined;
|
|
923
|
+
totalDeposit: number;
|
|
924
|
+
totalWithdraw: number;
|
|
925
|
+
totalClaim: number;
|
|
926
|
+
totalCompound: number;
|
|
927
|
+
netDeposit: number | undefined;
|
|
928
|
+
totalHarvest: Map<string, number>;
|
|
929
|
+
}
|