@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,46 @@
|
|
|
1
|
+
const apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-1";
|
|
2
|
+
|
|
3
|
+
export async function getDrawResult(
|
|
4
|
+
network: "mainnet" | "testnet",
|
|
5
|
+
packageId: string,
|
|
6
|
+
registry: string,
|
|
7
|
+
index: string,
|
|
8
|
+
amount: string,
|
|
9
|
+
guess_1: string,
|
|
10
|
+
larger_than_1: boolean,
|
|
11
|
+
guess_2: string,
|
|
12
|
+
larger_than_2: boolean,
|
|
13
|
+
vrf_input_1: number[],
|
|
14
|
+
vrf_input_2: number[]
|
|
15
|
+
) {
|
|
16
|
+
const queryParams = new URLSearchParams({
|
|
17
|
+
network,
|
|
18
|
+
packageId,
|
|
19
|
+
registry,
|
|
20
|
+
index,
|
|
21
|
+
amount,
|
|
22
|
+
guess_1,
|
|
23
|
+
larger_than_1: `${larger_than_1}`,
|
|
24
|
+
guess_2,
|
|
25
|
+
larger_than_2: `${larger_than_2}`,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const vrf_input_1_string = JSON.stringify(vrf_input_1);
|
|
29
|
+
const vrf_input_2_string = JSON.stringify(vrf_input_2);
|
|
30
|
+
|
|
31
|
+
// Append the query parameters to the URL
|
|
32
|
+
const apiUrlWithParams = `${apiUrl}?${queryParams.toString()}&vrf_input_1=${vrf_input_1_string}&vrf_input_2=${vrf_input_2_string}`;
|
|
33
|
+
// console.log(apiUrlWithParams);
|
|
34
|
+
|
|
35
|
+
let response = await fetch(apiUrlWithParams, {
|
|
36
|
+
method: "GET",
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// console.log(response);
|
|
41
|
+
|
|
42
|
+
if (response.ok) {
|
|
43
|
+
let data = await response.json();
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
// import { SuiClient } from "@mysten/sui.js/dist/cjs/client";
|
|
2
|
+
// import { JsonRpcProvider } from "@mysten/sui.js/dist/cjs/providers/json-rpc-provider";
|
|
3
|
+
import { SuiClient, SuiEventFilter } from "@mysten/sui.js/client";
|
|
4
|
+
import { assetToDecimal, typeArgToAsset } from "../constants/token";
|
|
5
|
+
|
|
6
|
+
export async function getPlaygrounds(provider: SuiClient, diceRegistry: string) {
|
|
7
|
+
const playgroundIds = (await provider.getDynamicFields({ parentId: diceRegistry })).data
|
|
8
|
+
.filter((a) => a.objectType.endsWith("Playground"))
|
|
9
|
+
.sort((a, b) => Number(a.name.value) - Number(b.name.value))
|
|
10
|
+
.map((x) => x.objectId as string);
|
|
11
|
+
|
|
12
|
+
// console.log(playgroundIds);
|
|
13
|
+
|
|
14
|
+
const objects = await provider.multiGetObjects({
|
|
15
|
+
ids: playgroundIds,
|
|
16
|
+
options: { showContent: true },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const result = objects
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
.filter((object) => object.data?.content?.type.endsWith("Playground"))
|
|
22
|
+
.map((object) => {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const fields = object.data?.content.fields;
|
|
25
|
+
// console.log(fields);
|
|
26
|
+
|
|
27
|
+
const opened_games = fields.opened_games.fields.contents.reduce((acc, curr) => {
|
|
28
|
+
acc.set(curr.fields.key, curr.fields.value.fields as Game);
|
|
29
|
+
return acc;
|
|
30
|
+
}, new Map<number, Game>());
|
|
31
|
+
const game_config = fields.game_config.fields as GameConfig;
|
|
32
|
+
|
|
33
|
+
// console.log(opened_games);
|
|
34
|
+
// console.log(game_config);
|
|
35
|
+
|
|
36
|
+
const playground: Playground = {
|
|
37
|
+
id: fields.id.id,
|
|
38
|
+
house_whitelist: fields.house_whitelist,
|
|
39
|
+
public_key: fields.public_key,
|
|
40
|
+
num_of_games: fields.num_of_games,
|
|
41
|
+
stake_token: fields.stake_token.fields.name,
|
|
42
|
+
opened_games,
|
|
43
|
+
game_config,
|
|
44
|
+
is_active: fields.is_active,
|
|
45
|
+
};
|
|
46
|
+
// console.log(playground);
|
|
47
|
+
return playground;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface Playground {
|
|
54
|
+
id: string;
|
|
55
|
+
house_whitelist: string[];
|
|
56
|
+
public_key: string; // Public key used to verify the beacon produced by the back-end.
|
|
57
|
+
num_of_games: string; // use for creating vrf_input
|
|
58
|
+
stake_token: string;
|
|
59
|
+
opened_games: Map<string, Game>; // <address, Game>
|
|
60
|
+
game_config: GameConfig;
|
|
61
|
+
is_active: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface GameConfig {
|
|
65
|
+
max_stake: string;
|
|
66
|
+
min_stake: string;
|
|
67
|
+
stake_lot_size: string;
|
|
68
|
+
base_exp_divisor: string; // e.g. 1_000_000_000, so 10^9 Mist SUI => 1 exp if odd = 1
|
|
69
|
+
losses_multiplier_bp: string;
|
|
70
|
+
critical_hits_multiplier_bp: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface Game {
|
|
74
|
+
game_id: string;
|
|
75
|
+
player: string;
|
|
76
|
+
stake_amount: string;
|
|
77
|
+
guess_1: string | null;
|
|
78
|
+
larger_than_1: boolean | null;
|
|
79
|
+
vrf_input_1: number[] | null;
|
|
80
|
+
guess_2: string | null;
|
|
81
|
+
larger_than_2: boolean | null;
|
|
82
|
+
vrf_input_2: number[] | null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export async function getHistory(provider: SuiClient, dicePackage: string, playgrounds: Playground[]): Promise<DrawDisplay[]> {
|
|
86
|
+
const eventFilter: SuiEventFilter = {
|
|
87
|
+
MoveEventType: `${dicePackage}::tails_exp::Draw`,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var result = await provider.queryEvents({ query: eventFilter, order: "descending" });
|
|
91
|
+
// console.log(result);
|
|
92
|
+
|
|
93
|
+
var history = await parseHistory(result.data, playgrounds);
|
|
94
|
+
|
|
95
|
+
while (result.hasNextPage && history.length <= 60) {
|
|
96
|
+
result = await provider.queryEvents({ query: eventFilter, order: "descending", cursor: result.nextCursor });
|
|
97
|
+
const nextPage = await parseHistory(result.data, playgrounds);
|
|
98
|
+
history = history.concat(nextPage);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return history;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export async function waitHistory(provider: SuiClient, dicePackage: string, onMessage) {
|
|
105
|
+
const eventFilter: SuiEventFilter = {
|
|
106
|
+
MoveEventType: `${dicePackage}::tails_exp::Draw`,
|
|
107
|
+
};
|
|
108
|
+
const unsubscribe = await provider.subscribeEvent({
|
|
109
|
+
filter: eventFilter,
|
|
110
|
+
onMessage,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
return unsubscribe;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export async function parseHistory(datas, playgrounds: Playground[]): Promise<DrawDisplay[]> {
|
|
117
|
+
const result = datas.map((event) => {
|
|
118
|
+
const drawEvent = event.parsedJson as DrawEvent;
|
|
119
|
+
drawEvent.timestampMs = event.timestampMs;
|
|
120
|
+
|
|
121
|
+
const playground = playgrounds[Number(drawEvent.index)];
|
|
122
|
+
|
|
123
|
+
const coinType = "0x" + playground.stake_token;
|
|
124
|
+
const asset = typeArgToAsset(coinType);
|
|
125
|
+
const decimal = assetToDecimal(asset)!;
|
|
126
|
+
|
|
127
|
+
const guess_1 = (drawEvent.larger_than_1 ? `> ` : `< `) + `${Number(drawEvent.guess_1) / 100}`;
|
|
128
|
+
const guess_2 = (drawEvent.larger_than_2 ? `> ` : `< `) + `${Number(drawEvent.guess_2) / 100}`;
|
|
129
|
+
var result_1 = `${Number(drawEvent.answer_1) / 100}`;
|
|
130
|
+
switch (drawEvent.result_1) {
|
|
131
|
+
case "0":
|
|
132
|
+
result_1 += " W";
|
|
133
|
+
break;
|
|
134
|
+
case "1":
|
|
135
|
+
result_1 += " L";
|
|
136
|
+
break;
|
|
137
|
+
case "2":
|
|
138
|
+
result_1 += " C";
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
var result_2 = `${Number(drawEvent.answer_2) / 100}`;
|
|
142
|
+
switch (drawEvent.result_2) {
|
|
143
|
+
case "0":
|
|
144
|
+
result_2 += " W";
|
|
145
|
+
break;
|
|
146
|
+
case "1":
|
|
147
|
+
result_2 += " L";
|
|
148
|
+
break;
|
|
149
|
+
case "2":
|
|
150
|
+
result_2 += " C";
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const stake_amount = Number(drawEvent.stake_amount) / 10 ** decimal;
|
|
155
|
+
const amount = stake_amount > 1000000 ? `${stake_amount / 1000000}m` : stake_amount;
|
|
156
|
+
|
|
157
|
+
const display: DrawDisplay = {
|
|
158
|
+
game_id: drawEvent.game_id,
|
|
159
|
+
player: drawEvent.player,
|
|
160
|
+
guess_1,
|
|
161
|
+
guess_2,
|
|
162
|
+
result_1,
|
|
163
|
+
result_2,
|
|
164
|
+
bet_amount: `${amount} ${asset}`,
|
|
165
|
+
exp: `${Number(drawEvent.exp)} EXP`,
|
|
166
|
+
timestampMs: drawEvent.timestampMs,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
return display;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface DrawEvent {
|
|
176
|
+
answer_1: string;
|
|
177
|
+
answer_2: string;
|
|
178
|
+
exp: string;
|
|
179
|
+
game_id: string;
|
|
180
|
+
guess_1: string;
|
|
181
|
+
guess_2: string;
|
|
182
|
+
index: string;
|
|
183
|
+
larger_than_1: boolean;
|
|
184
|
+
larger_than_2: boolean;
|
|
185
|
+
player: string;
|
|
186
|
+
public_key: number[];
|
|
187
|
+
result_1: string; // 0 = win, 1 = lose, 2 = critical hit
|
|
188
|
+
result_2: string;
|
|
189
|
+
signature_1: number[];
|
|
190
|
+
signature_2: number[];
|
|
191
|
+
signer: string;
|
|
192
|
+
stake_amount: string;
|
|
193
|
+
timestampMs: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface DrawDisplay {
|
|
197
|
+
game_id: string;
|
|
198
|
+
player: string;
|
|
199
|
+
guess_1: string;
|
|
200
|
+
guess_2: string;
|
|
201
|
+
result_1: string;
|
|
202
|
+
result_2: string;
|
|
203
|
+
bet_amount: string;
|
|
204
|
+
exp: string;
|
|
205
|
+
timestampMs: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface LeaderBoard {
|
|
209
|
+
player: string;
|
|
210
|
+
total_bet_amount: number;
|
|
211
|
+
total_earn_exp: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export async function getLeaderBoard(drawDisplays: DrawDisplay[]): Promise<LeaderBoard[]> {
|
|
215
|
+
let leaderBoard: LeaderBoard[] = [];
|
|
216
|
+
|
|
217
|
+
for (let drawDisplay of drawDisplays) {
|
|
218
|
+
let i = leaderBoard.findIndex((x) => x.player == drawDisplay.player);
|
|
219
|
+
if (i == -1) {
|
|
220
|
+
leaderBoard.push({
|
|
221
|
+
player: drawDisplay.player,
|
|
222
|
+
total_bet_amount: Number(drawDisplay.bet_amount.split(" ")[0]),
|
|
223
|
+
total_earn_exp: Number(drawDisplay.exp.split(" ")[0]),
|
|
224
|
+
} as LeaderBoard);
|
|
225
|
+
} else {
|
|
226
|
+
leaderBoard[i].total_bet_amount += Number(drawDisplay.bet_amount.split(" ")[0]);
|
|
227
|
+
leaderBoard[i].total_earn_exp += Number(drawDisplay.exp.split(" ")[0]);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return leaderBoard;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface ProfitSharing {
|
|
235
|
+
level_profits: string[];
|
|
236
|
+
level_users: string[];
|
|
237
|
+
pool: string;
|
|
238
|
+
remaining: string;
|
|
239
|
+
total: string;
|
|
240
|
+
tokenType: string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export async function getProfitSharing(provider: SuiClient, diceProfitSharing: string) {
|
|
244
|
+
const object = await provider.getObject({
|
|
245
|
+
id: diceProfitSharing,
|
|
246
|
+
options: { showContent: true },
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// @ts-ignore
|
|
250
|
+
const type: string = object.data?.content.type;
|
|
251
|
+
const tokenType = type.split("<").at(-1)?.replace(">>", "")!;
|
|
252
|
+
|
|
253
|
+
// @ts-ignore
|
|
254
|
+
const result = object.data?.content?.fields.value.fields as ProfitSharing;
|
|
255
|
+
result.tokenType = tokenType;
|
|
256
|
+
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function calculateLevelReward(totalRewards: number, levelShares: number[], numOfHolders: number[]): number[] {
|
|
261
|
+
// Step 1: Calculate original level rewards (per holder)
|
|
262
|
+
const totalShares: number = levelShares.reduce((acc, share) => acc + share, 0);
|
|
263
|
+
const originalRewardPerHolder: number[] = levelShares.map((levelShare, index) => {
|
|
264
|
+
const num: number = numOfHolders[index];
|
|
265
|
+
const levelRewardPerHolder: number = num > 0 ? (totalRewards * levelShare) / totalShares / num : 0;
|
|
266
|
+
return Math.floor(levelRewardPerHolder);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
const originalLevelRewards: number[] = originalRewardPerHolder.map((reward, index) => reward * numOfHolders[index]);
|
|
270
|
+
const distributedRewards: number = originalLevelRewards.reduce((acc, reward) => acc + reward, 0);
|
|
271
|
+
const emptyLevelRewards: number = totalRewards - distributedRewards;
|
|
272
|
+
// console.log("Step 1 - ", originalRewardPerHolder);
|
|
273
|
+
|
|
274
|
+
// Step 2: Distribute rewards from empty levels
|
|
275
|
+
let reversedOriginalRewardPerHolder: number[] = originalRewardPerHolder.slice().reverse();
|
|
276
|
+
let reversedNumOfHolders: number[] = numOfHolders.slice().reverse();
|
|
277
|
+
let reversedScaledRewardPerHolder: number[] = [];
|
|
278
|
+
if (emptyLevelRewards > 0) {
|
|
279
|
+
let undistributedRewards: number = emptyLevelRewards;
|
|
280
|
+
let uncalculatedDistributedRewards: number = distributedRewards;
|
|
281
|
+
reversedScaledRewardPerHolder = reversedOriginalRewardPerHolder.map((rewardPerHolder, index) => {
|
|
282
|
+
const num: number = reversedNumOfHolders[index];
|
|
283
|
+
const scaledRewardPerHolder: number =
|
|
284
|
+
num > 0
|
|
285
|
+
? uncalculatedDistributedRewards > 0
|
|
286
|
+
? (rewardPerHolder * (uncalculatedDistributedRewards + undistributedRewards)) / uncalculatedDistributedRewards
|
|
287
|
+
: rewardPerHolder
|
|
288
|
+
: 0;
|
|
289
|
+
|
|
290
|
+
undistributedRewards -= (scaledRewardPerHolder - rewardPerHolder) * num;
|
|
291
|
+
uncalculatedDistributedRewards -= rewardPerHolder * num;
|
|
292
|
+
return Math.floor(scaledRewardPerHolder);
|
|
293
|
+
});
|
|
294
|
+
} else {
|
|
295
|
+
reversedScaledRewardPerHolder = reversedOriginalRewardPerHolder.slice();
|
|
296
|
+
}
|
|
297
|
+
// let scaledRewardPerHolder: number[] = reversedScaledRewardPerHolder.slice().reverse();
|
|
298
|
+
// console.log("Step 2 - ", scaledRewardPerHolder);
|
|
299
|
+
|
|
300
|
+
// Step 3: Capped level reward
|
|
301
|
+
let reversedCappedRewardPerHolder: number[] = [reversedOriginalRewardPerHolder[0]];
|
|
302
|
+
var tempHighLevelReward: number = 0;
|
|
303
|
+
reversedScaledRewardPerHolder.forEach((highLevelReward, index) => {
|
|
304
|
+
const lowLevelReward: number = reversedScaledRewardPerHolder[index + 1] || 0;
|
|
305
|
+
tempHighLevelReward =
|
|
306
|
+
highLevelReward > 0
|
|
307
|
+
? tempHighLevelReward > 0
|
|
308
|
+
? Math.min(highLevelReward, tempHighLevelReward)
|
|
309
|
+
: highLevelReward
|
|
310
|
+
: tempHighLevelReward;
|
|
311
|
+
reversedCappedRewardPerHolder.push(tempHighLevelReward > 0 ? Math.min(lowLevelReward, tempHighLevelReward) : lowLevelReward);
|
|
312
|
+
});
|
|
313
|
+
reversedCappedRewardPerHolder.pop();
|
|
314
|
+
let cappedRewardPerHolder: number[] = reversedCappedRewardPerHolder.slice().reverse();
|
|
315
|
+
// console.log("Step 3 - ", cappedRewardPerHolder);
|
|
316
|
+
|
|
317
|
+
// Step 4: Distribute capped reward from Step 3 into each level
|
|
318
|
+
const distributedRewardsStep4: number = reversedCappedRewardPerHolder.reduce(
|
|
319
|
+
(acc, reward, index) => acc + reward * reversedNumOfHolders[index],
|
|
320
|
+
0
|
|
321
|
+
);
|
|
322
|
+
var undistributedRewardsStep4: number = totalRewards - distributedRewardsStep4;
|
|
323
|
+
var uncalculatedDistributedRewardsStep4: number = distributedRewardsStep4;
|
|
324
|
+
|
|
325
|
+
// console.log(distributedRewardsStep4);
|
|
326
|
+
|
|
327
|
+
// console.log(totalRewards);
|
|
328
|
+
// console.log(undistributedRewardsStep4);
|
|
329
|
+
// console.log(uncalculatedDistributedRewardsStep4);
|
|
330
|
+
|
|
331
|
+
var levelReward: number[] = cappedRewardPerHolder.map((rewardPerHolder, index) => {
|
|
332
|
+
const num: number = reversedNumOfHolders[index];
|
|
333
|
+
const scaledRewardPerHolder: number =
|
|
334
|
+
uncalculatedDistributedRewardsStep4 > 0
|
|
335
|
+
? (rewardPerHolder * (uncalculatedDistributedRewardsStep4 + undistributedRewardsStep4)) /
|
|
336
|
+
uncalculatedDistributedRewardsStep4
|
|
337
|
+
: rewardPerHolder;
|
|
338
|
+
|
|
339
|
+
undistributedRewardsStep4 -= (scaledRewardPerHolder - rewardPerHolder) * num;
|
|
340
|
+
uncalculatedDistributedRewardsStep4 -= rewardPerHolder * num;
|
|
341
|
+
// console.log(undistributedRewardsStep4);
|
|
342
|
+
return Math.floor(scaledRewardPerHolder);
|
|
343
|
+
});
|
|
344
|
+
// console.log("Step 4 - ", levelReward);
|
|
345
|
+
|
|
346
|
+
return levelReward;
|
|
347
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
public(friend) entry fun new_game<TOKEN>(
|
|
5
|
+
registry: &mut Registry,
|
|
6
|
+
index: u64,
|
|
7
|
+
coins: vector<Coin<TOKEN>>,
|
|
8
|
+
stake_amount: u64,
|
|
9
|
+
ctx: &mut TxContext
|
|
10
|
+
)
|
|
11
|
+
*/
|
|
12
|
+
export async function newGameTx(
|
|
13
|
+
gasBudget: number,
|
|
14
|
+
packageId: string,
|
|
15
|
+
typeArguments: string[], // [TOKEN]
|
|
16
|
+
registry: string,
|
|
17
|
+
index: string,
|
|
18
|
+
coins: string[],
|
|
19
|
+
amount: string
|
|
20
|
+
) {
|
|
21
|
+
let tx = new TransactionBlock();
|
|
22
|
+
tx.moveCall({
|
|
23
|
+
target: `${packageId}::tails_exp::new_game`,
|
|
24
|
+
typeArguments,
|
|
25
|
+
arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: coins.map((id) => tx.object(id)) }), tx.pure(amount)],
|
|
26
|
+
});
|
|
27
|
+
tx.setGasBudget(gasBudget);
|
|
28
|
+
|
|
29
|
+
return tx;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
public(friend) entry fun play_guess(
|
|
34
|
+
registry: &mut Registry,
|
|
35
|
+
index: u64,
|
|
36
|
+
game_id: u64,
|
|
37
|
+
guess_1: u64,
|
|
38
|
+
larger_than_1: bool,
|
|
39
|
+
guess_2: u64,
|
|
40
|
+
larger_than_2: bool,
|
|
41
|
+
ctx: &mut TxContext
|
|
42
|
+
)
|
|
43
|
+
*/
|
|
44
|
+
export async function playGuessTx(
|
|
45
|
+
gasBudget: number,
|
|
46
|
+
packageId: string,
|
|
47
|
+
registry: string,
|
|
48
|
+
index: string,
|
|
49
|
+
guess_1: string,
|
|
50
|
+
larger_than_1: boolean,
|
|
51
|
+
guess_2: string,
|
|
52
|
+
larger_than_2: boolean
|
|
53
|
+
) {
|
|
54
|
+
let tx = new TransactionBlock();
|
|
55
|
+
|
|
56
|
+
tx.moveCall({
|
|
57
|
+
target: `${packageId}::tails_exp::play_guess`,
|
|
58
|
+
typeArguments: [],
|
|
59
|
+
arguments: [
|
|
60
|
+
tx.object(registry),
|
|
61
|
+
tx.pure(index),
|
|
62
|
+
tx.pure(guess_1),
|
|
63
|
+
tx.pure(larger_than_1),
|
|
64
|
+
tx.pure(guess_2),
|
|
65
|
+
tx.pure(larger_than_2),
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
tx.setGasBudget(gasBudget);
|
|
69
|
+
|
|
70
|
+
return tx;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function newGamePlayGuessTx(
|
|
74
|
+
gasBudget: number,
|
|
75
|
+
packageId: string,
|
|
76
|
+
typeArguments: string[], // [TOKEN]
|
|
77
|
+
registry: string,
|
|
78
|
+
index: string,
|
|
79
|
+
coins: string[],
|
|
80
|
+
amount: string,
|
|
81
|
+
guess_1: string,
|
|
82
|
+
larger_than_1: boolean,
|
|
83
|
+
guess_2: string,
|
|
84
|
+
larger_than_2: boolean
|
|
85
|
+
) {
|
|
86
|
+
let tx = new TransactionBlock();
|
|
87
|
+
|
|
88
|
+
if (
|
|
89
|
+
typeArguments[0] == "0x2::sui::SUI" ||
|
|
90
|
+
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
|
|
91
|
+
) {
|
|
92
|
+
let [coin] = tx.splitCoins(tx.gas, [tx.pure(amount)]);
|
|
93
|
+
tx.moveCall({
|
|
94
|
+
target: `${packageId}::tails_exp::new_game`,
|
|
95
|
+
typeArguments,
|
|
96
|
+
arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(amount)],
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
tx.moveCall({
|
|
100
|
+
target: `${packageId}::tails_exp::new_game`,
|
|
101
|
+
typeArguments,
|
|
102
|
+
arguments: [
|
|
103
|
+
tx.object(registry),
|
|
104
|
+
tx.pure(index),
|
|
105
|
+
tx.makeMoveVec({ objects: coins.map((id) => tx.object(id)) }),
|
|
106
|
+
tx.pure(amount),
|
|
107
|
+
],
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
tx.moveCall({
|
|
112
|
+
target: `${packageId}::tails_exp::play_guess`,
|
|
113
|
+
typeArguments: [],
|
|
114
|
+
arguments: [
|
|
115
|
+
tx.object(registry),
|
|
116
|
+
tx.pure(index),
|
|
117
|
+
tx.pure(guess_1),
|
|
118
|
+
tx.pure(larger_than_1),
|
|
119
|
+
tx.pure(guess_2),
|
|
120
|
+
tx.pure(larger_than_2),
|
|
121
|
+
// tx.object("0x8"), // TODO: waiting for upgrade
|
|
122
|
+
],
|
|
123
|
+
});
|
|
124
|
+
tx.setGasBudget(gasBudget);
|
|
125
|
+
|
|
126
|
+
return tx;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
public fun consume_exp_coin_staked(
|
|
131
|
+
registry: &mut Registry,
|
|
132
|
+
version: &Version,
|
|
133
|
+
tails_staking_registry: &mut TailsStakingRegistry,
|
|
134
|
+
tails: address,
|
|
135
|
+
coin: Coin<TAILS_EXP>,
|
|
136
|
+
) {
|
|
137
|
+
*/
|
|
138
|
+
export function getConsumeExpCoinStakedTx(input: {
|
|
139
|
+
tx: TransactionBlock;
|
|
140
|
+
packageId: string;
|
|
141
|
+
tailsExpRegistry: string;
|
|
142
|
+
typusEcosystemVersion: string;
|
|
143
|
+
tailsStakingRegistry: string;
|
|
144
|
+
tails: string;
|
|
145
|
+
coins: string[];
|
|
146
|
+
amount: string;
|
|
147
|
+
}) {
|
|
148
|
+
let coin = input.coins.pop()!;
|
|
149
|
+
if (input.coins.length > 0) {
|
|
150
|
+
input.tx.mergeCoins(
|
|
151
|
+
input.tx.object(coin),
|
|
152
|
+
input.coins.map((id) => input.tx.object(id))
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
let [input_coin] = input.tx.splitCoins(input.tx.object(coin), [input.tx.pure(input.amount)]);
|
|
156
|
+
input.tx.moveCall({
|
|
157
|
+
target: `${input.packageId}::tails_exp::consume_exp_coin_staked`,
|
|
158
|
+
typeArguments: [],
|
|
159
|
+
arguments: [
|
|
160
|
+
input.tx.object(input.tailsExpRegistry),
|
|
161
|
+
input.tx.object(input.typusEcosystemVersion),
|
|
162
|
+
input.tx.object(input.tailsStakingRegistry),
|
|
163
|
+
input.tx.pure(input.tails),
|
|
164
|
+
input.tx.object(input_coin),
|
|
165
|
+
],
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
return input.tx;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
public fun consume_exp_coin_unstaked(
|
|
172
|
+
registry: &mut Registry,
|
|
173
|
+
version: &Version,
|
|
174
|
+
tails_staking_registry: &TailsStakingRegistry,
|
|
175
|
+
kiosk: &mut Kiosk,
|
|
176
|
+
kiosk_owner_cap: &KioskOwnerCap,
|
|
177
|
+
tails: address,
|
|
178
|
+
coin: Coin<TAILS_EXP>,
|
|
179
|
+
) {
|
|
180
|
+
*/
|
|
181
|
+
export function getConsumeExpCoinUnstakedTx(input: {
|
|
182
|
+
tx: TransactionBlock;
|
|
183
|
+
packageId: string;
|
|
184
|
+
tailsExpRegistry: string;
|
|
185
|
+
typusEcosystemVersion: string;
|
|
186
|
+
tailsStakingRegistry: string;
|
|
187
|
+
kiosk: string;
|
|
188
|
+
kioskCap: string;
|
|
189
|
+
tails: string;
|
|
190
|
+
coins: string[];
|
|
191
|
+
amount: string;
|
|
192
|
+
personalKioskPackageId: string | undefined;
|
|
193
|
+
}) {
|
|
194
|
+
let coin = input.coins.pop()!;
|
|
195
|
+
if (input.coins.length > 0) {
|
|
196
|
+
input.tx.mergeCoins(
|
|
197
|
+
input.tx.object(coin),
|
|
198
|
+
input.coins.map((id) => input.tx.object(id))
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
let [input_coin] = input.tx.splitCoins(input.tx.object(coin), [input.tx.pure(input.amount)]);
|
|
202
|
+
if (input.personalKioskPackageId) {
|
|
203
|
+
const [personalKioskCap, borrow] = input.tx.moveCall({
|
|
204
|
+
target: `${input.personalKioskPackageId}::personal_kiosk::borrow_val`,
|
|
205
|
+
arguments: [input.tx.object(input.kioskCap)],
|
|
206
|
+
});
|
|
207
|
+
input.tx.moveCall({
|
|
208
|
+
target: `${input.packageId}::tails_exp::consume_exp_coin_unstaked`,
|
|
209
|
+
typeArguments: [],
|
|
210
|
+
arguments: [
|
|
211
|
+
input.tx.object(input.tailsExpRegistry),
|
|
212
|
+
input.tx.object(input.typusEcosystemVersion),
|
|
213
|
+
input.tx.object(input.tailsStakingRegistry),
|
|
214
|
+
input.tx.object(input.kiosk),
|
|
215
|
+
personalKioskCap,
|
|
216
|
+
input.tx.pure(input.tails),
|
|
217
|
+
input.tx.object(input_coin),
|
|
218
|
+
],
|
|
219
|
+
});
|
|
220
|
+
input.tx.moveCall({
|
|
221
|
+
target: `${input.personalKioskPackageId}::personal_kiosk::return_val`,
|
|
222
|
+
arguments: [input.tx.object(input.kioskCap), personalKioskCap, borrow],
|
|
223
|
+
});
|
|
224
|
+
} else {
|
|
225
|
+
input.tx.moveCall({
|
|
226
|
+
target: `${input.packageId}::tails_exp::consume_exp_coin_unstaked`,
|
|
227
|
+
typeArguments: [],
|
|
228
|
+
arguments: [
|
|
229
|
+
input.tx.object(input.tailsExpRegistry),
|
|
230
|
+
input.tx.object(input.typusEcosystemVersion),
|
|
231
|
+
input.tx.object(input.tailsStakingRegistry),
|
|
232
|
+
input.tx.object(input.kiosk),
|
|
233
|
+
input.tx.object(input.kioskCap),
|
|
234
|
+
input.tx.pure(input.tails),
|
|
235
|
+
input.tx.object(input_coin),
|
|
236
|
+
],
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return input.tx;
|
|
241
|
+
}
|