@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,400 @@
|
|
|
1
|
+
import {PhantomReified, PhantomToTypeStr, PhantomTypeArgument, Reified, StructClass, ToField, ToPhantomTypeArgument, ToTypeStr, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {String as String1} from "../../0x1/ascii/structs";
|
|
4
|
+
import {Option} from "../../0x1/option/structs";
|
|
5
|
+
import {String} from "../../0x1/string/structs";
|
|
6
|
+
import {Balance, Supply} from "../balance/structs";
|
|
7
|
+
import {ID, UID} from "../object/structs";
|
|
8
|
+
import {Url} from "../url/structs";
|
|
9
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
10
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
11
|
+
|
|
12
|
+
/* ============================== Coin =============================== */
|
|
13
|
+
|
|
14
|
+
export function isCoin(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::coin::Coin<"); }
|
|
15
|
+
|
|
16
|
+
export interface CoinFields<T extends PhantomTypeArgument> { id: ToField<UID>; balance: ToField<Balance<T>> }
|
|
17
|
+
|
|
18
|
+
export type CoinReified<T extends PhantomTypeArgument> = Reified< Coin<T>, CoinFields<T> >;
|
|
19
|
+
|
|
20
|
+
export class Coin<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::coin::Coin"; static readonly $numTypeParams = 1;
|
|
21
|
+
|
|
22
|
+
readonly $typeName = Coin.$typeName;
|
|
23
|
+
|
|
24
|
+
readonly $fullTypeName: `0x2::coin::Coin<${PhantomToTypeStr<T>}>`;
|
|
25
|
+
|
|
26
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
27
|
+
|
|
28
|
+
readonly id: ToField<UID>; readonly balance: ToField<Balance<T>>
|
|
29
|
+
|
|
30
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: CoinFields<T>, ) { this.$fullTypeName = composeSuiType( Coin.$typeName, ...typeArgs ) as `0x2::coin::Coin<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
31
|
+
|
|
32
|
+
this.id = fields.id;; this.balance = fields.balance; }
|
|
33
|
+
|
|
34
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): CoinReified<ToPhantomTypeArgument<T>> { return { typeName: Coin.$typeName, fullTypeName: composeSuiType( Coin.$typeName, ...[extractType(T)] ) as `0x2::coin::Coin<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => Coin.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Coin.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => Coin.fromBcs( T, data, ), bcs: Coin.bcs, fromJSONField: (field: any) => Coin.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => Coin.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => Coin.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => Coin.fetch( client, T, id, ), new: ( fields: CoinFields<ToPhantomTypeArgument<T>>, ) => { return new Coin( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
35
|
+
|
|
36
|
+
static get r() { return Coin.reified }
|
|
37
|
+
|
|
38
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<Coin<ToPhantomTypeArgument<T>>>> { return phantom(Coin.reified( T )); } static get p() { return Coin.phantom }
|
|
39
|
+
|
|
40
|
+
static get bcs() { return bcs.struct("Coin", {
|
|
41
|
+
|
|
42
|
+
id: UID.bcs, balance: Balance.bcs
|
|
43
|
+
|
|
44
|
+
}) };
|
|
45
|
+
|
|
46
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): Coin<ToPhantomTypeArgument<T>> { return Coin.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), balance: decodeFromFields(Balance.reified(typeArg), fields.balance) } ) }
|
|
47
|
+
|
|
48
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): Coin<ToPhantomTypeArgument<T>> { if (!isCoin(item.type)) { throw new Error("not a Coin type");
|
|
49
|
+
|
|
50
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
51
|
+
|
|
52
|
+
return Coin.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), balance: decodeFromFieldsWithTypes(Balance.reified(typeArg), item.fields.balance) } ) }
|
|
53
|
+
|
|
54
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): Coin<ToPhantomTypeArgument<T>> { return Coin.fromFields( typeArg, Coin.bcs.parse(data) ) }
|
|
55
|
+
|
|
56
|
+
toJSONField() { return {
|
|
57
|
+
|
|
58
|
+
id: this.id,balance: this.balance.toJSONField(),
|
|
59
|
+
|
|
60
|
+
} }
|
|
61
|
+
|
|
62
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
63
|
+
|
|
64
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): Coin<ToPhantomTypeArgument<T>> { return Coin.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), balance: decodeFromJSONField(Balance.reified(typeArg), field.balance) } ) }
|
|
65
|
+
|
|
66
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): Coin<ToPhantomTypeArgument<T>> { if (json.$typeName !== Coin.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(Coin.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
67
|
+
|
|
68
|
+
return Coin.fromJSONField( typeArg, json, ) }
|
|
69
|
+
|
|
70
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): Coin<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isCoin(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Coin object`); } return Coin.fromFieldsWithTypes( typeArg, content ); }
|
|
71
|
+
|
|
72
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<Coin<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Coin object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isCoin(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Coin object`); }
|
|
73
|
+
return Coin.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* ============================== CoinMetadata =============================== */
|
|
78
|
+
|
|
79
|
+
export function isCoinMetadata(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::coin::CoinMetadata<"); }
|
|
80
|
+
|
|
81
|
+
export interface CoinMetadataFields<T extends PhantomTypeArgument> { id: ToField<UID>; decimals: ToField<"u8">; name: ToField<String>; symbol: ToField<String1>; description: ToField<String>; iconUrl: ToField<Option<Url>> }
|
|
82
|
+
|
|
83
|
+
export type CoinMetadataReified<T extends PhantomTypeArgument> = Reified< CoinMetadata<T>, CoinMetadataFields<T> >;
|
|
84
|
+
|
|
85
|
+
export class CoinMetadata<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::coin::CoinMetadata"; static readonly $numTypeParams = 1;
|
|
86
|
+
|
|
87
|
+
readonly $typeName = CoinMetadata.$typeName;
|
|
88
|
+
|
|
89
|
+
readonly $fullTypeName: `0x2::coin::CoinMetadata<${PhantomToTypeStr<T>}>`;
|
|
90
|
+
|
|
91
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
92
|
+
|
|
93
|
+
readonly id: ToField<UID>; readonly decimals: ToField<"u8">; readonly name: ToField<String>; readonly symbol: ToField<String1>; readonly description: ToField<String>; readonly iconUrl: ToField<Option<Url>>
|
|
94
|
+
|
|
95
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: CoinMetadataFields<T>, ) { this.$fullTypeName = composeSuiType( CoinMetadata.$typeName, ...typeArgs ) as `0x2::coin::CoinMetadata<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
96
|
+
|
|
97
|
+
this.id = fields.id;; this.decimals = fields.decimals;; this.name = fields.name;; this.symbol = fields.symbol;; this.description = fields.description;; this.iconUrl = fields.iconUrl; }
|
|
98
|
+
|
|
99
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): CoinMetadataReified<ToPhantomTypeArgument<T>> { return { typeName: CoinMetadata.$typeName, fullTypeName: composeSuiType( CoinMetadata.$typeName, ...[extractType(T)] ) as `0x2::coin::CoinMetadata<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => CoinMetadata.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => CoinMetadata.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => CoinMetadata.fromBcs( T, data, ), bcs: CoinMetadata.bcs, fromJSONField: (field: any) => CoinMetadata.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => CoinMetadata.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => CoinMetadata.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => CoinMetadata.fetch( client, T, id, ), new: ( fields: CoinMetadataFields<ToPhantomTypeArgument<T>>, ) => { return new CoinMetadata( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
100
|
+
|
|
101
|
+
static get r() { return CoinMetadata.reified }
|
|
102
|
+
|
|
103
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<CoinMetadata<ToPhantomTypeArgument<T>>>> { return phantom(CoinMetadata.reified( T )); } static get p() { return CoinMetadata.phantom }
|
|
104
|
+
|
|
105
|
+
static get bcs() { return bcs.struct("CoinMetadata", {
|
|
106
|
+
|
|
107
|
+
id: UID.bcs, decimals: bcs.u8(), name: String.bcs, symbol: String1.bcs, description: String.bcs, icon_url: Option.bcs(Url.bcs)
|
|
108
|
+
|
|
109
|
+
}) };
|
|
110
|
+
|
|
111
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): CoinMetadata<ToPhantomTypeArgument<T>> { return CoinMetadata.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), decimals: decodeFromFields("u8", fields.decimals), name: decodeFromFields(String.reified(), fields.name), symbol: decodeFromFields(String1.reified(), fields.symbol), description: decodeFromFields(String.reified(), fields.description), iconUrl: decodeFromFields(Option.reified(Url.reified()), fields.icon_url) } ) }
|
|
112
|
+
|
|
113
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): CoinMetadata<ToPhantomTypeArgument<T>> { if (!isCoinMetadata(item.type)) { throw new Error("not a CoinMetadata type");
|
|
114
|
+
|
|
115
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
116
|
+
|
|
117
|
+
return CoinMetadata.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), decimals: decodeFromFieldsWithTypes("u8", item.fields.decimals), name: decodeFromFieldsWithTypes(String.reified(), item.fields.name), symbol: decodeFromFieldsWithTypes(String1.reified(), item.fields.symbol), description: decodeFromFieldsWithTypes(String.reified(), item.fields.description), iconUrl: decodeFromFieldsWithTypes(Option.reified(Url.reified()), item.fields.icon_url) } ) }
|
|
118
|
+
|
|
119
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): CoinMetadata<ToPhantomTypeArgument<T>> { return CoinMetadata.fromFields( typeArg, CoinMetadata.bcs.parse(data) ) }
|
|
120
|
+
|
|
121
|
+
toJSONField() { return {
|
|
122
|
+
|
|
123
|
+
id: this.id,decimals: this.decimals,name: this.name,symbol: this.symbol,description: this.description,iconUrl: fieldToJSON<Option<Url>>(`0x1::option::Option<0x2::url::Url>`, this.iconUrl),
|
|
124
|
+
|
|
125
|
+
} }
|
|
126
|
+
|
|
127
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
128
|
+
|
|
129
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): CoinMetadata<ToPhantomTypeArgument<T>> { return CoinMetadata.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), decimals: decodeFromJSONField("u8", field.decimals), name: decodeFromJSONField(String.reified(), field.name), symbol: decodeFromJSONField(String1.reified(), field.symbol), description: decodeFromJSONField(String.reified(), field.description), iconUrl: decodeFromJSONField(Option.reified(Url.reified()), field.iconUrl) } ) }
|
|
130
|
+
|
|
131
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): CoinMetadata<ToPhantomTypeArgument<T>> { if (json.$typeName !== CoinMetadata.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(CoinMetadata.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
132
|
+
|
|
133
|
+
return CoinMetadata.fromJSONField( typeArg, json, ) }
|
|
134
|
+
|
|
135
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): CoinMetadata<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isCoinMetadata(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a CoinMetadata object`); } return CoinMetadata.fromFieldsWithTypes( typeArg, content ); }
|
|
136
|
+
|
|
137
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<CoinMetadata<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching CoinMetadata object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isCoinMetadata(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a CoinMetadata object`); }
|
|
138
|
+
return CoinMetadata.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* ============================== CurrencyCreated =============================== */
|
|
143
|
+
|
|
144
|
+
export function isCurrencyCreated(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::coin::CurrencyCreated<"); }
|
|
145
|
+
|
|
146
|
+
export interface CurrencyCreatedFields<T extends PhantomTypeArgument> { decimals: ToField<"u8"> }
|
|
147
|
+
|
|
148
|
+
export type CurrencyCreatedReified<T extends PhantomTypeArgument> = Reified< CurrencyCreated<T>, CurrencyCreatedFields<T> >;
|
|
149
|
+
|
|
150
|
+
export class CurrencyCreated<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::coin::CurrencyCreated"; static readonly $numTypeParams = 1;
|
|
151
|
+
|
|
152
|
+
readonly $typeName = CurrencyCreated.$typeName;
|
|
153
|
+
|
|
154
|
+
readonly $fullTypeName: `0x2::coin::CurrencyCreated<${PhantomToTypeStr<T>}>`;
|
|
155
|
+
|
|
156
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
157
|
+
|
|
158
|
+
readonly decimals: ToField<"u8">
|
|
159
|
+
|
|
160
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: CurrencyCreatedFields<T>, ) { this.$fullTypeName = composeSuiType( CurrencyCreated.$typeName, ...typeArgs ) as `0x2::coin::CurrencyCreated<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
161
|
+
|
|
162
|
+
this.decimals = fields.decimals; }
|
|
163
|
+
|
|
164
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): CurrencyCreatedReified<ToPhantomTypeArgument<T>> { return { typeName: CurrencyCreated.$typeName, fullTypeName: composeSuiType( CurrencyCreated.$typeName, ...[extractType(T)] ) as `0x2::coin::CurrencyCreated<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => CurrencyCreated.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => CurrencyCreated.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => CurrencyCreated.fromBcs( T, data, ), bcs: CurrencyCreated.bcs, fromJSONField: (field: any) => CurrencyCreated.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => CurrencyCreated.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => CurrencyCreated.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => CurrencyCreated.fetch( client, T, id, ), new: ( fields: CurrencyCreatedFields<ToPhantomTypeArgument<T>>, ) => { return new CurrencyCreated( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
165
|
+
|
|
166
|
+
static get r() { return CurrencyCreated.reified }
|
|
167
|
+
|
|
168
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<CurrencyCreated<ToPhantomTypeArgument<T>>>> { return phantom(CurrencyCreated.reified( T )); } static get p() { return CurrencyCreated.phantom }
|
|
169
|
+
|
|
170
|
+
static get bcs() { return bcs.struct("CurrencyCreated", {
|
|
171
|
+
|
|
172
|
+
decimals: bcs.u8()
|
|
173
|
+
|
|
174
|
+
}) };
|
|
175
|
+
|
|
176
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): CurrencyCreated<ToPhantomTypeArgument<T>> { return CurrencyCreated.reified( typeArg, ).new( { decimals: decodeFromFields("u8", fields.decimals) } ) }
|
|
177
|
+
|
|
178
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): CurrencyCreated<ToPhantomTypeArgument<T>> { if (!isCurrencyCreated(item.type)) { throw new Error("not a CurrencyCreated type");
|
|
179
|
+
|
|
180
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
181
|
+
|
|
182
|
+
return CurrencyCreated.reified( typeArg, ).new( { decimals: decodeFromFieldsWithTypes("u8", item.fields.decimals) } ) }
|
|
183
|
+
|
|
184
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): CurrencyCreated<ToPhantomTypeArgument<T>> { return CurrencyCreated.fromFields( typeArg, CurrencyCreated.bcs.parse(data) ) }
|
|
185
|
+
|
|
186
|
+
toJSONField() { return {
|
|
187
|
+
|
|
188
|
+
decimals: this.decimals,
|
|
189
|
+
|
|
190
|
+
} }
|
|
191
|
+
|
|
192
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
193
|
+
|
|
194
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): CurrencyCreated<ToPhantomTypeArgument<T>> { return CurrencyCreated.reified( typeArg, ).new( { decimals: decodeFromJSONField("u8", field.decimals) } ) }
|
|
195
|
+
|
|
196
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): CurrencyCreated<ToPhantomTypeArgument<T>> { if (json.$typeName !== CurrencyCreated.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(CurrencyCreated.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
197
|
+
|
|
198
|
+
return CurrencyCreated.fromJSONField( typeArg, json, ) }
|
|
199
|
+
|
|
200
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): CurrencyCreated<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isCurrencyCreated(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a CurrencyCreated object`); } return CurrencyCreated.fromFieldsWithTypes( typeArg, content ); }
|
|
201
|
+
|
|
202
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<CurrencyCreated<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching CurrencyCreated object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isCurrencyCreated(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a CurrencyCreated object`); }
|
|
203
|
+
return CurrencyCreated.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* ============================== DenyCap =============================== */
|
|
208
|
+
|
|
209
|
+
export function isDenyCap(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::coin::DenyCap<"); }
|
|
210
|
+
|
|
211
|
+
export interface DenyCapFields<T extends PhantomTypeArgument> { id: ToField<UID> }
|
|
212
|
+
|
|
213
|
+
export type DenyCapReified<T extends PhantomTypeArgument> = Reified< DenyCap<T>, DenyCapFields<T> >;
|
|
214
|
+
|
|
215
|
+
export class DenyCap<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::coin::DenyCap"; static readonly $numTypeParams = 1;
|
|
216
|
+
|
|
217
|
+
readonly $typeName = DenyCap.$typeName;
|
|
218
|
+
|
|
219
|
+
readonly $fullTypeName: `0x2::coin::DenyCap<${PhantomToTypeStr<T>}>`;
|
|
220
|
+
|
|
221
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
222
|
+
|
|
223
|
+
readonly id: ToField<UID>
|
|
224
|
+
|
|
225
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: DenyCapFields<T>, ) { this.$fullTypeName = composeSuiType( DenyCap.$typeName, ...typeArgs ) as `0x2::coin::DenyCap<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
226
|
+
|
|
227
|
+
this.id = fields.id; }
|
|
228
|
+
|
|
229
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): DenyCapReified<ToPhantomTypeArgument<T>> { return { typeName: DenyCap.$typeName, fullTypeName: composeSuiType( DenyCap.$typeName, ...[extractType(T)] ) as `0x2::coin::DenyCap<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => DenyCap.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => DenyCap.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => DenyCap.fromBcs( T, data, ), bcs: DenyCap.bcs, fromJSONField: (field: any) => DenyCap.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => DenyCap.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => DenyCap.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => DenyCap.fetch( client, T, id, ), new: ( fields: DenyCapFields<ToPhantomTypeArgument<T>>, ) => { return new DenyCap( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
230
|
+
|
|
231
|
+
static get r() { return DenyCap.reified }
|
|
232
|
+
|
|
233
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<DenyCap<ToPhantomTypeArgument<T>>>> { return phantom(DenyCap.reified( T )); } static get p() { return DenyCap.phantom }
|
|
234
|
+
|
|
235
|
+
static get bcs() { return bcs.struct("DenyCap", {
|
|
236
|
+
|
|
237
|
+
id: UID.bcs
|
|
238
|
+
|
|
239
|
+
}) };
|
|
240
|
+
|
|
241
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): DenyCap<ToPhantomTypeArgument<T>> { return DenyCap.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id) } ) }
|
|
242
|
+
|
|
243
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): DenyCap<ToPhantomTypeArgument<T>> { if (!isDenyCap(item.type)) { throw new Error("not a DenyCap type");
|
|
244
|
+
|
|
245
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
246
|
+
|
|
247
|
+
return DenyCap.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id) } ) }
|
|
248
|
+
|
|
249
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): DenyCap<ToPhantomTypeArgument<T>> { return DenyCap.fromFields( typeArg, DenyCap.bcs.parse(data) ) }
|
|
250
|
+
|
|
251
|
+
toJSONField() { return {
|
|
252
|
+
|
|
253
|
+
id: this.id,
|
|
254
|
+
|
|
255
|
+
} }
|
|
256
|
+
|
|
257
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
258
|
+
|
|
259
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): DenyCap<ToPhantomTypeArgument<T>> { return DenyCap.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id) } ) }
|
|
260
|
+
|
|
261
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): DenyCap<ToPhantomTypeArgument<T>> { if (json.$typeName !== DenyCap.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(DenyCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
262
|
+
|
|
263
|
+
return DenyCap.fromJSONField( typeArg, json, ) }
|
|
264
|
+
|
|
265
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): DenyCap<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isDenyCap(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a DenyCap object`); } return DenyCap.fromFieldsWithTypes( typeArg, content ); }
|
|
266
|
+
|
|
267
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<DenyCap<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching DenyCap object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isDenyCap(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a DenyCap object`); }
|
|
268
|
+
return DenyCap.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
269
|
+
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* ============================== RegulatedCoinMetadata =============================== */
|
|
273
|
+
|
|
274
|
+
export function isRegulatedCoinMetadata(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::coin::RegulatedCoinMetadata<"); }
|
|
275
|
+
|
|
276
|
+
export interface RegulatedCoinMetadataFields<T extends PhantomTypeArgument> { id: ToField<UID>; coinMetadataObject: ToField<ID>; denyCapObject: ToField<ID> }
|
|
277
|
+
|
|
278
|
+
export type RegulatedCoinMetadataReified<T extends PhantomTypeArgument> = Reified< RegulatedCoinMetadata<T>, RegulatedCoinMetadataFields<T> >;
|
|
279
|
+
|
|
280
|
+
export class RegulatedCoinMetadata<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::coin::RegulatedCoinMetadata"; static readonly $numTypeParams = 1;
|
|
281
|
+
|
|
282
|
+
readonly $typeName = RegulatedCoinMetadata.$typeName;
|
|
283
|
+
|
|
284
|
+
readonly $fullTypeName: `0x2::coin::RegulatedCoinMetadata<${PhantomToTypeStr<T>}>`;
|
|
285
|
+
|
|
286
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
287
|
+
|
|
288
|
+
readonly id: ToField<UID>; readonly coinMetadataObject: ToField<ID>; readonly denyCapObject: ToField<ID>
|
|
289
|
+
|
|
290
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: RegulatedCoinMetadataFields<T>, ) { this.$fullTypeName = composeSuiType( RegulatedCoinMetadata.$typeName, ...typeArgs ) as `0x2::coin::RegulatedCoinMetadata<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
291
|
+
|
|
292
|
+
this.id = fields.id;; this.coinMetadataObject = fields.coinMetadataObject;; this.denyCapObject = fields.denyCapObject; }
|
|
293
|
+
|
|
294
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): RegulatedCoinMetadataReified<ToPhantomTypeArgument<T>> { return { typeName: RegulatedCoinMetadata.$typeName, fullTypeName: composeSuiType( RegulatedCoinMetadata.$typeName, ...[extractType(T)] ) as `0x2::coin::RegulatedCoinMetadata<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => RegulatedCoinMetadata.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => RegulatedCoinMetadata.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => RegulatedCoinMetadata.fromBcs( T, data, ), bcs: RegulatedCoinMetadata.bcs, fromJSONField: (field: any) => RegulatedCoinMetadata.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => RegulatedCoinMetadata.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => RegulatedCoinMetadata.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => RegulatedCoinMetadata.fetch( client, T, id, ), new: ( fields: RegulatedCoinMetadataFields<ToPhantomTypeArgument<T>>, ) => { return new RegulatedCoinMetadata( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
295
|
+
|
|
296
|
+
static get r() { return RegulatedCoinMetadata.reified }
|
|
297
|
+
|
|
298
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<RegulatedCoinMetadata<ToPhantomTypeArgument<T>>>> { return phantom(RegulatedCoinMetadata.reified( T )); } static get p() { return RegulatedCoinMetadata.phantom }
|
|
299
|
+
|
|
300
|
+
static get bcs() { return bcs.struct("RegulatedCoinMetadata", {
|
|
301
|
+
|
|
302
|
+
id: UID.bcs, coin_metadata_object: ID.bcs, deny_cap_object: ID.bcs
|
|
303
|
+
|
|
304
|
+
}) };
|
|
305
|
+
|
|
306
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): RegulatedCoinMetadata<ToPhantomTypeArgument<T>> { return RegulatedCoinMetadata.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), coinMetadataObject: decodeFromFields(ID.reified(), fields.coin_metadata_object), denyCapObject: decodeFromFields(ID.reified(), fields.deny_cap_object) } ) }
|
|
307
|
+
|
|
308
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): RegulatedCoinMetadata<ToPhantomTypeArgument<T>> { if (!isRegulatedCoinMetadata(item.type)) { throw new Error("not a RegulatedCoinMetadata type");
|
|
309
|
+
|
|
310
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
311
|
+
|
|
312
|
+
return RegulatedCoinMetadata.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), coinMetadataObject: decodeFromFieldsWithTypes(ID.reified(), item.fields.coin_metadata_object), denyCapObject: decodeFromFieldsWithTypes(ID.reified(), item.fields.deny_cap_object) } ) }
|
|
313
|
+
|
|
314
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): RegulatedCoinMetadata<ToPhantomTypeArgument<T>> { return RegulatedCoinMetadata.fromFields( typeArg, RegulatedCoinMetadata.bcs.parse(data) ) }
|
|
315
|
+
|
|
316
|
+
toJSONField() { return {
|
|
317
|
+
|
|
318
|
+
id: this.id,coinMetadataObject: this.coinMetadataObject,denyCapObject: this.denyCapObject,
|
|
319
|
+
|
|
320
|
+
} }
|
|
321
|
+
|
|
322
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
323
|
+
|
|
324
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): RegulatedCoinMetadata<ToPhantomTypeArgument<T>> { return RegulatedCoinMetadata.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), coinMetadataObject: decodeFromJSONField(ID.reified(), field.coinMetadataObject), denyCapObject: decodeFromJSONField(ID.reified(), field.denyCapObject) } ) }
|
|
325
|
+
|
|
326
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): RegulatedCoinMetadata<ToPhantomTypeArgument<T>> { if (json.$typeName !== RegulatedCoinMetadata.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(RegulatedCoinMetadata.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
327
|
+
|
|
328
|
+
return RegulatedCoinMetadata.fromJSONField( typeArg, json, ) }
|
|
329
|
+
|
|
330
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): RegulatedCoinMetadata<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isRegulatedCoinMetadata(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a RegulatedCoinMetadata object`); } return RegulatedCoinMetadata.fromFieldsWithTypes( typeArg, content ); }
|
|
331
|
+
|
|
332
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<RegulatedCoinMetadata<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching RegulatedCoinMetadata object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isRegulatedCoinMetadata(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a RegulatedCoinMetadata object`); }
|
|
333
|
+
return RegulatedCoinMetadata.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* ============================== TreasuryCap =============================== */
|
|
338
|
+
|
|
339
|
+
export function isTreasuryCap(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::coin::TreasuryCap<"); }
|
|
340
|
+
|
|
341
|
+
export interface TreasuryCapFields<T extends PhantomTypeArgument> { id: ToField<UID>; totalSupply: ToField<Supply<T>> }
|
|
342
|
+
|
|
343
|
+
export type TreasuryCapReified<T extends PhantomTypeArgument> = Reified< TreasuryCap<T>, TreasuryCapFields<T> >;
|
|
344
|
+
|
|
345
|
+
export class TreasuryCap<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::coin::TreasuryCap"; static readonly $numTypeParams = 1;
|
|
346
|
+
|
|
347
|
+
readonly $typeName = TreasuryCap.$typeName;
|
|
348
|
+
|
|
349
|
+
readonly $fullTypeName: `0x2::coin::TreasuryCap<${PhantomToTypeStr<T>}>`;
|
|
350
|
+
|
|
351
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
352
|
+
|
|
353
|
+
readonly id: ToField<UID>; readonly totalSupply: ToField<Supply<T>>
|
|
354
|
+
|
|
355
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: TreasuryCapFields<T>, ) { this.$fullTypeName = composeSuiType( TreasuryCap.$typeName, ...typeArgs ) as `0x2::coin::TreasuryCap<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
356
|
+
|
|
357
|
+
this.id = fields.id;; this.totalSupply = fields.totalSupply; }
|
|
358
|
+
|
|
359
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): TreasuryCapReified<ToPhantomTypeArgument<T>> { return { typeName: TreasuryCap.$typeName, fullTypeName: composeSuiType( TreasuryCap.$typeName, ...[extractType(T)] ) as `0x2::coin::TreasuryCap<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => TreasuryCap.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => TreasuryCap.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => TreasuryCap.fromBcs( T, data, ), bcs: TreasuryCap.bcs, fromJSONField: (field: any) => TreasuryCap.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => TreasuryCap.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => TreasuryCap.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => TreasuryCap.fetch( client, T, id, ), new: ( fields: TreasuryCapFields<ToPhantomTypeArgument<T>>, ) => { return new TreasuryCap( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
360
|
+
|
|
361
|
+
static get r() { return TreasuryCap.reified }
|
|
362
|
+
|
|
363
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<TreasuryCap<ToPhantomTypeArgument<T>>>> { return phantom(TreasuryCap.reified( T )); } static get p() { return TreasuryCap.phantom }
|
|
364
|
+
|
|
365
|
+
static get bcs() { return bcs.struct("TreasuryCap", {
|
|
366
|
+
|
|
367
|
+
id: UID.bcs, total_supply: Supply.bcs
|
|
368
|
+
|
|
369
|
+
}) };
|
|
370
|
+
|
|
371
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): TreasuryCap<ToPhantomTypeArgument<T>> { return TreasuryCap.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), totalSupply: decodeFromFields(Supply.reified(typeArg), fields.total_supply) } ) }
|
|
372
|
+
|
|
373
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): TreasuryCap<ToPhantomTypeArgument<T>> { if (!isTreasuryCap(item.type)) { throw new Error("not a TreasuryCap type");
|
|
374
|
+
|
|
375
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
376
|
+
|
|
377
|
+
return TreasuryCap.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), totalSupply: decodeFromFieldsWithTypes(Supply.reified(typeArg), item.fields.total_supply) } ) }
|
|
378
|
+
|
|
379
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): TreasuryCap<ToPhantomTypeArgument<T>> { return TreasuryCap.fromFields( typeArg, TreasuryCap.bcs.parse(data) ) }
|
|
380
|
+
|
|
381
|
+
toJSONField() { return {
|
|
382
|
+
|
|
383
|
+
id: this.id,totalSupply: this.totalSupply.toJSONField(),
|
|
384
|
+
|
|
385
|
+
} }
|
|
386
|
+
|
|
387
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
388
|
+
|
|
389
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): TreasuryCap<ToPhantomTypeArgument<T>> { return TreasuryCap.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), totalSupply: decodeFromJSONField(Supply.reified(typeArg), field.totalSupply) } ) }
|
|
390
|
+
|
|
391
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): TreasuryCap<ToPhantomTypeArgument<T>> { if (json.$typeName !== TreasuryCap.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(TreasuryCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
392
|
+
|
|
393
|
+
return TreasuryCap.fromJSONField( typeArg, json, ) }
|
|
394
|
+
|
|
395
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): TreasuryCap<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isTreasuryCap(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a TreasuryCap object`); } return TreasuryCap.fromFieldsWithTypes( typeArg, content ); }
|
|
396
|
+
|
|
397
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<TreasuryCap<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching TreasuryCap object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isTreasuryCap(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a TreasuryCap object`); }
|
|
398
|
+
return TreasuryCap.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
399
|
+
|
|
400
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as reified from "../../../../_framework/reified";
|
|
2
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, Vector, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, ToTypeStr as ToPhantom} from "../../../../_framework/reified";
|
|
3
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
4
|
+
import {Bag} from "../bag/structs";
|
|
5
|
+
import {UID} from "../object/structs";
|
|
6
|
+
import {Table} from "../table/structs";
|
|
7
|
+
import {VecSet} from "../vec-set/structs";
|
|
8
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
9
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
10
|
+
|
|
11
|
+
/* ============================== DenyList =============================== */
|
|
12
|
+
|
|
13
|
+
export function isDenyList(type: string): boolean { type = compressSuiType(type); return type === "0x2::deny_list::DenyList"; }
|
|
14
|
+
|
|
15
|
+
export interface DenyListFields { id: ToField<UID>; lists: ToField<Bag> }
|
|
16
|
+
|
|
17
|
+
export type DenyListReified = Reified< DenyList, DenyListFields >;
|
|
18
|
+
|
|
19
|
+
export class DenyList implements StructClass { static readonly $typeName = "0x2::deny_list::DenyList"; static readonly $numTypeParams = 0;
|
|
20
|
+
|
|
21
|
+
readonly $typeName = DenyList.$typeName;
|
|
22
|
+
|
|
23
|
+
readonly $fullTypeName: "0x2::deny_list::DenyList";
|
|
24
|
+
|
|
25
|
+
readonly $typeArgs: [];
|
|
26
|
+
|
|
27
|
+
readonly id: ToField<UID>; readonly lists: ToField<Bag>
|
|
28
|
+
|
|
29
|
+
private constructor(typeArgs: [], fields: DenyListFields, ) { this.$fullTypeName = composeSuiType( DenyList.$typeName, ...typeArgs ) as "0x2::deny_list::DenyList"; this.$typeArgs = typeArgs;
|
|
30
|
+
|
|
31
|
+
this.id = fields.id;; this.lists = fields.lists; }
|
|
32
|
+
|
|
33
|
+
static reified( ): DenyListReified { return { typeName: DenyList.$typeName, fullTypeName: composeSuiType( DenyList.$typeName, ...[] ) as "0x2::deny_list::DenyList", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => DenyList.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => DenyList.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => DenyList.fromBcs( data, ), bcs: DenyList.bcs, fromJSONField: (field: any) => DenyList.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => DenyList.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => DenyList.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => DenyList.fetch( client, id, ), new: ( fields: DenyListFields, ) => { return new DenyList( [], fields ) }, kind: "StructClassReified", } }
|
|
34
|
+
|
|
35
|
+
static get r() { return DenyList.reified() }
|
|
36
|
+
|
|
37
|
+
static phantom( ): PhantomReified<ToTypeStr<DenyList>> { return phantom(DenyList.reified( )); } static get p() { return DenyList.phantom() }
|
|
38
|
+
|
|
39
|
+
static get bcs() { return bcs.struct("DenyList", {
|
|
40
|
+
|
|
41
|
+
id: UID.bcs, lists: Bag.bcs
|
|
42
|
+
|
|
43
|
+
}) };
|
|
44
|
+
|
|
45
|
+
static fromFields( fields: Record<string, any> ): DenyList { return DenyList.reified( ).new( { id: decodeFromFields(UID.reified(), fields.id), lists: decodeFromFields(Bag.reified(), fields.lists) } ) }
|
|
46
|
+
|
|
47
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): DenyList { if (!isDenyList(item.type)) { throw new Error("not a DenyList type");
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return DenyList.reified( ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), lists: decodeFromFieldsWithTypes(Bag.reified(), item.fields.lists) } ) }
|
|
52
|
+
|
|
53
|
+
static fromBcs( data: Uint8Array ): DenyList { return DenyList.fromFields( DenyList.bcs.parse(data) ) }
|
|
54
|
+
|
|
55
|
+
toJSONField() { return {
|
|
56
|
+
|
|
57
|
+
id: this.id,lists: this.lists.toJSONField(),
|
|
58
|
+
|
|
59
|
+
} }
|
|
60
|
+
|
|
61
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
62
|
+
|
|
63
|
+
static fromJSONField( field: any ): DenyList { return DenyList.reified( ).new( { id: decodeFromJSONField(UID.reified(), field.id), lists: decodeFromJSONField(Bag.reified(), field.lists) } ) }
|
|
64
|
+
|
|
65
|
+
static fromJSON( json: Record<string, any> ): DenyList { if (json.$typeName !== DenyList.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
66
|
+
|
|
67
|
+
return DenyList.fromJSONField( json, ) }
|
|
68
|
+
|
|
69
|
+
static fromSuiParsedData( content: SuiParsedData ): DenyList { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isDenyList(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a DenyList object`); } return DenyList.fromFieldsWithTypes( content ); }
|
|
70
|
+
|
|
71
|
+
static async fetch( client: SuiClient, id: string ): Promise<DenyList> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching DenyList object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isDenyList(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a DenyList object`); }
|
|
72
|
+
return DenyList.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* ============================== PerTypeList =============================== */
|
|
77
|
+
|
|
78
|
+
export function isPerTypeList(type: string): boolean { type = compressSuiType(type); return type === "0x2::deny_list::PerTypeList"; }
|
|
79
|
+
|
|
80
|
+
export interface PerTypeListFields { id: ToField<UID>; deniedCount: ToField<Table<"address", "u64">>; deniedAddresses: ToField<Table<ToPhantom<Vector<"u8">>, ToPhantom<VecSet<"address">>>> }
|
|
81
|
+
|
|
82
|
+
export type PerTypeListReified = Reified< PerTypeList, PerTypeListFields >;
|
|
83
|
+
|
|
84
|
+
export class PerTypeList implements StructClass { static readonly $typeName = "0x2::deny_list::PerTypeList"; static readonly $numTypeParams = 0;
|
|
85
|
+
|
|
86
|
+
readonly $typeName = PerTypeList.$typeName;
|
|
87
|
+
|
|
88
|
+
readonly $fullTypeName: "0x2::deny_list::PerTypeList";
|
|
89
|
+
|
|
90
|
+
readonly $typeArgs: [];
|
|
91
|
+
|
|
92
|
+
readonly id: ToField<UID>; readonly deniedCount: ToField<Table<"address", "u64">>; readonly deniedAddresses: ToField<Table<ToPhantom<Vector<"u8">>, ToPhantom<VecSet<"address">>>>
|
|
93
|
+
|
|
94
|
+
private constructor(typeArgs: [], fields: PerTypeListFields, ) { this.$fullTypeName = composeSuiType( PerTypeList.$typeName, ...typeArgs ) as "0x2::deny_list::PerTypeList"; this.$typeArgs = typeArgs;
|
|
95
|
+
|
|
96
|
+
this.id = fields.id;; this.deniedCount = fields.deniedCount;; this.deniedAddresses = fields.deniedAddresses; }
|
|
97
|
+
|
|
98
|
+
static reified( ): PerTypeListReified { return { typeName: PerTypeList.$typeName, fullTypeName: composeSuiType( PerTypeList.$typeName, ...[] ) as "0x2::deny_list::PerTypeList", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => PerTypeList.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => PerTypeList.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => PerTypeList.fromBcs( data, ), bcs: PerTypeList.bcs, fromJSONField: (field: any) => PerTypeList.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => PerTypeList.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => PerTypeList.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => PerTypeList.fetch( client, id, ), new: ( fields: PerTypeListFields, ) => { return new PerTypeList( [], fields ) }, kind: "StructClassReified", } }
|
|
99
|
+
|
|
100
|
+
static get r() { return PerTypeList.reified() }
|
|
101
|
+
|
|
102
|
+
static phantom( ): PhantomReified<ToTypeStr<PerTypeList>> { return phantom(PerTypeList.reified( )); } static get p() { return PerTypeList.phantom() }
|
|
103
|
+
|
|
104
|
+
static get bcs() { return bcs.struct("PerTypeList", {
|
|
105
|
+
|
|
106
|
+
id: UID.bcs, denied_count: Table.bcs, denied_addresses: Table.bcs
|
|
107
|
+
|
|
108
|
+
}) };
|
|
109
|
+
|
|
110
|
+
static fromFields( fields: Record<string, any> ): PerTypeList { return PerTypeList.reified( ).new( { id: decodeFromFields(UID.reified(), fields.id), deniedCount: decodeFromFields(Table.reified(reified.phantom("address"), reified.phantom("u64")), fields.denied_count), deniedAddresses: decodeFromFields(Table.reified(reified.phantom(reified.vector("u8")), reified.phantom(VecSet.reified("address"))), fields.denied_addresses) } ) }
|
|
111
|
+
|
|
112
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): PerTypeList { if (!isPerTypeList(item.type)) { throw new Error("not a PerTypeList type");
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return PerTypeList.reified( ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), deniedCount: decodeFromFieldsWithTypes(Table.reified(reified.phantom("address"), reified.phantom("u64")), item.fields.denied_count), deniedAddresses: decodeFromFieldsWithTypes(Table.reified(reified.phantom(reified.vector("u8")), reified.phantom(VecSet.reified("address"))), item.fields.denied_addresses) } ) }
|
|
117
|
+
|
|
118
|
+
static fromBcs( data: Uint8Array ): PerTypeList { return PerTypeList.fromFields( PerTypeList.bcs.parse(data) ) }
|
|
119
|
+
|
|
120
|
+
toJSONField() { return {
|
|
121
|
+
|
|
122
|
+
id: this.id,deniedCount: this.deniedCount.toJSONField(),deniedAddresses: this.deniedAddresses.toJSONField(),
|
|
123
|
+
|
|
124
|
+
} }
|
|
125
|
+
|
|
126
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
127
|
+
|
|
128
|
+
static fromJSONField( field: any ): PerTypeList { return PerTypeList.reified( ).new( { id: decodeFromJSONField(UID.reified(), field.id), deniedCount: decodeFromJSONField(Table.reified(reified.phantom("address"), reified.phantom("u64")), field.deniedCount), deniedAddresses: decodeFromJSONField(Table.reified(reified.phantom(reified.vector("u8")), reified.phantom(VecSet.reified("address"))), field.deniedAddresses) } ) }
|
|
129
|
+
|
|
130
|
+
static fromJSON( json: Record<string, any> ): PerTypeList { if (json.$typeName !== PerTypeList.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
131
|
+
|
|
132
|
+
return PerTypeList.fromJSONField( json, ) }
|
|
133
|
+
|
|
134
|
+
static fromSuiParsedData( content: SuiParsedData ): PerTypeList { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isPerTypeList(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a PerTypeList object`); } return PerTypeList.fromFieldsWithTypes( content ); }
|
|
135
|
+
|
|
136
|
+
static async fetch( client: SuiClient, id: string ): Promise<PerTypeList> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching PerTypeList object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isPerTypeList(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a PerTypeList object`); }
|
|
137
|
+
return PerTypeList.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
138
|
+
|
|
139
|
+
}
|