@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,70 @@
|
|
|
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 {bcs, fromB64} from "@mysten/bcs";
|
|
5
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
6
|
+
|
|
7
|
+
/* ============================== BCS =============================== */
|
|
8
|
+
|
|
9
|
+
export function isBCS(type: string): boolean { type = compressSuiType(type); return type === "0x2::bcs::BCS"; }
|
|
10
|
+
|
|
11
|
+
export interface BCSFields { bytes: ToField<Vector<"u8">> }
|
|
12
|
+
|
|
13
|
+
export type BCSReified = Reified< BCS, BCSFields >;
|
|
14
|
+
|
|
15
|
+
export class BCS implements StructClass { static readonly $typeName = "0x2::bcs::BCS"; static readonly $numTypeParams = 0;
|
|
16
|
+
|
|
17
|
+
readonly $typeName = BCS.$typeName;
|
|
18
|
+
|
|
19
|
+
readonly $fullTypeName: "0x2::bcs::BCS";
|
|
20
|
+
|
|
21
|
+
readonly $typeArgs: [];
|
|
22
|
+
|
|
23
|
+
readonly bytes: ToField<Vector<"u8">>
|
|
24
|
+
|
|
25
|
+
private constructor(typeArgs: [], fields: BCSFields, ) { this.$fullTypeName = composeSuiType( BCS.$typeName, ...typeArgs ) as "0x2::bcs::BCS"; this.$typeArgs = typeArgs;
|
|
26
|
+
|
|
27
|
+
this.bytes = fields.bytes; }
|
|
28
|
+
|
|
29
|
+
static reified( ): BCSReified { return { typeName: BCS.$typeName, fullTypeName: composeSuiType( BCS.$typeName, ...[] ) as "0x2::bcs::BCS", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => BCS.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => BCS.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => BCS.fromBcs( data, ), bcs: BCS.bcs, fromJSONField: (field: any) => BCS.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => BCS.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => BCS.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => BCS.fetch( client, id, ), new: ( fields: BCSFields, ) => { return new BCS( [], fields ) }, kind: "StructClassReified", } }
|
|
30
|
+
|
|
31
|
+
static get r() { return BCS.reified() }
|
|
32
|
+
|
|
33
|
+
static phantom( ): PhantomReified<ToTypeStr<BCS>> { return phantom(BCS.reified( )); } static get p() { return BCS.phantom() }
|
|
34
|
+
|
|
35
|
+
static get bcs() { return bcs.struct("BCS", {
|
|
36
|
+
|
|
37
|
+
bytes: bcs.vector(bcs.u8())
|
|
38
|
+
|
|
39
|
+
}) };
|
|
40
|
+
|
|
41
|
+
static fromFields( fields: Record<string, any> ): BCS { return BCS.reified( ).new( { bytes: decodeFromFields(reified.vector("u8"), fields.bytes) } ) }
|
|
42
|
+
|
|
43
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): BCS { if (!isBCS(item.type)) { throw new Error("not a BCS type");
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return BCS.reified( ).new( { bytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.bytes) } ) }
|
|
48
|
+
|
|
49
|
+
static fromBcs( data: Uint8Array ): BCS { return BCS.fromFields( BCS.bcs.parse(data) ) }
|
|
50
|
+
|
|
51
|
+
toJSONField() { return {
|
|
52
|
+
|
|
53
|
+
bytes: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.bytes),
|
|
54
|
+
|
|
55
|
+
} }
|
|
56
|
+
|
|
57
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
58
|
+
|
|
59
|
+
static fromJSONField( field: any ): BCS { return BCS.reified( ).new( { bytes: decodeFromJSONField(reified.vector("u8"), field.bytes) } ) }
|
|
60
|
+
|
|
61
|
+
static fromJSON( json: Record<string, any> ): BCS { if (json.$typeName !== BCS.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
62
|
+
|
|
63
|
+
return BCS.fromJSONField( json, ) }
|
|
64
|
+
|
|
65
|
+
static fromSuiParsedData( content: SuiParsedData ): BCS { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isBCS(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a BCS object`); } return BCS.fromFieldsWithTypes( content ); }
|
|
66
|
+
|
|
67
|
+
static async fetch( client: SuiClient, id: string ): Promise<BCS> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching BCS object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isBCS(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a BCS object`); }
|
|
68
|
+
return BCS.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
69
|
+
|
|
70
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
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
|
+
/* ============================== G1 =============================== */
|
|
7
|
+
|
|
8
|
+
export function isG1(type: string): boolean { type = compressSuiType(type); return type === "0x2::bls12381::G1"; }
|
|
9
|
+
|
|
10
|
+
export interface G1Fields { dummyField: ToField<"bool"> }
|
|
11
|
+
|
|
12
|
+
export type G1Reified = Reified< G1, G1Fields >;
|
|
13
|
+
|
|
14
|
+
export class G1 implements StructClass { static readonly $typeName = "0x2::bls12381::G1"; static readonly $numTypeParams = 0;
|
|
15
|
+
|
|
16
|
+
readonly $typeName = G1.$typeName;
|
|
17
|
+
|
|
18
|
+
readonly $fullTypeName: "0x2::bls12381::G1";
|
|
19
|
+
|
|
20
|
+
readonly $typeArgs: [];
|
|
21
|
+
|
|
22
|
+
readonly dummyField: ToField<"bool">
|
|
23
|
+
|
|
24
|
+
private constructor(typeArgs: [], fields: G1Fields, ) { this.$fullTypeName = composeSuiType( G1.$typeName, ...typeArgs ) as "0x2::bls12381::G1"; this.$typeArgs = typeArgs;
|
|
25
|
+
|
|
26
|
+
this.dummyField = fields.dummyField; }
|
|
27
|
+
|
|
28
|
+
static reified( ): G1Reified { return { typeName: G1.$typeName, fullTypeName: composeSuiType( G1.$typeName, ...[] ) as "0x2::bls12381::G1", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => G1.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => G1.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => G1.fromBcs( data, ), bcs: G1.bcs, fromJSONField: (field: any) => G1.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => G1.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => G1.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => G1.fetch( client, id, ), new: ( fields: G1Fields, ) => { return new G1( [], fields ) }, kind: "StructClassReified", } }
|
|
29
|
+
|
|
30
|
+
static get r() { return G1.reified() }
|
|
31
|
+
|
|
32
|
+
static phantom( ): PhantomReified<ToTypeStr<G1>> { return phantom(G1.reified( )); } static get p() { return G1.phantom() }
|
|
33
|
+
|
|
34
|
+
static get bcs() { return bcs.struct("G1", {
|
|
35
|
+
|
|
36
|
+
dummy_field: bcs.bool()
|
|
37
|
+
|
|
38
|
+
}) };
|
|
39
|
+
|
|
40
|
+
static fromFields( fields: Record<string, any> ): G1 { return G1.reified( ).new( { dummyField: decodeFromFields("bool", fields.dummy_field) } ) }
|
|
41
|
+
|
|
42
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): G1 { if (!isG1(item.type)) { throw new Error("not a G1 type");
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return G1.reified( ).new( { dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field) } ) }
|
|
47
|
+
|
|
48
|
+
static fromBcs( data: Uint8Array ): G1 { return G1.fromFields( G1.bcs.parse(data) ) }
|
|
49
|
+
|
|
50
|
+
toJSONField() { return {
|
|
51
|
+
|
|
52
|
+
dummyField: this.dummyField,
|
|
53
|
+
|
|
54
|
+
} }
|
|
55
|
+
|
|
56
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
57
|
+
|
|
58
|
+
static fromJSONField( field: any ): G1 { return G1.reified( ).new( { dummyField: decodeFromJSONField("bool", field.dummyField) } ) }
|
|
59
|
+
|
|
60
|
+
static fromJSON( json: Record<string, any> ): G1 { if (json.$typeName !== G1.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
61
|
+
|
|
62
|
+
return G1.fromJSONField( json, ) }
|
|
63
|
+
|
|
64
|
+
static fromSuiParsedData( content: SuiParsedData ): G1 { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isG1(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a G1 object`); } return G1.fromFieldsWithTypes( content ); }
|
|
65
|
+
|
|
66
|
+
static async fetch( client: SuiClient, id: string ): Promise<G1> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching G1 object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isG1(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a G1 object`); }
|
|
67
|
+
return G1.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ============================== G2 =============================== */
|
|
72
|
+
|
|
73
|
+
export function isG2(type: string): boolean { type = compressSuiType(type); return type === "0x2::bls12381::G2"; }
|
|
74
|
+
|
|
75
|
+
export interface G2Fields { dummyField: ToField<"bool"> }
|
|
76
|
+
|
|
77
|
+
export type G2Reified = Reified< G2, G2Fields >;
|
|
78
|
+
|
|
79
|
+
export class G2 implements StructClass { static readonly $typeName = "0x2::bls12381::G2"; static readonly $numTypeParams = 0;
|
|
80
|
+
|
|
81
|
+
readonly $typeName = G2.$typeName;
|
|
82
|
+
|
|
83
|
+
readonly $fullTypeName: "0x2::bls12381::G2";
|
|
84
|
+
|
|
85
|
+
readonly $typeArgs: [];
|
|
86
|
+
|
|
87
|
+
readonly dummyField: ToField<"bool">
|
|
88
|
+
|
|
89
|
+
private constructor(typeArgs: [], fields: G2Fields, ) { this.$fullTypeName = composeSuiType( G2.$typeName, ...typeArgs ) as "0x2::bls12381::G2"; this.$typeArgs = typeArgs;
|
|
90
|
+
|
|
91
|
+
this.dummyField = fields.dummyField; }
|
|
92
|
+
|
|
93
|
+
static reified( ): G2Reified { return { typeName: G2.$typeName, fullTypeName: composeSuiType( G2.$typeName, ...[] ) as "0x2::bls12381::G2", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => G2.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => G2.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => G2.fromBcs( data, ), bcs: G2.bcs, fromJSONField: (field: any) => G2.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => G2.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => G2.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => G2.fetch( client, id, ), new: ( fields: G2Fields, ) => { return new G2( [], fields ) }, kind: "StructClassReified", } }
|
|
94
|
+
|
|
95
|
+
static get r() { return G2.reified() }
|
|
96
|
+
|
|
97
|
+
static phantom( ): PhantomReified<ToTypeStr<G2>> { return phantom(G2.reified( )); } static get p() { return G2.phantom() }
|
|
98
|
+
|
|
99
|
+
static get bcs() { return bcs.struct("G2", {
|
|
100
|
+
|
|
101
|
+
dummy_field: bcs.bool()
|
|
102
|
+
|
|
103
|
+
}) };
|
|
104
|
+
|
|
105
|
+
static fromFields( fields: Record<string, any> ): G2 { return G2.reified( ).new( { dummyField: decodeFromFields("bool", fields.dummy_field) } ) }
|
|
106
|
+
|
|
107
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): G2 { if (!isG2(item.type)) { throw new Error("not a G2 type");
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return G2.reified( ).new( { dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field) } ) }
|
|
112
|
+
|
|
113
|
+
static fromBcs( data: Uint8Array ): G2 { return G2.fromFields( G2.bcs.parse(data) ) }
|
|
114
|
+
|
|
115
|
+
toJSONField() { return {
|
|
116
|
+
|
|
117
|
+
dummyField: this.dummyField,
|
|
118
|
+
|
|
119
|
+
} }
|
|
120
|
+
|
|
121
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
122
|
+
|
|
123
|
+
static fromJSONField( field: any ): G2 { return G2.reified( ).new( { dummyField: decodeFromJSONField("bool", field.dummyField) } ) }
|
|
124
|
+
|
|
125
|
+
static fromJSON( json: Record<string, any> ): G2 { if (json.$typeName !== G2.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
126
|
+
|
|
127
|
+
return G2.fromJSONField( json, ) }
|
|
128
|
+
|
|
129
|
+
static fromSuiParsedData( content: SuiParsedData ): G2 { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isG2(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a G2 object`); } return G2.fromFieldsWithTypes( content ); }
|
|
130
|
+
|
|
131
|
+
static async fetch( client: SuiClient, id: string ): Promise<G2> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching G2 object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isG2(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a G2 object`); }
|
|
132
|
+
return G2.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* ============================== GT =============================== */
|
|
137
|
+
|
|
138
|
+
export function isGT(type: string): boolean { type = compressSuiType(type); return type === "0x2::bls12381::GT"; }
|
|
139
|
+
|
|
140
|
+
export interface GTFields { dummyField: ToField<"bool"> }
|
|
141
|
+
|
|
142
|
+
export type GTReified = Reified< GT, GTFields >;
|
|
143
|
+
|
|
144
|
+
export class GT implements StructClass { static readonly $typeName = "0x2::bls12381::GT"; static readonly $numTypeParams = 0;
|
|
145
|
+
|
|
146
|
+
readonly $typeName = GT.$typeName;
|
|
147
|
+
|
|
148
|
+
readonly $fullTypeName: "0x2::bls12381::GT";
|
|
149
|
+
|
|
150
|
+
readonly $typeArgs: [];
|
|
151
|
+
|
|
152
|
+
readonly dummyField: ToField<"bool">
|
|
153
|
+
|
|
154
|
+
private constructor(typeArgs: [], fields: GTFields, ) { this.$fullTypeName = composeSuiType( GT.$typeName, ...typeArgs ) as "0x2::bls12381::GT"; this.$typeArgs = typeArgs;
|
|
155
|
+
|
|
156
|
+
this.dummyField = fields.dummyField; }
|
|
157
|
+
|
|
158
|
+
static reified( ): GTReified { return { typeName: GT.$typeName, fullTypeName: composeSuiType( GT.$typeName, ...[] ) as "0x2::bls12381::GT", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => GT.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => GT.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => GT.fromBcs( data, ), bcs: GT.bcs, fromJSONField: (field: any) => GT.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => GT.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => GT.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => GT.fetch( client, id, ), new: ( fields: GTFields, ) => { return new GT( [], fields ) }, kind: "StructClassReified", } }
|
|
159
|
+
|
|
160
|
+
static get r() { return GT.reified() }
|
|
161
|
+
|
|
162
|
+
static phantom( ): PhantomReified<ToTypeStr<GT>> { return phantom(GT.reified( )); } static get p() { return GT.phantom() }
|
|
163
|
+
|
|
164
|
+
static get bcs() { return bcs.struct("GT", {
|
|
165
|
+
|
|
166
|
+
dummy_field: bcs.bool()
|
|
167
|
+
|
|
168
|
+
}) };
|
|
169
|
+
|
|
170
|
+
static fromFields( fields: Record<string, any> ): GT { return GT.reified( ).new( { dummyField: decodeFromFields("bool", fields.dummy_field) } ) }
|
|
171
|
+
|
|
172
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): GT { if (!isGT(item.type)) { throw new Error("not a GT type");
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return GT.reified( ).new( { dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field) } ) }
|
|
177
|
+
|
|
178
|
+
static fromBcs( data: Uint8Array ): GT { return GT.fromFields( GT.bcs.parse(data) ) }
|
|
179
|
+
|
|
180
|
+
toJSONField() { return {
|
|
181
|
+
|
|
182
|
+
dummyField: this.dummyField,
|
|
183
|
+
|
|
184
|
+
} }
|
|
185
|
+
|
|
186
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
187
|
+
|
|
188
|
+
static fromJSONField( field: any ): GT { return GT.reified( ).new( { dummyField: decodeFromJSONField("bool", field.dummyField) } ) }
|
|
189
|
+
|
|
190
|
+
static fromJSON( json: Record<string, any> ): GT { if (json.$typeName !== GT.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
191
|
+
|
|
192
|
+
return GT.fromJSONField( json, ) }
|
|
193
|
+
|
|
194
|
+
static fromSuiParsedData( content: SuiParsedData ): GT { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isGT(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a GT object`); } return GT.fromFieldsWithTypes( content ); }
|
|
195
|
+
|
|
196
|
+
static async fetch( client: SuiClient, id: string ): Promise<GT> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching GT object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isGT(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a GT object`); }
|
|
197
|
+
return GT.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
198
|
+
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* ============================== Scalar =============================== */
|
|
202
|
+
|
|
203
|
+
export function isScalar(type: string): boolean { type = compressSuiType(type); return type === "0x2::bls12381::Scalar"; }
|
|
204
|
+
|
|
205
|
+
export interface ScalarFields { dummyField: ToField<"bool"> }
|
|
206
|
+
|
|
207
|
+
export type ScalarReified = Reified< Scalar, ScalarFields >;
|
|
208
|
+
|
|
209
|
+
export class Scalar implements StructClass { static readonly $typeName = "0x2::bls12381::Scalar"; static readonly $numTypeParams = 0;
|
|
210
|
+
|
|
211
|
+
readonly $typeName = Scalar.$typeName;
|
|
212
|
+
|
|
213
|
+
readonly $fullTypeName: "0x2::bls12381::Scalar";
|
|
214
|
+
|
|
215
|
+
readonly $typeArgs: [];
|
|
216
|
+
|
|
217
|
+
readonly dummyField: ToField<"bool">
|
|
218
|
+
|
|
219
|
+
private constructor(typeArgs: [], fields: ScalarFields, ) { this.$fullTypeName = composeSuiType( Scalar.$typeName, ...typeArgs ) as "0x2::bls12381::Scalar"; this.$typeArgs = typeArgs;
|
|
220
|
+
|
|
221
|
+
this.dummyField = fields.dummyField; }
|
|
222
|
+
|
|
223
|
+
static reified( ): ScalarReified { return { typeName: Scalar.$typeName, fullTypeName: composeSuiType( Scalar.$typeName, ...[] ) as "0x2::bls12381::Scalar", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Scalar.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Scalar.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Scalar.fromBcs( data, ), bcs: Scalar.bcs, fromJSONField: (field: any) => Scalar.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Scalar.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Scalar.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Scalar.fetch( client, id, ), new: ( fields: ScalarFields, ) => { return new Scalar( [], fields ) }, kind: "StructClassReified", } }
|
|
224
|
+
|
|
225
|
+
static get r() { return Scalar.reified() }
|
|
226
|
+
|
|
227
|
+
static phantom( ): PhantomReified<ToTypeStr<Scalar>> { return phantom(Scalar.reified( )); } static get p() { return Scalar.phantom() }
|
|
228
|
+
|
|
229
|
+
static get bcs() { return bcs.struct("Scalar", {
|
|
230
|
+
|
|
231
|
+
dummy_field: bcs.bool()
|
|
232
|
+
|
|
233
|
+
}) };
|
|
234
|
+
|
|
235
|
+
static fromFields( fields: Record<string, any> ): Scalar { return Scalar.reified( ).new( { dummyField: decodeFromFields("bool", fields.dummy_field) } ) }
|
|
236
|
+
|
|
237
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Scalar { if (!isScalar(item.type)) { throw new Error("not a Scalar type");
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return Scalar.reified( ).new( { dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field) } ) }
|
|
242
|
+
|
|
243
|
+
static fromBcs( data: Uint8Array ): Scalar { return Scalar.fromFields( Scalar.bcs.parse(data) ) }
|
|
244
|
+
|
|
245
|
+
toJSONField() { return {
|
|
246
|
+
|
|
247
|
+
dummyField: this.dummyField,
|
|
248
|
+
|
|
249
|
+
} }
|
|
250
|
+
|
|
251
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
252
|
+
|
|
253
|
+
static fromJSONField( field: any ): Scalar { return Scalar.reified( ).new( { dummyField: decodeFromJSONField("bool", field.dummyField) } ) }
|
|
254
|
+
|
|
255
|
+
static fromJSON( json: Record<string, any> ): Scalar { if (json.$typeName !== Scalar.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
256
|
+
|
|
257
|
+
return Scalar.fromJSONField( json, ) }
|
|
258
|
+
|
|
259
|
+
static fromSuiParsedData( content: SuiParsedData ): Scalar { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isScalar(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Scalar object`); } return Scalar.fromFieldsWithTypes( content ); }
|
|
260
|
+
|
|
261
|
+
static async fetch( client: SuiClient, id: string ): Promise<Scalar> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Scalar object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isScalar(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Scalar object`); }
|
|
262
|
+
return Scalar.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
263
|
+
|
|
264
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeArgument, ToTypeStr, TypeArgument, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {Option} from "../../0x1/option/structs";
|
|
4
|
+
import {ID} from "../object/structs";
|
|
5
|
+
import {BcsType, bcs, fromB64, fromHEX, toHEX} from "@mysten/bcs";
|
|
6
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
7
|
+
|
|
8
|
+
/* ============================== Borrow =============================== */
|
|
9
|
+
|
|
10
|
+
export function isBorrow(type: string): boolean { type = compressSuiType(type); return type === "0x2::borrow::Borrow"; }
|
|
11
|
+
|
|
12
|
+
export interface BorrowFields { ref: ToField<"address">; obj: ToField<ID> }
|
|
13
|
+
|
|
14
|
+
export type BorrowReified = Reified< Borrow, BorrowFields >;
|
|
15
|
+
|
|
16
|
+
export class Borrow implements StructClass { static readonly $typeName = "0x2::borrow::Borrow"; static readonly $numTypeParams = 0;
|
|
17
|
+
|
|
18
|
+
readonly $typeName = Borrow.$typeName;
|
|
19
|
+
|
|
20
|
+
readonly $fullTypeName: "0x2::borrow::Borrow";
|
|
21
|
+
|
|
22
|
+
readonly $typeArgs: [];
|
|
23
|
+
|
|
24
|
+
readonly ref: ToField<"address">; readonly obj: ToField<ID>
|
|
25
|
+
|
|
26
|
+
private constructor(typeArgs: [], fields: BorrowFields, ) { this.$fullTypeName = composeSuiType( Borrow.$typeName, ...typeArgs ) as "0x2::borrow::Borrow"; this.$typeArgs = typeArgs;
|
|
27
|
+
|
|
28
|
+
this.ref = fields.ref;; this.obj = fields.obj; }
|
|
29
|
+
|
|
30
|
+
static reified( ): BorrowReified { return { typeName: Borrow.$typeName, fullTypeName: composeSuiType( Borrow.$typeName, ...[] ) as "0x2::borrow::Borrow", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Borrow.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Borrow.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Borrow.fromBcs( data, ), bcs: Borrow.bcs, fromJSONField: (field: any) => Borrow.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Borrow.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Borrow.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Borrow.fetch( client, id, ), new: ( fields: BorrowFields, ) => { return new Borrow( [], fields ) }, kind: "StructClassReified", } }
|
|
31
|
+
|
|
32
|
+
static get r() { return Borrow.reified() }
|
|
33
|
+
|
|
34
|
+
static phantom( ): PhantomReified<ToTypeStr<Borrow>> { return phantom(Borrow.reified( )); } static get p() { return Borrow.phantom() }
|
|
35
|
+
|
|
36
|
+
static get bcs() { return bcs.struct("Borrow", {
|
|
37
|
+
|
|
38
|
+
ref: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val), }), obj: ID.bcs
|
|
39
|
+
|
|
40
|
+
}) };
|
|
41
|
+
|
|
42
|
+
static fromFields( fields: Record<string, any> ): Borrow { return Borrow.reified( ).new( { ref: decodeFromFields("address", fields.ref), obj: decodeFromFields(ID.reified(), fields.obj) } ) }
|
|
43
|
+
|
|
44
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Borrow { if (!isBorrow(item.type)) { throw new Error("not a Borrow type");
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return Borrow.reified( ).new( { ref: decodeFromFieldsWithTypes("address", item.fields.ref), obj: decodeFromFieldsWithTypes(ID.reified(), item.fields.obj) } ) }
|
|
49
|
+
|
|
50
|
+
static fromBcs( data: Uint8Array ): Borrow { return Borrow.fromFields( Borrow.bcs.parse(data) ) }
|
|
51
|
+
|
|
52
|
+
toJSONField() { return {
|
|
53
|
+
|
|
54
|
+
ref: this.ref,obj: this.obj,
|
|
55
|
+
|
|
56
|
+
} }
|
|
57
|
+
|
|
58
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
59
|
+
|
|
60
|
+
static fromJSONField( field: any ): Borrow { return Borrow.reified( ).new( { ref: decodeFromJSONField("address", field.ref), obj: decodeFromJSONField(ID.reified(), field.obj) } ) }
|
|
61
|
+
|
|
62
|
+
static fromJSON( json: Record<string, any> ): Borrow { if (json.$typeName !== Borrow.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
63
|
+
|
|
64
|
+
return Borrow.fromJSONField( json, ) }
|
|
65
|
+
|
|
66
|
+
static fromSuiParsedData( content: SuiParsedData ): Borrow { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isBorrow(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Borrow object`); } return Borrow.fromFieldsWithTypes( content ); }
|
|
67
|
+
|
|
68
|
+
static async fetch( client: SuiClient, id: string ): Promise<Borrow> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Borrow object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isBorrow(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Borrow object`); }
|
|
69
|
+
return Borrow.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* ============================== Referent =============================== */
|
|
74
|
+
|
|
75
|
+
export function isReferent(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::borrow::Referent<"); }
|
|
76
|
+
|
|
77
|
+
export interface ReferentFields<T extends TypeArgument> { id: ToField<"address">; value: ToField<Option<T>> }
|
|
78
|
+
|
|
79
|
+
export type ReferentReified<T extends TypeArgument> = Reified< Referent<T>, ReferentFields<T> >;
|
|
80
|
+
|
|
81
|
+
export class Referent<T extends TypeArgument> implements StructClass { static readonly $typeName = "0x2::borrow::Referent"; static readonly $numTypeParams = 1;
|
|
82
|
+
|
|
83
|
+
readonly $typeName = Referent.$typeName;
|
|
84
|
+
|
|
85
|
+
readonly $fullTypeName: `0x2::borrow::Referent<${ToTypeStr<T>}>`;
|
|
86
|
+
|
|
87
|
+
readonly $typeArgs: [ToTypeStr<T>];
|
|
88
|
+
|
|
89
|
+
readonly id: ToField<"address">; readonly value: ToField<Option<T>>
|
|
90
|
+
|
|
91
|
+
private constructor(typeArgs: [ToTypeStr<T>], fields: ReferentFields<T>, ) { this.$fullTypeName = composeSuiType( Referent.$typeName, ...typeArgs ) as `0x2::borrow::Referent<${ToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
92
|
+
|
|
93
|
+
this.id = fields.id;; this.value = fields.value; }
|
|
94
|
+
|
|
95
|
+
static reified<T extends Reified<TypeArgument, any>>( T: T ): ReferentReified<ToTypeArgument<T>> { return { typeName: Referent.$typeName, fullTypeName: composeSuiType( Referent.$typeName, ...[extractType(T)] ) as `0x2::borrow::Referent<${ToTypeStr<ToTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [ToTypeStr<ToTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => Referent.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Referent.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => Referent.fromBcs( T, data, ), bcs: Referent.bcs(toBcs(T)), fromJSONField: (field: any) => Referent.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => Referent.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => Referent.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => Referent.fetch( client, T, id, ), new: ( fields: ReferentFields<ToTypeArgument<T>>, ) => { return new Referent( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
96
|
+
|
|
97
|
+
static get r() { return Referent.reified }
|
|
98
|
+
|
|
99
|
+
static phantom<T extends Reified<TypeArgument, any>>( T: T ): PhantomReified<ToTypeStr<Referent<ToTypeArgument<T>>>> { return phantom(Referent.reified( T )); } static get p() { return Referent.phantom }
|
|
100
|
+
|
|
101
|
+
static get bcs() { return <T extends BcsType<any>>(T: T) => bcs.struct(`Referent<${T.name}>`, {
|
|
102
|
+
|
|
103
|
+
id: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val), }), value: Option.bcs(T)
|
|
104
|
+
|
|
105
|
+
}) };
|
|
106
|
+
|
|
107
|
+
static fromFields<T extends Reified<TypeArgument, any>>( typeArg: T, fields: Record<string, any> ): Referent<ToTypeArgument<T>> { return Referent.reified( typeArg, ).new( { id: decodeFromFields("address", fields.id), value: decodeFromFields(Option.reified(typeArg), fields.value) } ) }
|
|
108
|
+
|
|
109
|
+
static fromFieldsWithTypes<T extends Reified<TypeArgument, any>>( typeArg: T, item: FieldsWithTypes ): Referent<ToTypeArgument<T>> { if (!isReferent(item.type)) { throw new Error("not a Referent type");
|
|
110
|
+
|
|
111
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
112
|
+
|
|
113
|
+
return Referent.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes("address", item.fields.id), value: decodeFromFieldsWithTypes(Option.reified(typeArg), item.fields.value) } ) }
|
|
114
|
+
|
|
115
|
+
static fromBcs<T extends Reified<TypeArgument, any>>( typeArg: T, data: Uint8Array ): Referent<ToTypeArgument<T>> { const typeArgs = [typeArg];
|
|
116
|
+
|
|
117
|
+
return Referent.fromFields( typeArg, Referent.bcs( toBcs(typeArgs[0]) ).parse(data) ) }
|
|
118
|
+
|
|
119
|
+
toJSONField() { return {
|
|
120
|
+
|
|
121
|
+
id: this.id,value: fieldToJSON<Option<T>>(`0x1::option::Option<${this.$typeArgs[0]}>`, this.value),
|
|
122
|
+
|
|
123
|
+
} }
|
|
124
|
+
|
|
125
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
126
|
+
|
|
127
|
+
static fromJSONField<T extends Reified<TypeArgument, any>>( typeArg: T, field: any ): Referent<ToTypeArgument<T>> { return Referent.reified( typeArg, ).new( { id: decodeFromJSONField("address", field.id), value: decodeFromJSONField(Option.reified(typeArg), field.value) } ) }
|
|
128
|
+
|
|
129
|
+
static fromJSON<T extends Reified<TypeArgument, any>>( typeArg: T, json: Record<string, any> ): Referent<ToTypeArgument<T>> { if (json.$typeName !== Referent.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(Referent.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
130
|
+
|
|
131
|
+
return Referent.fromJSONField( typeArg, json, ) }
|
|
132
|
+
|
|
133
|
+
static fromSuiParsedData<T extends Reified<TypeArgument, any>>( typeArg: T, content: SuiParsedData ): Referent<ToTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isReferent(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Referent object`); } return Referent.fromFieldsWithTypes( typeArg, content ); }
|
|
134
|
+
|
|
135
|
+
static async fetch<T extends Reified<TypeArgument, any>>( client: SuiClient, typeArg: T, id: string ): Promise<Referent<ToTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Referent object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isReferent(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Referent object`); }
|
|
136
|
+
return Referent.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
137
|
+
|
|
138
|
+
}
|
|
@@ -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 {UID} from "../object/structs";
|
|
4
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
5
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
6
|
+
|
|
7
|
+
/* ============================== Clock =============================== */
|
|
8
|
+
|
|
9
|
+
export function isClock(type: string): boolean { type = compressSuiType(type); return type === "0x2::clock::Clock"; }
|
|
10
|
+
|
|
11
|
+
export interface ClockFields { id: ToField<UID>; timestampMs: ToField<"u64"> }
|
|
12
|
+
|
|
13
|
+
export type ClockReified = Reified< Clock, ClockFields >;
|
|
14
|
+
|
|
15
|
+
export class Clock implements StructClass { static readonly $typeName = "0x2::clock::Clock"; static readonly $numTypeParams = 0;
|
|
16
|
+
|
|
17
|
+
readonly $typeName = Clock.$typeName;
|
|
18
|
+
|
|
19
|
+
readonly $fullTypeName: "0x2::clock::Clock";
|
|
20
|
+
|
|
21
|
+
readonly $typeArgs: [];
|
|
22
|
+
|
|
23
|
+
readonly id: ToField<UID>; readonly timestampMs: ToField<"u64">
|
|
24
|
+
|
|
25
|
+
private constructor(typeArgs: [], fields: ClockFields, ) { this.$fullTypeName = composeSuiType( Clock.$typeName, ...typeArgs ) as "0x2::clock::Clock"; this.$typeArgs = typeArgs;
|
|
26
|
+
|
|
27
|
+
this.id = fields.id;; this.timestampMs = fields.timestampMs; }
|
|
28
|
+
|
|
29
|
+
static reified( ): ClockReified { return { typeName: Clock.$typeName, fullTypeName: composeSuiType( Clock.$typeName, ...[] ) as "0x2::clock::Clock", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Clock.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Clock.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Clock.fromBcs( data, ), bcs: Clock.bcs, fromJSONField: (field: any) => Clock.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Clock.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Clock.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Clock.fetch( client, id, ), new: ( fields: ClockFields, ) => { return new Clock( [], fields ) }, kind: "StructClassReified", } }
|
|
30
|
+
|
|
31
|
+
static get r() { return Clock.reified() }
|
|
32
|
+
|
|
33
|
+
static phantom( ): PhantomReified<ToTypeStr<Clock>> { return phantom(Clock.reified( )); } static get p() { return Clock.phantom() }
|
|
34
|
+
|
|
35
|
+
static get bcs() { return bcs.struct("Clock", {
|
|
36
|
+
|
|
37
|
+
id: UID.bcs, timestamp_ms: bcs.u64()
|
|
38
|
+
|
|
39
|
+
}) };
|
|
40
|
+
|
|
41
|
+
static fromFields( fields: Record<string, any> ): Clock { return Clock.reified( ).new( { id: decodeFromFields(UID.reified(), fields.id), timestampMs: decodeFromFields("u64", fields.timestamp_ms) } ) }
|
|
42
|
+
|
|
43
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Clock { if (!isClock(item.type)) { throw new Error("not a Clock type");
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return Clock.reified( ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), timestampMs: decodeFromFieldsWithTypes("u64", item.fields.timestamp_ms) } ) }
|
|
48
|
+
|
|
49
|
+
static fromBcs( data: Uint8Array ): Clock { return Clock.fromFields( Clock.bcs.parse(data) ) }
|
|
50
|
+
|
|
51
|
+
toJSONField() { return {
|
|
52
|
+
|
|
53
|
+
id: this.id,timestampMs: this.timestampMs.toString(),
|
|
54
|
+
|
|
55
|
+
} }
|
|
56
|
+
|
|
57
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
58
|
+
|
|
59
|
+
static fromJSONField( field: any ): Clock { return Clock.reified( ).new( { id: decodeFromJSONField(UID.reified(), field.id), timestampMs: decodeFromJSONField("u64", field.timestampMs) } ) }
|
|
60
|
+
|
|
61
|
+
static fromJSON( json: Record<string, any> ): Clock { if (json.$typeName !== Clock.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
62
|
+
|
|
63
|
+
return Clock.fromJSONField( json, ) }
|
|
64
|
+
|
|
65
|
+
static fromSuiParsedData( content: SuiParsedData ): Clock { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isClock(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Clock object`); } return Clock.fromFieldsWithTypes( content ); }
|
|
66
|
+
|
|
67
|
+
static async fetch( client: SuiClient, id: string ): Promise<Clock> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Clock object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isClock(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Clock object`); }
|
|
68
|
+
return Clock.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
69
|
+
|
|
70
|
+
}
|