@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,69 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
4
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
5
|
+
|
|
6
|
+
/* ============================== GovernanceAction =============================== */
|
|
7
|
+
|
|
8
|
+
export function isGovernanceAction(type: string): boolean { type = compressSuiType(type); return type === "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_action::GovernanceAction"; }
|
|
9
|
+
|
|
10
|
+
export interface GovernanceActionFields { value: ToField<"u8"> }
|
|
11
|
+
|
|
12
|
+
export type GovernanceActionReified = Reified< GovernanceAction, GovernanceActionFields >;
|
|
13
|
+
|
|
14
|
+
export class GovernanceAction implements StructClass { static readonly $typeName = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_action::GovernanceAction"; static readonly $numTypeParams = 0;
|
|
15
|
+
|
|
16
|
+
readonly $typeName = GovernanceAction.$typeName;
|
|
17
|
+
|
|
18
|
+
readonly $fullTypeName: "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_action::GovernanceAction";
|
|
19
|
+
|
|
20
|
+
readonly $typeArgs: [];
|
|
21
|
+
|
|
22
|
+
readonly value: ToField<"u8">
|
|
23
|
+
|
|
24
|
+
private constructor(typeArgs: [], fields: GovernanceActionFields, ) { this.$fullTypeName = composeSuiType( GovernanceAction.$typeName, ...typeArgs ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_action::GovernanceAction"; this.$typeArgs = typeArgs;
|
|
25
|
+
|
|
26
|
+
this.value = fields.value; }
|
|
27
|
+
|
|
28
|
+
static reified( ): GovernanceActionReified { return { typeName: GovernanceAction.$typeName, fullTypeName: composeSuiType( GovernanceAction.$typeName, ...[] ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_action::GovernanceAction", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => GovernanceAction.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => GovernanceAction.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => GovernanceAction.fromBcs( data, ), bcs: GovernanceAction.bcs, fromJSONField: (field: any) => GovernanceAction.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => GovernanceAction.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => GovernanceAction.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => GovernanceAction.fetch( client, id, ), new: ( fields: GovernanceActionFields, ) => { return new GovernanceAction( [], fields ) }, kind: "StructClassReified", } }
|
|
29
|
+
|
|
30
|
+
static get r() { return GovernanceAction.reified() }
|
|
31
|
+
|
|
32
|
+
static phantom( ): PhantomReified<ToTypeStr<GovernanceAction>> { return phantom(GovernanceAction.reified( )); } static get p() { return GovernanceAction.phantom() }
|
|
33
|
+
|
|
34
|
+
static get bcs() { return bcs.struct("GovernanceAction", {
|
|
35
|
+
|
|
36
|
+
value: bcs.u8()
|
|
37
|
+
|
|
38
|
+
}) };
|
|
39
|
+
|
|
40
|
+
static fromFields( fields: Record<string, any> ): GovernanceAction { return GovernanceAction.reified( ).new( { value: decodeFromFields("u8", fields.value) } ) }
|
|
41
|
+
|
|
42
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): GovernanceAction { if (!isGovernanceAction(item.type)) { throw new Error("not a GovernanceAction type");
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return GovernanceAction.reified( ).new( { value: decodeFromFieldsWithTypes("u8", item.fields.value) } ) }
|
|
47
|
+
|
|
48
|
+
static fromBcs( data: Uint8Array ): GovernanceAction { return GovernanceAction.fromFields( GovernanceAction.bcs.parse(data) ) }
|
|
49
|
+
|
|
50
|
+
toJSONField() { return {
|
|
51
|
+
|
|
52
|
+
value: this.value,
|
|
53
|
+
|
|
54
|
+
} }
|
|
55
|
+
|
|
56
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
57
|
+
|
|
58
|
+
static fromJSONField( field: any ): GovernanceAction { return GovernanceAction.reified( ).new( { value: decodeFromJSONField("u8", field.value) } ) }
|
|
59
|
+
|
|
60
|
+
static fromJSON( json: Record<string, any> ): GovernanceAction { if (json.$typeName !== GovernanceAction.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
61
|
+
|
|
62
|
+
return GovernanceAction.fromJSONField( json, ) }
|
|
63
|
+
|
|
64
|
+
static fromSuiParsedData( content: SuiParsedData ): GovernanceAction { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isGovernanceAction(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a GovernanceAction object`); } return GovernanceAction.fromFieldsWithTypes( content ); }
|
|
65
|
+
|
|
66
|
+
static async fetch( client: SuiClient, id: string ): Promise<GovernanceAction> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching GovernanceAction object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isGovernanceAction(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a GovernanceAction object`); }
|
|
67
|
+
return GovernanceAction.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
68
|
+
|
|
69
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as reified from "../../../../_framework/reified";
|
|
2
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, Vector, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom} from "../../../../_framework/reified";
|
|
3
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
4
|
+
import {GovernanceAction} from "../governance-action/structs";
|
|
5
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
6
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
7
|
+
|
|
8
|
+
/* ============================== GovernanceInstruction =============================== */
|
|
9
|
+
|
|
10
|
+
export function isGovernanceInstruction(type: string): boolean { type = compressSuiType(type); return type === "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_instruction::GovernanceInstruction"; }
|
|
11
|
+
|
|
12
|
+
export interface GovernanceInstructionFields { module: ToField<"u8">; action: ToField<GovernanceAction>; targetChainId: ToField<"u64">; payload: ToField<Vector<"u8">> }
|
|
13
|
+
|
|
14
|
+
export type GovernanceInstructionReified = Reified< GovernanceInstruction, GovernanceInstructionFields >;
|
|
15
|
+
|
|
16
|
+
export class GovernanceInstruction implements StructClass { static readonly $typeName = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_instruction::GovernanceInstruction"; static readonly $numTypeParams = 0;
|
|
17
|
+
|
|
18
|
+
readonly $typeName = GovernanceInstruction.$typeName;
|
|
19
|
+
|
|
20
|
+
readonly $fullTypeName: "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_instruction::GovernanceInstruction";
|
|
21
|
+
|
|
22
|
+
readonly $typeArgs: [];
|
|
23
|
+
|
|
24
|
+
readonly module: ToField<"u8">; readonly action: ToField<GovernanceAction>; readonly targetChainId: ToField<"u64">; readonly payload: ToField<Vector<"u8">>
|
|
25
|
+
|
|
26
|
+
private constructor(typeArgs: [], fields: GovernanceInstructionFields, ) { this.$fullTypeName = composeSuiType( GovernanceInstruction.$typeName, ...typeArgs ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_instruction::GovernanceInstruction"; this.$typeArgs = typeArgs;
|
|
27
|
+
|
|
28
|
+
this.module = fields.module;; this.action = fields.action;; this.targetChainId = fields.targetChainId;; this.payload = fields.payload; }
|
|
29
|
+
|
|
30
|
+
static reified( ): GovernanceInstructionReified { return { typeName: GovernanceInstruction.$typeName, fullTypeName: composeSuiType( GovernanceInstruction.$typeName, ...[] ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::governance_instruction::GovernanceInstruction", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => GovernanceInstruction.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => GovernanceInstruction.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => GovernanceInstruction.fromBcs( data, ), bcs: GovernanceInstruction.bcs, fromJSONField: (field: any) => GovernanceInstruction.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => GovernanceInstruction.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => GovernanceInstruction.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => GovernanceInstruction.fetch( client, id, ), new: ( fields: GovernanceInstructionFields, ) => { return new GovernanceInstruction( [], fields ) }, kind: "StructClassReified", } }
|
|
31
|
+
|
|
32
|
+
static get r() { return GovernanceInstruction.reified() }
|
|
33
|
+
|
|
34
|
+
static phantom( ): PhantomReified<ToTypeStr<GovernanceInstruction>> { return phantom(GovernanceInstruction.reified( )); } static get p() { return GovernanceInstruction.phantom() }
|
|
35
|
+
|
|
36
|
+
static get bcs() { return bcs.struct("GovernanceInstruction", {
|
|
37
|
+
|
|
38
|
+
module_: bcs.u8(), action: GovernanceAction.bcs, target_chain_id: bcs.u64(), payload: bcs.vector(bcs.u8())
|
|
39
|
+
|
|
40
|
+
}) };
|
|
41
|
+
|
|
42
|
+
static fromFields( fields: Record<string, any> ): GovernanceInstruction { return GovernanceInstruction.reified( ).new( { module: decodeFromFields("u8", fields.module_), action: decodeFromFields(GovernanceAction.reified(), fields.action), targetChainId: decodeFromFields("u64", fields.target_chain_id), payload: decodeFromFields(reified.vector("u8"), fields.payload) } ) }
|
|
43
|
+
|
|
44
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): GovernanceInstruction { if (!isGovernanceInstruction(item.type)) { throw new Error("not a GovernanceInstruction type");
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return GovernanceInstruction.reified( ).new( { module: decodeFromFieldsWithTypes("u8", item.fields.module_), action: decodeFromFieldsWithTypes(GovernanceAction.reified(), item.fields.action), targetChainId: decodeFromFieldsWithTypes("u64", item.fields.target_chain_id), payload: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.payload) } ) }
|
|
49
|
+
|
|
50
|
+
static fromBcs( data: Uint8Array ): GovernanceInstruction { return GovernanceInstruction.fromFields( GovernanceInstruction.bcs.parse(data) ) }
|
|
51
|
+
|
|
52
|
+
toJSONField() { return {
|
|
53
|
+
|
|
54
|
+
module: this.module,action: this.action.toJSONField(),targetChainId: this.targetChainId.toString(),payload: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.payload),
|
|
55
|
+
|
|
56
|
+
} }
|
|
57
|
+
|
|
58
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
59
|
+
|
|
60
|
+
static fromJSONField( field: any ): GovernanceInstruction { return GovernanceInstruction.reified( ).new( { module: decodeFromJSONField("u8", field.module), action: decodeFromJSONField(GovernanceAction.reified(), field.action), targetChainId: decodeFromJSONField("u64", field.targetChainId), payload: decodeFromJSONField(reified.vector("u8"), field.payload) } ) }
|
|
61
|
+
|
|
62
|
+
static fromJSON( json: Record<string, any> ): GovernanceInstruction { if (json.$typeName !== GovernanceInstruction.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
63
|
+
|
|
64
|
+
return GovernanceInstruction.fromJSONField( json, ) }
|
|
65
|
+
|
|
66
|
+
static fromSuiParsedData( content: SuiParsedData ): GovernanceInstruction { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isGovernanceInstruction(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a GovernanceInstruction object`); } return GovernanceInstruction.fromFieldsWithTypes( content ); }
|
|
67
|
+
|
|
68
|
+
static async fetch( client: SuiClient, id: string ): Promise<GovernanceInstruction> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching GovernanceInstruction object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isGovernanceInstruction(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a GovernanceInstruction object`); }
|
|
69
|
+
return GovernanceInstruction.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
70
|
+
|
|
71
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as reified from "../../../../_framework/reified";
|
|
2
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeArgument, ToTypeStr, TypeArgument, Vector, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs} from "../../../../_framework/reified";
|
|
3
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
4
|
+
import {BcsType, bcs, fromB64} from "@mysten/bcs";
|
|
5
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
6
|
+
|
|
7
|
+
/* ============================== HotPotatoVector =============================== */
|
|
8
|
+
|
|
9
|
+
export function isHotPotatoVector(type: string): boolean { type = compressSuiType(type); return type.startsWith("0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::hot_potato_vector::HotPotatoVector<"); }
|
|
10
|
+
|
|
11
|
+
export interface HotPotatoVectorFields<T extends TypeArgument> { contents: ToField<Vector<T>> }
|
|
12
|
+
|
|
13
|
+
export type HotPotatoVectorReified<T extends TypeArgument> = Reified< HotPotatoVector<T>, HotPotatoVectorFields<T> >;
|
|
14
|
+
|
|
15
|
+
export class HotPotatoVector<T extends TypeArgument> implements StructClass { static readonly $typeName = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::hot_potato_vector::HotPotatoVector"; static readonly $numTypeParams = 1;
|
|
16
|
+
|
|
17
|
+
readonly $typeName = HotPotatoVector.$typeName;
|
|
18
|
+
|
|
19
|
+
readonly $fullTypeName: `0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::hot_potato_vector::HotPotatoVector<${ToTypeStr<T>}>`;
|
|
20
|
+
|
|
21
|
+
readonly $typeArgs: [ToTypeStr<T>];
|
|
22
|
+
|
|
23
|
+
readonly contents: ToField<Vector<T>>
|
|
24
|
+
|
|
25
|
+
private constructor(typeArgs: [ToTypeStr<T>], fields: HotPotatoVectorFields<T>, ) { this.$fullTypeName = composeSuiType( HotPotatoVector.$typeName, ...typeArgs ) as `0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::hot_potato_vector::HotPotatoVector<${ToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
26
|
+
|
|
27
|
+
this.contents = fields.contents; }
|
|
28
|
+
|
|
29
|
+
static reified<T extends Reified<TypeArgument, any>>( T: T ): HotPotatoVectorReified<ToTypeArgument<T>> { return { typeName: HotPotatoVector.$typeName, fullTypeName: composeSuiType( HotPotatoVector.$typeName, ...[extractType(T)] ) as `0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::hot_potato_vector::HotPotatoVector<${ToTypeStr<ToTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [ToTypeStr<ToTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => HotPotatoVector.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => HotPotatoVector.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => HotPotatoVector.fromBcs( T, data, ), bcs: HotPotatoVector.bcs(toBcs(T)), fromJSONField: (field: any) => HotPotatoVector.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => HotPotatoVector.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => HotPotatoVector.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => HotPotatoVector.fetch( client, T, id, ), new: ( fields: HotPotatoVectorFields<ToTypeArgument<T>>, ) => { return new HotPotatoVector( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
30
|
+
|
|
31
|
+
static get r() { return HotPotatoVector.reified }
|
|
32
|
+
|
|
33
|
+
static phantom<T extends Reified<TypeArgument, any>>( T: T ): PhantomReified<ToTypeStr<HotPotatoVector<ToTypeArgument<T>>>> { return phantom(HotPotatoVector.reified( T )); } static get p() { return HotPotatoVector.phantom }
|
|
34
|
+
|
|
35
|
+
static get bcs() { return <T extends BcsType<any>>(T: T) => bcs.struct(`HotPotatoVector<${T.name}>`, {
|
|
36
|
+
|
|
37
|
+
contents: bcs.vector(T)
|
|
38
|
+
|
|
39
|
+
}) };
|
|
40
|
+
|
|
41
|
+
static fromFields<T extends Reified<TypeArgument, any>>( typeArg: T, fields: Record<string, any> ): HotPotatoVector<ToTypeArgument<T>> { return HotPotatoVector.reified( typeArg, ).new( { contents: decodeFromFields(reified.vector(typeArg), fields.contents) } ) }
|
|
42
|
+
|
|
43
|
+
static fromFieldsWithTypes<T extends Reified<TypeArgument, any>>( typeArg: T, item: FieldsWithTypes ): HotPotatoVector<ToTypeArgument<T>> { if (!isHotPotatoVector(item.type)) { throw new Error("not a HotPotatoVector type");
|
|
44
|
+
|
|
45
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
46
|
+
|
|
47
|
+
return HotPotatoVector.reified( typeArg, ).new( { contents: decodeFromFieldsWithTypes(reified.vector(typeArg), item.fields.contents) } ) }
|
|
48
|
+
|
|
49
|
+
static fromBcs<T extends Reified<TypeArgument, any>>( typeArg: T, data: Uint8Array ): HotPotatoVector<ToTypeArgument<T>> { const typeArgs = [typeArg];
|
|
50
|
+
|
|
51
|
+
return HotPotatoVector.fromFields( typeArg, HotPotatoVector.bcs( toBcs(typeArgs[0]) ).parse(data) ) }
|
|
52
|
+
|
|
53
|
+
toJSONField() { return {
|
|
54
|
+
|
|
55
|
+
contents: fieldToJSON<Vector<T>>(`vector<${this.$typeArgs[0]}>`, this.contents),
|
|
56
|
+
|
|
57
|
+
} }
|
|
58
|
+
|
|
59
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
60
|
+
|
|
61
|
+
static fromJSONField<T extends Reified<TypeArgument, any>>( typeArg: T, field: any ): HotPotatoVector<ToTypeArgument<T>> { return HotPotatoVector.reified( typeArg, ).new( { contents: decodeFromJSONField(reified.vector(typeArg), field.contents) } ) }
|
|
62
|
+
|
|
63
|
+
static fromJSON<T extends Reified<TypeArgument, any>>( typeArg: T, json: Record<string, any> ): HotPotatoVector<ToTypeArgument<T>> { if (json.$typeName !== HotPotatoVector.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(HotPotatoVector.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
64
|
+
|
|
65
|
+
return HotPotatoVector.fromJSONField( typeArg, json, ) }
|
|
66
|
+
|
|
67
|
+
static fromSuiParsedData<T extends Reified<TypeArgument, any>>( typeArg: T, content: SuiParsedData ): HotPotatoVector<ToTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isHotPotatoVector(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a HotPotatoVector object`); } return HotPotatoVector.fromFieldsWithTypes( typeArg, content ); }
|
|
68
|
+
|
|
69
|
+
static async fetch<T extends Reified<TypeArgument, any>>( client: SuiClient, typeArg: T, id: string ): Promise<HotPotatoVector<ToTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching HotPotatoVector object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isHotPotatoVector(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a HotPotatoVector object`); }
|
|
70
|
+
return HotPotatoVector.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
71
|
+
|
|
72
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
4
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
5
|
+
|
|
6
|
+
/* ============================== I64 =============================== */
|
|
7
|
+
|
|
8
|
+
export function isI64(type: string): boolean { type = compressSuiType(type); return type === "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::i64::I64"; }
|
|
9
|
+
|
|
10
|
+
export interface I64Fields { negative: ToField<"bool">; magnitude: ToField<"u64"> }
|
|
11
|
+
|
|
12
|
+
export type I64Reified = Reified< I64, I64Fields >;
|
|
13
|
+
|
|
14
|
+
export class I64 implements StructClass { static readonly $typeName = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::i64::I64"; static readonly $numTypeParams = 0;
|
|
15
|
+
|
|
16
|
+
readonly $typeName = I64.$typeName;
|
|
17
|
+
|
|
18
|
+
readonly $fullTypeName: "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::i64::I64";
|
|
19
|
+
|
|
20
|
+
readonly $typeArgs: [];
|
|
21
|
+
|
|
22
|
+
readonly negative: ToField<"bool">; readonly magnitude: ToField<"u64">
|
|
23
|
+
|
|
24
|
+
private constructor(typeArgs: [], fields: I64Fields, ) { this.$fullTypeName = composeSuiType( I64.$typeName, ...typeArgs ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::i64::I64"; this.$typeArgs = typeArgs;
|
|
25
|
+
|
|
26
|
+
this.negative = fields.negative;; this.magnitude = fields.magnitude; }
|
|
27
|
+
|
|
28
|
+
static reified( ): I64Reified { return { typeName: I64.$typeName, fullTypeName: composeSuiType( I64.$typeName, ...[] ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::i64::I64", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => I64.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => I64.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => I64.fromBcs( data, ), bcs: I64.bcs, fromJSONField: (field: any) => I64.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => I64.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => I64.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => I64.fetch( client, id, ), new: ( fields: I64Fields, ) => { return new I64( [], fields ) }, kind: "StructClassReified", } }
|
|
29
|
+
|
|
30
|
+
static get r() { return I64.reified() }
|
|
31
|
+
|
|
32
|
+
static phantom( ): PhantomReified<ToTypeStr<I64>> { return phantom(I64.reified( )); } static get p() { return I64.phantom() }
|
|
33
|
+
|
|
34
|
+
static get bcs() { return bcs.struct("I64", {
|
|
35
|
+
|
|
36
|
+
negative: bcs.bool(), magnitude: bcs.u64()
|
|
37
|
+
|
|
38
|
+
}) };
|
|
39
|
+
|
|
40
|
+
static fromFields( fields: Record<string, any> ): I64 { return I64.reified( ).new( { negative: decodeFromFields("bool", fields.negative), magnitude: decodeFromFields("u64", fields.magnitude) } ) }
|
|
41
|
+
|
|
42
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): I64 { if (!isI64(item.type)) { throw new Error("not a I64 type");
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return I64.reified( ).new( { negative: decodeFromFieldsWithTypes("bool", item.fields.negative), magnitude: decodeFromFieldsWithTypes("u64", item.fields.magnitude) } ) }
|
|
47
|
+
|
|
48
|
+
static fromBcs( data: Uint8Array ): I64 { return I64.fromFields( I64.bcs.parse(data) ) }
|
|
49
|
+
|
|
50
|
+
toJSONField() { return {
|
|
51
|
+
|
|
52
|
+
negative: this.negative,magnitude: this.magnitude.toString(),
|
|
53
|
+
|
|
54
|
+
} }
|
|
55
|
+
|
|
56
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
57
|
+
|
|
58
|
+
static fromJSONField( field: any ): I64 { return I64.reified( ).new( { negative: decodeFromJSONField("bool", field.negative), magnitude: decodeFromJSONField("u64", field.magnitude) } ) }
|
|
59
|
+
|
|
60
|
+
static fromJSON( json: Record<string, any> ): I64 { if (json.$typeName !== I64.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
61
|
+
|
|
62
|
+
return I64.fromJSONField( json, ) }
|
|
63
|
+
|
|
64
|
+
static fromSuiParsedData( content: SuiParsedData ): I64 { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isI64(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a I64 object`); } return I64.fromFieldsWithTypes( content ); }
|
|
65
|
+
|
|
66
|
+
static async fetch( client: SuiClient, id: string ): Promise<I64> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching I64 object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isI64(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a I64 object`); }
|
|
67
|
+
return I64.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
68
|
+
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PACKAGE_ID = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3"; export const PUBLISHED_AT = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as batchPriceAttestation from "./batch-price-attestation/structs";
|
|
2
|
+
import * as contractUpgrade from "./contract-upgrade/structs";
|
|
3
|
+
import * as dataSource from "./data-source/structs";
|
|
4
|
+
import * as event from "./event/structs";
|
|
5
|
+
import * as governanceAction from "./governance-action/structs";
|
|
6
|
+
import * as governanceInstruction from "./governance-instruction/structs";
|
|
7
|
+
import * as governance from "./governance/structs";
|
|
8
|
+
import * as hotPotatoVector from "./hot-potato-vector/structs";
|
|
9
|
+
import * as i64 from "./i64/structs";
|
|
10
|
+
import * as migrate from "./migrate/structs";
|
|
11
|
+
import * as priceFeed from "./price-feed/structs";
|
|
12
|
+
import * as priceIdentifier from "./price-identifier/structs";
|
|
13
|
+
import * as priceInfo from "./price-info/structs";
|
|
14
|
+
import * as priceStatus from "./price-status/structs";
|
|
15
|
+
import * as price from "./price/structs";
|
|
16
|
+
import * as setDataSources from "./set-data-sources/structs";
|
|
17
|
+
import * as setFeeRecipient from "./set-fee-recipient/structs";
|
|
18
|
+
import * as setGovernanceDataSource from "./set-governance-data-source/structs";
|
|
19
|
+
import * as setStalePriceThreshold from "./set-stale-price-threshold/structs";
|
|
20
|
+
import * as setUpdateFee from "./set-update-fee/structs";
|
|
21
|
+
import * as set from "./set/structs";
|
|
22
|
+
import * as setup from "./setup/structs";
|
|
23
|
+
import * as state from "./state/structs";
|
|
24
|
+
import * as versionControl from "./version-control/structs";
|
|
25
|
+
import {StructClassLoader} from "../../../_framework/loader";
|
|
26
|
+
|
|
27
|
+
export function registerClasses(loader: StructClassLoader) { loader.register(versionControl.V__0_1_1);
|
|
28
|
+
loader.register(versionControl.V__DUMMY);
|
|
29
|
+
loader.register(priceIdentifier.PriceIdentifier);
|
|
30
|
+
loader.register(i64.I64);
|
|
31
|
+
loader.register(price.Price);
|
|
32
|
+
loader.register(priceFeed.PriceFeed);
|
|
33
|
+
loader.register(priceInfo.PriceInfo);
|
|
34
|
+
loader.register(priceInfo.PriceInfoObject);
|
|
35
|
+
loader.register(event.PriceFeedUpdateEvent);
|
|
36
|
+
loader.register(event.PythInitializationEvent);
|
|
37
|
+
loader.register(set.Set);
|
|
38
|
+
loader.register(set.Unit);
|
|
39
|
+
loader.register(dataSource.DataSource);
|
|
40
|
+
loader.register(state.CurrentDigest);
|
|
41
|
+
loader.register(state.LatestOnly);
|
|
42
|
+
loader.register(state.State);
|
|
43
|
+
loader.register(setup.DeployerCap);
|
|
44
|
+
loader.register(hotPotatoVector.HotPotatoVector);
|
|
45
|
+
loader.register(priceStatus.PriceStatus);
|
|
46
|
+
loader.register(batchPriceAttestation.BatchPriceAttestation);
|
|
47
|
+
loader.register(batchPriceAttestation.Header);
|
|
48
|
+
loader.register(governanceAction.GovernanceAction);
|
|
49
|
+
loader.register(governanceInstruction.GovernanceInstruction);
|
|
50
|
+
loader.register(setUpdateFee.UpdateFee);
|
|
51
|
+
loader.register(setStalePriceThreshold.StalePriceThreshold);
|
|
52
|
+
loader.register(setGovernanceDataSource.GovernanceDataSource);
|
|
53
|
+
loader.register(setFeeRecipient.PythFeeRecipient);
|
|
54
|
+
loader.register(setDataSources.DataSources);
|
|
55
|
+
loader.register(governance.WormholeVAAVerificationReceipt);
|
|
56
|
+
loader.register(contractUpgrade.ContractUpgraded);
|
|
57
|
+
loader.register(contractUpgrade.UpgradeContract);
|
|
58
|
+
loader.register(migrate.MigrateComplete);
|
|
59
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {ID} from "../../0x2/object/structs";
|
|
4
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
5
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
6
|
+
|
|
7
|
+
/* ============================== MigrateComplete =============================== */
|
|
8
|
+
|
|
9
|
+
export function isMigrateComplete(type: string): boolean { type = compressSuiType(type); return type === "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::migrate::MigrateComplete"; }
|
|
10
|
+
|
|
11
|
+
export interface MigrateCompleteFields { package: ToField<ID> }
|
|
12
|
+
|
|
13
|
+
export type MigrateCompleteReified = Reified< MigrateComplete, MigrateCompleteFields >;
|
|
14
|
+
|
|
15
|
+
export class MigrateComplete implements StructClass { static readonly $typeName = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::migrate::MigrateComplete"; static readonly $numTypeParams = 0;
|
|
16
|
+
|
|
17
|
+
readonly $typeName = MigrateComplete.$typeName;
|
|
18
|
+
|
|
19
|
+
readonly $fullTypeName: "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::migrate::MigrateComplete";
|
|
20
|
+
|
|
21
|
+
readonly $typeArgs: [];
|
|
22
|
+
|
|
23
|
+
readonly package: ToField<ID>
|
|
24
|
+
|
|
25
|
+
private constructor(typeArgs: [], fields: MigrateCompleteFields, ) { this.$fullTypeName = composeSuiType( MigrateComplete.$typeName, ...typeArgs ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::migrate::MigrateComplete"; this.$typeArgs = typeArgs;
|
|
26
|
+
|
|
27
|
+
this.package = fields.package; }
|
|
28
|
+
|
|
29
|
+
static reified( ): MigrateCompleteReified { return { typeName: MigrateComplete.$typeName, fullTypeName: composeSuiType( MigrateComplete.$typeName, ...[] ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::migrate::MigrateComplete", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => MigrateComplete.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => MigrateComplete.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => MigrateComplete.fromBcs( data, ), bcs: MigrateComplete.bcs, fromJSONField: (field: any) => MigrateComplete.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => MigrateComplete.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => MigrateComplete.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => MigrateComplete.fetch( client, id, ), new: ( fields: MigrateCompleteFields, ) => { return new MigrateComplete( [], fields ) }, kind: "StructClassReified", } }
|
|
30
|
+
|
|
31
|
+
static get r() { return MigrateComplete.reified() }
|
|
32
|
+
|
|
33
|
+
static phantom( ): PhantomReified<ToTypeStr<MigrateComplete>> { return phantom(MigrateComplete.reified( )); } static get p() { return MigrateComplete.phantom() }
|
|
34
|
+
|
|
35
|
+
static get bcs() { return bcs.struct("MigrateComplete", {
|
|
36
|
+
|
|
37
|
+
package: ID.bcs
|
|
38
|
+
|
|
39
|
+
}) };
|
|
40
|
+
|
|
41
|
+
static fromFields( fields: Record<string, any> ): MigrateComplete { return MigrateComplete.reified( ).new( { package: decodeFromFields(ID.reified(), fields.package) } ) }
|
|
42
|
+
|
|
43
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): MigrateComplete { if (!isMigrateComplete(item.type)) { throw new Error("not a MigrateComplete type");
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return MigrateComplete.reified( ).new( { package: decodeFromFieldsWithTypes(ID.reified(), item.fields.package) } ) }
|
|
48
|
+
|
|
49
|
+
static fromBcs( data: Uint8Array ): MigrateComplete { return MigrateComplete.fromFields( MigrateComplete.bcs.parse(data) ) }
|
|
50
|
+
|
|
51
|
+
toJSONField() { return {
|
|
52
|
+
|
|
53
|
+
package: this.package,
|
|
54
|
+
|
|
55
|
+
} }
|
|
56
|
+
|
|
57
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
58
|
+
|
|
59
|
+
static fromJSONField( field: any ): MigrateComplete { return MigrateComplete.reified( ).new( { package: decodeFromJSONField(ID.reified(), field.package) } ) }
|
|
60
|
+
|
|
61
|
+
static fromJSON( json: Record<string, any> ): MigrateComplete { if (json.$typeName !== MigrateComplete.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
62
|
+
|
|
63
|
+
return MigrateComplete.fromJSONField( json, ) }
|
|
64
|
+
|
|
65
|
+
static fromSuiParsedData( content: SuiParsedData ): MigrateComplete { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isMigrateComplete(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a MigrateComplete object`); } return MigrateComplete.fromFieldsWithTypes( content ); }
|
|
66
|
+
|
|
67
|
+
static async fetch( client: SuiClient, id: string ): Promise<MigrateComplete> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching MigrateComplete object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isMigrateComplete(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a MigrateComplete object`); }
|
|
68
|
+
return MigrateComplete.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
69
|
+
|
|
70
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {I64} from "../i64/structs";
|
|
4
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
5
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
6
|
+
|
|
7
|
+
/* ============================== Price =============================== */
|
|
8
|
+
|
|
9
|
+
export function isPrice(type: string): boolean { type = compressSuiType(type); return type === "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price::Price"; }
|
|
10
|
+
|
|
11
|
+
export interface PriceFields { price: ToField<I64>; conf: ToField<"u64">; expo: ToField<I64>; timestamp: ToField<"u64"> }
|
|
12
|
+
|
|
13
|
+
export type PriceReified = Reified< Price, PriceFields >;
|
|
14
|
+
|
|
15
|
+
export class Price implements StructClass { static readonly $typeName = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price::Price"; static readonly $numTypeParams = 0;
|
|
16
|
+
|
|
17
|
+
readonly $typeName = Price.$typeName;
|
|
18
|
+
|
|
19
|
+
readonly $fullTypeName: "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price::Price";
|
|
20
|
+
|
|
21
|
+
readonly $typeArgs: [];
|
|
22
|
+
|
|
23
|
+
readonly price: ToField<I64>; readonly conf: ToField<"u64">; readonly expo: ToField<I64>; readonly timestamp: ToField<"u64">
|
|
24
|
+
|
|
25
|
+
private constructor(typeArgs: [], fields: PriceFields, ) { this.$fullTypeName = composeSuiType( Price.$typeName, ...typeArgs ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price::Price"; this.$typeArgs = typeArgs;
|
|
26
|
+
|
|
27
|
+
this.price = fields.price;; this.conf = fields.conf;; this.expo = fields.expo;; this.timestamp = fields.timestamp; }
|
|
28
|
+
|
|
29
|
+
static reified( ): PriceReified { return { typeName: Price.$typeName, fullTypeName: composeSuiType( Price.$typeName, ...[] ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price::Price", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Price.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Price.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Price.fromBcs( data, ), bcs: Price.bcs, fromJSONField: (field: any) => Price.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Price.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Price.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Price.fetch( client, id, ), new: ( fields: PriceFields, ) => { return new Price( [], fields ) }, kind: "StructClassReified", } }
|
|
30
|
+
|
|
31
|
+
static get r() { return Price.reified() }
|
|
32
|
+
|
|
33
|
+
static phantom( ): PhantomReified<ToTypeStr<Price>> { return phantom(Price.reified( )); } static get p() { return Price.phantom() }
|
|
34
|
+
|
|
35
|
+
static get bcs() { return bcs.struct("Price", {
|
|
36
|
+
|
|
37
|
+
price: I64.bcs, conf: bcs.u64(), expo: I64.bcs, timestamp: bcs.u64()
|
|
38
|
+
|
|
39
|
+
}) };
|
|
40
|
+
|
|
41
|
+
static fromFields( fields: Record<string, any> ): Price { return Price.reified( ).new( { price: decodeFromFields(I64.reified(), fields.price), conf: decodeFromFields("u64", fields.conf), expo: decodeFromFields(I64.reified(), fields.expo), timestamp: decodeFromFields("u64", fields.timestamp) } ) }
|
|
42
|
+
|
|
43
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Price { if (!isPrice(item.type)) { throw new Error("not a Price type");
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return Price.reified( ).new( { price: decodeFromFieldsWithTypes(I64.reified(), item.fields.price), conf: decodeFromFieldsWithTypes("u64", item.fields.conf), expo: decodeFromFieldsWithTypes(I64.reified(), item.fields.expo), timestamp: decodeFromFieldsWithTypes("u64", item.fields.timestamp) } ) }
|
|
48
|
+
|
|
49
|
+
static fromBcs( data: Uint8Array ): Price { return Price.fromFields( Price.bcs.parse(data) ) }
|
|
50
|
+
|
|
51
|
+
toJSONField() { return {
|
|
52
|
+
|
|
53
|
+
price: this.price.toJSONField(),conf: this.conf.toString(),expo: this.expo.toJSONField(),timestamp: this.timestamp.toString(),
|
|
54
|
+
|
|
55
|
+
} }
|
|
56
|
+
|
|
57
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
58
|
+
|
|
59
|
+
static fromJSONField( field: any ): Price { return Price.reified( ).new( { price: decodeFromJSONField(I64.reified(), field.price), conf: decodeFromJSONField("u64", field.conf), expo: decodeFromJSONField(I64.reified(), field.expo), timestamp: decodeFromJSONField("u64", field.timestamp) } ) }
|
|
60
|
+
|
|
61
|
+
static fromJSON( json: Record<string, any> ): Price { if (json.$typeName !== Price.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
62
|
+
|
|
63
|
+
return Price.fromJSONField( json, ) }
|
|
64
|
+
|
|
65
|
+
static fromSuiParsedData( content: SuiParsedData ): Price { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isPrice(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Price object`); } return Price.fromFieldsWithTypes( content ); }
|
|
66
|
+
|
|
67
|
+
static async fetch( client: SuiClient, id: string ): Promise<Price> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Price object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isPrice(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Price object`); }
|
|
68
|
+
return Price.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
69
|
+
|
|
70
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {PriceIdentifier} from "../price-identifier/structs";
|
|
4
|
+
import {Price} from "../price/structs";
|
|
5
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
6
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
7
|
+
|
|
8
|
+
/* ============================== PriceFeed =============================== */
|
|
9
|
+
|
|
10
|
+
export function isPriceFeed(type: string): boolean { type = compressSuiType(type); return type === "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price_feed::PriceFeed"; }
|
|
11
|
+
|
|
12
|
+
export interface PriceFeedFields { priceIdentifier: ToField<PriceIdentifier>; price: ToField<Price>; emaPrice: ToField<Price> }
|
|
13
|
+
|
|
14
|
+
export type PriceFeedReified = Reified< PriceFeed, PriceFeedFields >;
|
|
15
|
+
|
|
16
|
+
export class PriceFeed implements StructClass { static readonly $typeName = "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price_feed::PriceFeed"; static readonly $numTypeParams = 0;
|
|
17
|
+
|
|
18
|
+
readonly $typeName = PriceFeed.$typeName;
|
|
19
|
+
|
|
20
|
+
readonly $fullTypeName: "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price_feed::PriceFeed";
|
|
21
|
+
|
|
22
|
+
readonly $typeArgs: [];
|
|
23
|
+
|
|
24
|
+
readonly priceIdentifier: ToField<PriceIdentifier>; readonly price: ToField<Price>; readonly emaPrice: ToField<Price>
|
|
25
|
+
|
|
26
|
+
private constructor(typeArgs: [], fields: PriceFeedFields, ) { this.$fullTypeName = composeSuiType( PriceFeed.$typeName, ...typeArgs ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price_feed::PriceFeed"; this.$typeArgs = typeArgs;
|
|
27
|
+
|
|
28
|
+
this.priceIdentifier = fields.priceIdentifier;; this.price = fields.price;; this.emaPrice = fields.emaPrice; }
|
|
29
|
+
|
|
30
|
+
static reified( ): PriceFeedReified { return { typeName: PriceFeed.$typeName, fullTypeName: composeSuiType( PriceFeed.$typeName, ...[] ) as "0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3::price_feed::PriceFeed", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => PriceFeed.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => PriceFeed.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => PriceFeed.fromBcs( data, ), bcs: PriceFeed.bcs, fromJSONField: (field: any) => PriceFeed.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => PriceFeed.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => PriceFeed.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => PriceFeed.fetch( client, id, ), new: ( fields: PriceFeedFields, ) => { return new PriceFeed( [], fields ) }, kind: "StructClassReified", } }
|
|
31
|
+
|
|
32
|
+
static get r() { return PriceFeed.reified() }
|
|
33
|
+
|
|
34
|
+
static phantom( ): PhantomReified<ToTypeStr<PriceFeed>> { return phantom(PriceFeed.reified( )); } static get p() { return PriceFeed.phantom() }
|
|
35
|
+
|
|
36
|
+
static get bcs() { return bcs.struct("PriceFeed", {
|
|
37
|
+
|
|
38
|
+
price_identifier: PriceIdentifier.bcs, price: Price.bcs, ema_price: Price.bcs
|
|
39
|
+
|
|
40
|
+
}) };
|
|
41
|
+
|
|
42
|
+
static fromFields( fields: Record<string, any> ): PriceFeed { return PriceFeed.reified( ).new( { priceIdentifier: decodeFromFields(PriceIdentifier.reified(), fields.price_identifier), price: decodeFromFields(Price.reified(), fields.price), emaPrice: decodeFromFields(Price.reified(), fields.ema_price) } ) }
|
|
43
|
+
|
|
44
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): PriceFeed { if (!isPriceFeed(item.type)) { throw new Error("not a PriceFeed type");
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return PriceFeed.reified( ).new( { priceIdentifier: decodeFromFieldsWithTypes(PriceIdentifier.reified(), item.fields.price_identifier), price: decodeFromFieldsWithTypes(Price.reified(), item.fields.price), emaPrice: decodeFromFieldsWithTypes(Price.reified(), item.fields.ema_price) } ) }
|
|
49
|
+
|
|
50
|
+
static fromBcs( data: Uint8Array ): PriceFeed { return PriceFeed.fromFields( PriceFeed.bcs.parse(data) ) }
|
|
51
|
+
|
|
52
|
+
toJSONField() { return {
|
|
53
|
+
|
|
54
|
+
priceIdentifier: this.priceIdentifier.toJSONField(),price: this.price.toJSONField(),emaPrice: this.emaPrice.toJSONField(),
|
|
55
|
+
|
|
56
|
+
} }
|
|
57
|
+
|
|
58
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
59
|
+
|
|
60
|
+
static fromJSONField( field: any ): PriceFeed { return PriceFeed.reified( ).new( { priceIdentifier: decodeFromJSONField(PriceIdentifier.reified(), field.priceIdentifier), price: decodeFromJSONField(Price.reified(), field.price), emaPrice: decodeFromJSONField(Price.reified(), field.emaPrice) } ) }
|
|
61
|
+
|
|
62
|
+
static fromJSON( json: Record<string, any> ): PriceFeed { if (json.$typeName !== PriceFeed.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
63
|
+
|
|
64
|
+
return PriceFeed.fromJSONField( json, ) }
|
|
65
|
+
|
|
66
|
+
static fromSuiParsedData( content: SuiParsedData ): PriceFeed { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isPriceFeed(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a PriceFeed object`); } return PriceFeed.fromFieldsWithTypes( content ); }
|
|
67
|
+
|
|
68
|
+
static async fetch( client: SuiClient, id: string ): Promise<PriceFeed> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching PriceFeed object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isPriceFeed(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a PriceFeed object`); }
|
|
69
|
+
return PriceFeed.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
70
|
+
|
|
71
|
+
}
|