@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,658 @@
|
|
|
1
|
+
import * as reified from "../../../../_framework/reified";
|
|
2
|
+
import {PhantomReified, PhantomToTypeStr, PhantomTypeArgument, Reified, StructClass, ToField, ToPhantomTypeArgument, ToTypeStr, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, ToTypeStr as ToPhantom} from "../../../../_framework/reified";
|
|
3
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
4
|
+
import {Balance} from "../balance/structs";
|
|
5
|
+
import {ID, UID} from "../object/structs";
|
|
6
|
+
import {SUI} from "../sui/structs";
|
|
7
|
+
import {bcs, fromB64, fromHEX, toHEX} from "@mysten/bcs";
|
|
8
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
9
|
+
|
|
10
|
+
/* ============================== Borrow =============================== */
|
|
11
|
+
|
|
12
|
+
export function isBorrow(type: string): boolean { type = compressSuiType(type); return type === "0x2::kiosk::Borrow"; }
|
|
13
|
+
|
|
14
|
+
export interface BorrowFields { kioskId: ToField<ID>; itemId: ToField<ID> }
|
|
15
|
+
|
|
16
|
+
export type BorrowReified = Reified< Borrow, BorrowFields >;
|
|
17
|
+
|
|
18
|
+
export class Borrow implements StructClass { static readonly $typeName = "0x2::kiosk::Borrow"; static readonly $numTypeParams = 0;
|
|
19
|
+
|
|
20
|
+
readonly $typeName = Borrow.$typeName;
|
|
21
|
+
|
|
22
|
+
readonly $fullTypeName: "0x2::kiosk::Borrow";
|
|
23
|
+
|
|
24
|
+
readonly $typeArgs: [];
|
|
25
|
+
|
|
26
|
+
readonly kioskId: ToField<ID>; readonly itemId: ToField<ID>
|
|
27
|
+
|
|
28
|
+
private constructor(typeArgs: [], fields: BorrowFields, ) { this.$fullTypeName = composeSuiType( Borrow.$typeName, ...typeArgs ) as "0x2::kiosk::Borrow"; this.$typeArgs = typeArgs;
|
|
29
|
+
|
|
30
|
+
this.kioskId = fields.kioskId;; this.itemId = fields.itemId; }
|
|
31
|
+
|
|
32
|
+
static reified( ): BorrowReified { return { typeName: Borrow.$typeName, fullTypeName: composeSuiType( Borrow.$typeName, ...[] ) as "0x2::kiosk::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", } }
|
|
33
|
+
|
|
34
|
+
static get r() { return Borrow.reified() }
|
|
35
|
+
|
|
36
|
+
static phantom( ): PhantomReified<ToTypeStr<Borrow>> { return phantom(Borrow.reified( )); } static get p() { return Borrow.phantom() }
|
|
37
|
+
|
|
38
|
+
static get bcs() { return bcs.struct("Borrow", {
|
|
39
|
+
|
|
40
|
+
kiosk_id: ID.bcs, item_id: ID.bcs
|
|
41
|
+
|
|
42
|
+
}) };
|
|
43
|
+
|
|
44
|
+
static fromFields( fields: Record<string, any> ): Borrow { return Borrow.reified( ).new( { kioskId: decodeFromFields(ID.reified(), fields.kiosk_id), itemId: decodeFromFields(ID.reified(), fields.item_id) } ) }
|
|
45
|
+
|
|
46
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Borrow { if (!isBorrow(item.type)) { throw new Error("not a Borrow type");
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return Borrow.reified( ).new( { kioskId: decodeFromFieldsWithTypes(ID.reified(), item.fields.kiosk_id), itemId: decodeFromFieldsWithTypes(ID.reified(), item.fields.item_id) } ) }
|
|
51
|
+
|
|
52
|
+
static fromBcs( data: Uint8Array ): Borrow { return Borrow.fromFields( Borrow.bcs.parse(data) ) }
|
|
53
|
+
|
|
54
|
+
toJSONField() { return {
|
|
55
|
+
|
|
56
|
+
kioskId: this.kioskId,itemId: this.itemId,
|
|
57
|
+
|
|
58
|
+
} }
|
|
59
|
+
|
|
60
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
61
|
+
|
|
62
|
+
static fromJSONField( field: any ): Borrow { return Borrow.reified( ).new( { kioskId: decodeFromJSONField(ID.reified(), field.kioskId), itemId: decodeFromJSONField(ID.reified(), field.itemId) } ) }
|
|
63
|
+
|
|
64
|
+
static fromJSON( json: Record<string, any> ): Borrow { if (json.$typeName !== Borrow.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
65
|
+
|
|
66
|
+
return Borrow.fromJSONField( json, ) }
|
|
67
|
+
|
|
68
|
+
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 ); }
|
|
69
|
+
|
|
70
|
+
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`); }
|
|
71
|
+
return Borrow.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ============================== Item =============================== */
|
|
76
|
+
|
|
77
|
+
export function isItem(type: string): boolean { type = compressSuiType(type); return type === "0x2::kiosk::Item"; }
|
|
78
|
+
|
|
79
|
+
export interface ItemFields { id: ToField<ID> }
|
|
80
|
+
|
|
81
|
+
export type ItemReified = Reified< Item, ItemFields >;
|
|
82
|
+
|
|
83
|
+
export class Item implements StructClass { static readonly $typeName = "0x2::kiosk::Item"; static readonly $numTypeParams = 0;
|
|
84
|
+
|
|
85
|
+
readonly $typeName = Item.$typeName;
|
|
86
|
+
|
|
87
|
+
readonly $fullTypeName: "0x2::kiosk::Item";
|
|
88
|
+
|
|
89
|
+
readonly $typeArgs: [];
|
|
90
|
+
|
|
91
|
+
readonly id: ToField<ID>
|
|
92
|
+
|
|
93
|
+
private constructor(typeArgs: [], fields: ItemFields, ) { this.$fullTypeName = composeSuiType( Item.$typeName, ...typeArgs ) as "0x2::kiosk::Item"; this.$typeArgs = typeArgs;
|
|
94
|
+
|
|
95
|
+
this.id = fields.id; }
|
|
96
|
+
|
|
97
|
+
static reified( ): ItemReified { return { typeName: Item.$typeName, fullTypeName: composeSuiType( Item.$typeName, ...[] ) as "0x2::kiosk::Item", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Item.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Item.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Item.fromBcs( data, ), bcs: Item.bcs, fromJSONField: (field: any) => Item.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Item.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Item.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Item.fetch( client, id, ), new: ( fields: ItemFields, ) => { return new Item( [], fields ) }, kind: "StructClassReified", } }
|
|
98
|
+
|
|
99
|
+
static get r() { return Item.reified() }
|
|
100
|
+
|
|
101
|
+
static phantom( ): PhantomReified<ToTypeStr<Item>> { return phantom(Item.reified( )); } static get p() { return Item.phantom() }
|
|
102
|
+
|
|
103
|
+
static get bcs() { return bcs.struct("Item", {
|
|
104
|
+
|
|
105
|
+
id: ID.bcs
|
|
106
|
+
|
|
107
|
+
}) };
|
|
108
|
+
|
|
109
|
+
static fromFields( fields: Record<string, any> ): Item { return Item.reified( ).new( { id: decodeFromFields(ID.reified(), fields.id) } ) }
|
|
110
|
+
|
|
111
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Item { if (!isItem(item.type)) { throw new Error("not a Item type");
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return Item.reified( ).new( { id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id) } ) }
|
|
116
|
+
|
|
117
|
+
static fromBcs( data: Uint8Array ): Item { return Item.fromFields( Item.bcs.parse(data) ) }
|
|
118
|
+
|
|
119
|
+
toJSONField() { return {
|
|
120
|
+
|
|
121
|
+
id: this.id,
|
|
122
|
+
|
|
123
|
+
} }
|
|
124
|
+
|
|
125
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
126
|
+
|
|
127
|
+
static fromJSONField( field: any ): Item { return Item.reified( ).new( { id: decodeFromJSONField(ID.reified(), field.id) } ) }
|
|
128
|
+
|
|
129
|
+
static fromJSON( json: Record<string, any> ): Item { if (json.$typeName !== Item.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
130
|
+
|
|
131
|
+
return Item.fromJSONField( json, ) }
|
|
132
|
+
|
|
133
|
+
static fromSuiParsedData( content: SuiParsedData ): Item { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isItem(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Item object`); } return Item.fromFieldsWithTypes( content ); }
|
|
134
|
+
|
|
135
|
+
static async fetch( client: SuiClient, id: string ): Promise<Item> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Item object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isItem(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Item object`); }
|
|
136
|
+
return Item.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* ============================== ItemDelisted =============================== */
|
|
141
|
+
|
|
142
|
+
export function isItemDelisted(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::kiosk::ItemDelisted<"); }
|
|
143
|
+
|
|
144
|
+
export interface ItemDelistedFields<T extends PhantomTypeArgument> { kiosk: ToField<ID>; id: ToField<ID> }
|
|
145
|
+
|
|
146
|
+
export type ItemDelistedReified<T extends PhantomTypeArgument> = Reified< ItemDelisted<T>, ItemDelistedFields<T> >;
|
|
147
|
+
|
|
148
|
+
export class ItemDelisted<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::kiosk::ItemDelisted"; static readonly $numTypeParams = 1;
|
|
149
|
+
|
|
150
|
+
readonly $typeName = ItemDelisted.$typeName;
|
|
151
|
+
|
|
152
|
+
readonly $fullTypeName: `0x2::kiosk::ItemDelisted<${PhantomToTypeStr<T>}>`;
|
|
153
|
+
|
|
154
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
155
|
+
|
|
156
|
+
readonly kiosk: ToField<ID>; readonly id: ToField<ID>
|
|
157
|
+
|
|
158
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: ItemDelistedFields<T>, ) { this.$fullTypeName = composeSuiType( ItemDelisted.$typeName, ...typeArgs ) as `0x2::kiosk::ItemDelisted<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
159
|
+
|
|
160
|
+
this.kiosk = fields.kiosk;; this.id = fields.id; }
|
|
161
|
+
|
|
162
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): ItemDelistedReified<ToPhantomTypeArgument<T>> { return { typeName: ItemDelisted.$typeName, fullTypeName: composeSuiType( ItemDelisted.$typeName, ...[extractType(T)] ) as `0x2::kiosk::ItemDelisted<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => ItemDelisted.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => ItemDelisted.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => ItemDelisted.fromBcs( T, data, ), bcs: ItemDelisted.bcs, fromJSONField: (field: any) => ItemDelisted.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => ItemDelisted.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => ItemDelisted.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => ItemDelisted.fetch( client, T, id, ), new: ( fields: ItemDelistedFields<ToPhantomTypeArgument<T>>, ) => { return new ItemDelisted( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
163
|
+
|
|
164
|
+
static get r() { return ItemDelisted.reified }
|
|
165
|
+
|
|
166
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<ItemDelisted<ToPhantomTypeArgument<T>>>> { return phantom(ItemDelisted.reified( T )); } static get p() { return ItemDelisted.phantom }
|
|
167
|
+
|
|
168
|
+
static get bcs() { return bcs.struct("ItemDelisted", {
|
|
169
|
+
|
|
170
|
+
kiosk: ID.bcs, id: ID.bcs
|
|
171
|
+
|
|
172
|
+
}) };
|
|
173
|
+
|
|
174
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): ItemDelisted<ToPhantomTypeArgument<T>> { return ItemDelisted.reified( typeArg, ).new( { kiosk: decodeFromFields(ID.reified(), fields.kiosk), id: decodeFromFields(ID.reified(), fields.id) } ) }
|
|
175
|
+
|
|
176
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): ItemDelisted<ToPhantomTypeArgument<T>> { if (!isItemDelisted(item.type)) { throw new Error("not a ItemDelisted type");
|
|
177
|
+
|
|
178
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
179
|
+
|
|
180
|
+
return ItemDelisted.reified( typeArg, ).new( { kiosk: decodeFromFieldsWithTypes(ID.reified(), item.fields.kiosk), id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id) } ) }
|
|
181
|
+
|
|
182
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): ItemDelisted<ToPhantomTypeArgument<T>> { return ItemDelisted.fromFields( typeArg, ItemDelisted.bcs.parse(data) ) }
|
|
183
|
+
|
|
184
|
+
toJSONField() { return {
|
|
185
|
+
|
|
186
|
+
kiosk: this.kiosk,id: this.id,
|
|
187
|
+
|
|
188
|
+
} }
|
|
189
|
+
|
|
190
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
191
|
+
|
|
192
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): ItemDelisted<ToPhantomTypeArgument<T>> { return ItemDelisted.reified( typeArg, ).new( { kiosk: decodeFromJSONField(ID.reified(), field.kiosk), id: decodeFromJSONField(ID.reified(), field.id) } ) }
|
|
193
|
+
|
|
194
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): ItemDelisted<ToPhantomTypeArgument<T>> { if (json.$typeName !== ItemDelisted.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(ItemDelisted.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
195
|
+
|
|
196
|
+
return ItemDelisted.fromJSONField( typeArg, json, ) }
|
|
197
|
+
|
|
198
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): ItemDelisted<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isItemDelisted(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a ItemDelisted object`); } return ItemDelisted.fromFieldsWithTypes( typeArg, content ); }
|
|
199
|
+
|
|
200
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<ItemDelisted<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching ItemDelisted object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isItemDelisted(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a ItemDelisted object`); }
|
|
201
|
+
return ItemDelisted.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
202
|
+
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* ============================== ItemListed =============================== */
|
|
206
|
+
|
|
207
|
+
export function isItemListed(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::kiosk::ItemListed<"); }
|
|
208
|
+
|
|
209
|
+
export interface ItemListedFields<T extends PhantomTypeArgument> { kiosk: ToField<ID>; id: ToField<ID>; price: ToField<"u64"> }
|
|
210
|
+
|
|
211
|
+
export type ItemListedReified<T extends PhantomTypeArgument> = Reified< ItemListed<T>, ItemListedFields<T> >;
|
|
212
|
+
|
|
213
|
+
export class ItemListed<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::kiosk::ItemListed"; static readonly $numTypeParams = 1;
|
|
214
|
+
|
|
215
|
+
readonly $typeName = ItemListed.$typeName;
|
|
216
|
+
|
|
217
|
+
readonly $fullTypeName: `0x2::kiosk::ItemListed<${PhantomToTypeStr<T>}>`;
|
|
218
|
+
|
|
219
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
220
|
+
|
|
221
|
+
readonly kiosk: ToField<ID>; readonly id: ToField<ID>; readonly price: ToField<"u64">
|
|
222
|
+
|
|
223
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: ItemListedFields<T>, ) { this.$fullTypeName = composeSuiType( ItemListed.$typeName, ...typeArgs ) as `0x2::kiosk::ItemListed<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
224
|
+
|
|
225
|
+
this.kiosk = fields.kiosk;; this.id = fields.id;; this.price = fields.price; }
|
|
226
|
+
|
|
227
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): ItemListedReified<ToPhantomTypeArgument<T>> { return { typeName: ItemListed.$typeName, fullTypeName: composeSuiType( ItemListed.$typeName, ...[extractType(T)] ) as `0x2::kiosk::ItemListed<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => ItemListed.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => ItemListed.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => ItemListed.fromBcs( T, data, ), bcs: ItemListed.bcs, fromJSONField: (field: any) => ItemListed.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => ItemListed.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => ItemListed.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => ItemListed.fetch( client, T, id, ), new: ( fields: ItemListedFields<ToPhantomTypeArgument<T>>, ) => { return new ItemListed( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
228
|
+
|
|
229
|
+
static get r() { return ItemListed.reified }
|
|
230
|
+
|
|
231
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<ItemListed<ToPhantomTypeArgument<T>>>> { return phantom(ItemListed.reified( T )); } static get p() { return ItemListed.phantom }
|
|
232
|
+
|
|
233
|
+
static get bcs() { return bcs.struct("ItemListed", {
|
|
234
|
+
|
|
235
|
+
kiosk: ID.bcs, id: ID.bcs, price: bcs.u64()
|
|
236
|
+
|
|
237
|
+
}) };
|
|
238
|
+
|
|
239
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): ItemListed<ToPhantomTypeArgument<T>> { return ItemListed.reified( typeArg, ).new( { kiosk: decodeFromFields(ID.reified(), fields.kiosk), id: decodeFromFields(ID.reified(), fields.id), price: decodeFromFields("u64", fields.price) } ) }
|
|
240
|
+
|
|
241
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): ItemListed<ToPhantomTypeArgument<T>> { if (!isItemListed(item.type)) { throw new Error("not a ItemListed type");
|
|
242
|
+
|
|
243
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
244
|
+
|
|
245
|
+
return ItemListed.reified( typeArg, ).new( { kiosk: decodeFromFieldsWithTypes(ID.reified(), item.fields.kiosk), id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id), price: decodeFromFieldsWithTypes("u64", item.fields.price) } ) }
|
|
246
|
+
|
|
247
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): ItemListed<ToPhantomTypeArgument<T>> { return ItemListed.fromFields( typeArg, ItemListed.bcs.parse(data) ) }
|
|
248
|
+
|
|
249
|
+
toJSONField() { return {
|
|
250
|
+
|
|
251
|
+
kiosk: this.kiosk,id: this.id,price: this.price.toString(),
|
|
252
|
+
|
|
253
|
+
} }
|
|
254
|
+
|
|
255
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
256
|
+
|
|
257
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): ItemListed<ToPhantomTypeArgument<T>> { return ItemListed.reified( typeArg, ).new( { kiosk: decodeFromJSONField(ID.reified(), field.kiosk), id: decodeFromJSONField(ID.reified(), field.id), price: decodeFromJSONField("u64", field.price) } ) }
|
|
258
|
+
|
|
259
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): ItemListed<ToPhantomTypeArgument<T>> { if (json.$typeName !== ItemListed.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(ItemListed.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
260
|
+
|
|
261
|
+
return ItemListed.fromJSONField( typeArg, json, ) }
|
|
262
|
+
|
|
263
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): ItemListed<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isItemListed(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a ItemListed object`); } return ItemListed.fromFieldsWithTypes( typeArg, content ); }
|
|
264
|
+
|
|
265
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<ItemListed<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching ItemListed object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isItemListed(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a ItemListed object`); }
|
|
266
|
+
return ItemListed.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* ============================== ItemPurchased =============================== */
|
|
271
|
+
|
|
272
|
+
export function isItemPurchased(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::kiosk::ItemPurchased<"); }
|
|
273
|
+
|
|
274
|
+
export interface ItemPurchasedFields<T extends PhantomTypeArgument> { kiosk: ToField<ID>; id: ToField<ID>; price: ToField<"u64"> }
|
|
275
|
+
|
|
276
|
+
export type ItemPurchasedReified<T extends PhantomTypeArgument> = Reified< ItemPurchased<T>, ItemPurchasedFields<T> >;
|
|
277
|
+
|
|
278
|
+
export class ItemPurchased<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::kiosk::ItemPurchased"; static readonly $numTypeParams = 1;
|
|
279
|
+
|
|
280
|
+
readonly $typeName = ItemPurchased.$typeName;
|
|
281
|
+
|
|
282
|
+
readonly $fullTypeName: `0x2::kiosk::ItemPurchased<${PhantomToTypeStr<T>}>`;
|
|
283
|
+
|
|
284
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
285
|
+
|
|
286
|
+
readonly kiosk: ToField<ID>; readonly id: ToField<ID>; readonly price: ToField<"u64">
|
|
287
|
+
|
|
288
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: ItemPurchasedFields<T>, ) { this.$fullTypeName = composeSuiType( ItemPurchased.$typeName, ...typeArgs ) as `0x2::kiosk::ItemPurchased<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
289
|
+
|
|
290
|
+
this.kiosk = fields.kiosk;; this.id = fields.id;; this.price = fields.price; }
|
|
291
|
+
|
|
292
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): ItemPurchasedReified<ToPhantomTypeArgument<T>> { return { typeName: ItemPurchased.$typeName, fullTypeName: composeSuiType( ItemPurchased.$typeName, ...[extractType(T)] ) as `0x2::kiosk::ItemPurchased<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => ItemPurchased.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => ItemPurchased.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => ItemPurchased.fromBcs( T, data, ), bcs: ItemPurchased.bcs, fromJSONField: (field: any) => ItemPurchased.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => ItemPurchased.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => ItemPurchased.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => ItemPurchased.fetch( client, T, id, ), new: ( fields: ItemPurchasedFields<ToPhantomTypeArgument<T>>, ) => { return new ItemPurchased( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
293
|
+
|
|
294
|
+
static get r() { return ItemPurchased.reified }
|
|
295
|
+
|
|
296
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<ItemPurchased<ToPhantomTypeArgument<T>>>> { return phantom(ItemPurchased.reified( T )); } static get p() { return ItemPurchased.phantom }
|
|
297
|
+
|
|
298
|
+
static get bcs() { return bcs.struct("ItemPurchased", {
|
|
299
|
+
|
|
300
|
+
kiosk: ID.bcs, id: ID.bcs, price: bcs.u64()
|
|
301
|
+
|
|
302
|
+
}) };
|
|
303
|
+
|
|
304
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): ItemPurchased<ToPhantomTypeArgument<T>> { return ItemPurchased.reified( typeArg, ).new( { kiosk: decodeFromFields(ID.reified(), fields.kiosk), id: decodeFromFields(ID.reified(), fields.id), price: decodeFromFields("u64", fields.price) } ) }
|
|
305
|
+
|
|
306
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): ItemPurchased<ToPhantomTypeArgument<T>> { if (!isItemPurchased(item.type)) { throw new Error("not a ItemPurchased type");
|
|
307
|
+
|
|
308
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
309
|
+
|
|
310
|
+
return ItemPurchased.reified( typeArg, ).new( { kiosk: decodeFromFieldsWithTypes(ID.reified(), item.fields.kiosk), id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id), price: decodeFromFieldsWithTypes("u64", item.fields.price) } ) }
|
|
311
|
+
|
|
312
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): ItemPurchased<ToPhantomTypeArgument<T>> { return ItemPurchased.fromFields( typeArg, ItemPurchased.bcs.parse(data) ) }
|
|
313
|
+
|
|
314
|
+
toJSONField() { return {
|
|
315
|
+
|
|
316
|
+
kiosk: this.kiosk,id: this.id,price: this.price.toString(),
|
|
317
|
+
|
|
318
|
+
} }
|
|
319
|
+
|
|
320
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
321
|
+
|
|
322
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): ItemPurchased<ToPhantomTypeArgument<T>> { return ItemPurchased.reified( typeArg, ).new( { kiosk: decodeFromJSONField(ID.reified(), field.kiosk), id: decodeFromJSONField(ID.reified(), field.id), price: decodeFromJSONField("u64", field.price) } ) }
|
|
323
|
+
|
|
324
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): ItemPurchased<ToPhantomTypeArgument<T>> { if (json.$typeName !== ItemPurchased.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(ItemPurchased.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
325
|
+
|
|
326
|
+
return ItemPurchased.fromJSONField( typeArg, json, ) }
|
|
327
|
+
|
|
328
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): ItemPurchased<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isItemPurchased(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a ItemPurchased object`); } return ItemPurchased.fromFieldsWithTypes( typeArg, content ); }
|
|
329
|
+
|
|
330
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<ItemPurchased<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching ItemPurchased object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isItemPurchased(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a ItemPurchased object`); }
|
|
331
|
+
return ItemPurchased.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/* ============================== Kiosk =============================== */
|
|
336
|
+
|
|
337
|
+
export function isKiosk(type: string): boolean { type = compressSuiType(type); return type === "0x2::kiosk::Kiosk"; }
|
|
338
|
+
|
|
339
|
+
export interface KioskFields { id: ToField<UID>; profits: ToField<Balance<ToPhantom<SUI>>>; owner: ToField<"address">; itemCount: ToField<"u32">; allowExtensions: ToField<"bool"> }
|
|
340
|
+
|
|
341
|
+
export type KioskReified = Reified< Kiosk, KioskFields >;
|
|
342
|
+
|
|
343
|
+
export class Kiosk implements StructClass { static readonly $typeName = "0x2::kiosk::Kiosk"; static readonly $numTypeParams = 0;
|
|
344
|
+
|
|
345
|
+
readonly $typeName = Kiosk.$typeName;
|
|
346
|
+
|
|
347
|
+
readonly $fullTypeName: "0x2::kiosk::Kiosk";
|
|
348
|
+
|
|
349
|
+
readonly $typeArgs: [];
|
|
350
|
+
|
|
351
|
+
readonly id: ToField<UID>; readonly profits: ToField<Balance<ToPhantom<SUI>>>; readonly owner: ToField<"address">; readonly itemCount: ToField<"u32">; readonly allowExtensions: ToField<"bool">
|
|
352
|
+
|
|
353
|
+
private constructor(typeArgs: [], fields: KioskFields, ) { this.$fullTypeName = composeSuiType( Kiosk.$typeName, ...typeArgs ) as "0x2::kiosk::Kiosk"; this.$typeArgs = typeArgs;
|
|
354
|
+
|
|
355
|
+
this.id = fields.id;; this.profits = fields.profits;; this.owner = fields.owner;; this.itemCount = fields.itemCount;; this.allowExtensions = fields.allowExtensions; }
|
|
356
|
+
|
|
357
|
+
static reified( ): KioskReified { return { typeName: Kiosk.$typeName, fullTypeName: composeSuiType( Kiosk.$typeName, ...[] ) as "0x2::kiosk::Kiosk", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Kiosk.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Kiosk.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Kiosk.fromBcs( data, ), bcs: Kiosk.bcs, fromJSONField: (field: any) => Kiosk.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Kiosk.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Kiosk.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Kiosk.fetch( client, id, ), new: ( fields: KioskFields, ) => { return new Kiosk( [], fields ) }, kind: "StructClassReified", } }
|
|
358
|
+
|
|
359
|
+
static get r() { return Kiosk.reified() }
|
|
360
|
+
|
|
361
|
+
static phantom( ): PhantomReified<ToTypeStr<Kiosk>> { return phantom(Kiosk.reified( )); } static get p() { return Kiosk.phantom() }
|
|
362
|
+
|
|
363
|
+
static get bcs() { return bcs.struct("Kiosk", {
|
|
364
|
+
|
|
365
|
+
id: UID.bcs, profits: Balance.bcs, owner: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val), }), item_count: bcs.u32(), allow_extensions: bcs.bool()
|
|
366
|
+
|
|
367
|
+
}) };
|
|
368
|
+
|
|
369
|
+
static fromFields( fields: Record<string, any> ): Kiosk { return Kiosk.reified( ).new( { id: decodeFromFields(UID.reified(), fields.id), profits: decodeFromFields(Balance.reified(reified.phantom(SUI.reified())), fields.profits), owner: decodeFromFields("address", fields.owner), itemCount: decodeFromFields("u32", fields.item_count), allowExtensions: decodeFromFields("bool", fields.allow_extensions) } ) }
|
|
370
|
+
|
|
371
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Kiosk { if (!isKiosk(item.type)) { throw new Error("not a Kiosk type");
|
|
372
|
+
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
return Kiosk.reified( ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), profits: decodeFromFieldsWithTypes(Balance.reified(reified.phantom(SUI.reified())), item.fields.profits), owner: decodeFromFieldsWithTypes("address", item.fields.owner), itemCount: decodeFromFieldsWithTypes("u32", item.fields.item_count), allowExtensions: decodeFromFieldsWithTypes("bool", item.fields.allow_extensions) } ) }
|
|
376
|
+
|
|
377
|
+
static fromBcs( data: Uint8Array ): Kiosk { return Kiosk.fromFields( Kiosk.bcs.parse(data) ) }
|
|
378
|
+
|
|
379
|
+
toJSONField() { return {
|
|
380
|
+
|
|
381
|
+
id: this.id,profits: this.profits.toJSONField(),owner: this.owner,itemCount: this.itemCount,allowExtensions: this.allowExtensions,
|
|
382
|
+
|
|
383
|
+
} }
|
|
384
|
+
|
|
385
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
386
|
+
|
|
387
|
+
static fromJSONField( field: any ): Kiosk { return Kiosk.reified( ).new( { id: decodeFromJSONField(UID.reified(), field.id), profits: decodeFromJSONField(Balance.reified(reified.phantom(SUI.reified())), field.profits), owner: decodeFromJSONField("address", field.owner), itemCount: decodeFromJSONField("u32", field.itemCount), allowExtensions: decodeFromJSONField("bool", field.allowExtensions) } ) }
|
|
388
|
+
|
|
389
|
+
static fromJSON( json: Record<string, any> ): Kiosk { if (json.$typeName !== Kiosk.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
390
|
+
|
|
391
|
+
return Kiosk.fromJSONField( json, ) }
|
|
392
|
+
|
|
393
|
+
static fromSuiParsedData( content: SuiParsedData ): Kiosk { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isKiosk(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Kiosk object`); } return Kiosk.fromFieldsWithTypes( content ); }
|
|
394
|
+
|
|
395
|
+
static async fetch( client: SuiClient, id: string ): Promise<Kiosk> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Kiosk object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isKiosk(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Kiosk object`); }
|
|
396
|
+
return Kiosk.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
397
|
+
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* ============================== KioskOwnerCap =============================== */
|
|
401
|
+
|
|
402
|
+
export function isKioskOwnerCap(type: string): boolean { type = compressSuiType(type); return type === "0x2::kiosk::KioskOwnerCap"; }
|
|
403
|
+
|
|
404
|
+
export interface KioskOwnerCapFields { id: ToField<UID>; for: ToField<ID> }
|
|
405
|
+
|
|
406
|
+
export type KioskOwnerCapReified = Reified< KioskOwnerCap, KioskOwnerCapFields >;
|
|
407
|
+
|
|
408
|
+
export class KioskOwnerCap implements StructClass { static readonly $typeName = "0x2::kiosk::KioskOwnerCap"; static readonly $numTypeParams = 0;
|
|
409
|
+
|
|
410
|
+
readonly $typeName = KioskOwnerCap.$typeName;
|
|
411
|
+
|
|
412
|
+
readonly $fullTypeName: "0x2::kiosk::KioskOwnerCap";
|
|
413
|
+
|
|
414
|
+
readonly $typeArgs: [];
|
|
415
|
+
|
|
416
|
+
readonly id: ToField<UID>; readonly for: ToField<ID>
|
|
417
|
+
|
|
418
|
+
private constructor(typeArgs: [], fields: KioskOwnerCapFields, ) { this.$fullTypeName = composeSuiType( KioskOwnerCap.$typeName, ...typeArgs ) as "0x2::kiosk::KioskOwnerCap"; this.$typeArgs = typeArgs;
|
|
419
|
+
|
|
420
|
+
this.id = fields.id;; this.for = fields.for; }
|
|
421
|
+
|
|
422
|
+
static reified( ): KioskOwnerCapReified { return { typeName: KioskOwnerCap.$typeName, fullTypeName: composeSuiType( KioskOwnerCap.$typeName, ...[] ) as "0x2::kiosk::KioskOwnerCap", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => KioskOwnerCap.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => KioskOwnerCap.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => KioskOwnerCap.fromBcs( data, ), bcs: KioskOwnerCap.bcs, fromJSONField: (field: any) => KioskOwnerCap.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => KioskOwnerCap.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => KioskOwnerCap.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => KioskOwnerCap.fetch( client, id, ), new: ( fields: KioskOwnerCapFields, ) => { return new KioskOwnerCap( [], fields ) }, kind: "StructClassReified", } }
|
|
423
|
+
|
|
424
|
+
static get r() { return KioskOwnerCap.reified() }
|
|
425
|
+
|
|
426
|
+
static phantom( ): PhantomReified<ToTypeStr<KioskOwnerCap>> { return phantom(KioskOwnerCap.reified( )); } static get p() { return KioskOwnerCap.phantom() }
|
|
427
|
+
|
|
428
|
+
static get bcs() { return bcs.struct("KioskOwnerCap", {
|
|
429
|
+
|
|
430
|
+
id: UID.bcs, for: ID.bcs
|
|
431
|
+
|
|
432
|
+
}) };
|
|
433
|
+
|
|
434
|
+
static fromFields( fields: Record<string, any> ): KioskOwnerCap { return KioskOwnerCap.reified( ).new( { id: decodeFromFields(UID.reified(), fields.id), for: decodeFromFields(ID.reified(), fields.for) } ) }
|
|
435
|
+
|
|
436
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): KioskOwnerCap { if (!isKioskOwnerCap(item.type)) { throw new Error("not a KioskOwnerCap type");
|
|
437
|
+
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return KioskOwnerCap.reified( ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), for: decodeFromFieldsWithTypes(ID.reified(), item.fields.for) } ) }
|
|
441
|
+
|
|
442
|
+
static fromBcs( data: Uint8Array ): KioskOwnerCap { return KioskOwnerCap.fromFields( KioskOwnerCap.bcs.parse(data) ) }
|
|
443
|
+
|
|
444
|
+
toJSONField() { return {
|
|
445
|
+
|
|
446
|
+
id: this.id,for: this.for,
|
|
447
|
+
|
|
448
|
+
} }
|
|
449
|
+
|
|
450
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
451
|
+
|
|
452
|
+
static fromJSONField( field: any ): KioskOwnerCap { return KioskOwnerCap.reified( ).new( { id: decodeFromJSONField(UID.reified(), field.id), for: decodeFromJSONField(ID.reified(), field.for) } ) }
|
|
453
|
+
|
|
454
|
+
static fromJSON( json: Record<string, any> ): KioskOwnerCap { if (json.$typeName !== KioskOwnerCap.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
455
|
+
|
|
456
|
+
return KioskOwnerCap.fromJSONField( json, ) }
|
|
457
|
+
|
|
458
|
+
static fromSuiParsedData( content: SuiParsedData ): KioskOwnerCap { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isKioskOwnerCap(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a KioskOwnerCap object`); } return KioskOwnerCap.fromFieldsWithTypes( content ); }
|
|
459
|
+
|
|
460
|
+
static async fetch( client: SuiClient, id: string ): Promise<KioskOwnerCap> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching KioskOwnerCap object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isKioskOwnerCap(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a KioskOwnerCap object`); }
|
|
461
|
+
return KioskOwnerCap.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
462
|
+
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/* ============================== Listing =============================== */
|
|
466
|
+
|
|
467
|
+
export function isListing(type: string): boolean { type = compressSuiType(type); return type === "0x2::kiosk::Listing"; }
|
|
468
|
+
|
|
469
|
+
export interface ListingFields { id: ToField<ID>; isExclusive: ToField<"bool"> }
|
|
470
|
+
|
|
471
|
+
export type ListingReified = Reified< Listing, ListingFields >;
|
|
472
|
+
|
|
473
|
+
export class Listing implements StructClass { static readonly $typeName = "0x2::kiosk::Listing"; static readonly $numTypeParams = 0;
|
|
474
|
+
|
|
475
|
+
readonly $typeName = Listing.$typeName;
|
|
476
|
+
|
|
477
|
+
readonly $fullTypeName: "0x2::kiosk::Listing";
|
|
478
|
+
|
|
479
|
+
readonly $typeArgs: [];
|
|
480
|
+
|
|
481
|
+
readonly id: ToField<ID>; readonly isExclusive: ToField<"bool">
|
|
482
|
+
|
|
483
|
+
private constructor(typeArgs: [], fields: ListingFields, ) { this.$fullTypeName = composeSuiType( Listing.$typeName, ...typeArgs ) as "0x2::kiosk::Listing"; this.$typeArgs = typeArgs;
|
|
484
|
+
|
|
485
|
+
this.id = fields.id;; this.isExclusive = fields.isExclusive; }
|
|
486
|
+
|
|
487
|
+
static reified( ): ListingReified { return { typeName: Listing.$typeName, fullTypeName: composeSuiType( Listing.$typeName, ...[] ) as "0x2::kiosk::Listing", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Listing.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Listing.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Listing.fromBcs( data, ), bcs: Listing.bcs, fromJSONField: (field: any) => Listing.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Listing.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Listing.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Listing.fetch( client, id, ), new: ( fields: ListingFields, ) => { return new Listing( [], fields ) }, kind: "StructClassReified", } }
|
|
488
|
+
|
|
489
|
+
static get r() { return Listing.reified() }
|
|
490
|
+
|
|
491
|
+
static phantom( ): PhantomReified<ToTypeStr<Listing>> { return phantom(Listing.reified( )); } static get p() { return Listing.phantom() }
|
|
492
|
+
|
|
493
|
+
static get bcs() { return bcs.struct("Listing", {
|
|
494
|
+
|
|
495
|
+
id: ID.bcs, is_exclusive: bcs.bool()
|
|
496
|
+
|
|
497
|
+
}) };
|
|
498
|
+
|
|
499
|
+
static fromFields( fields: Record<string, any> ): Listing { return Listing.reified( ).new( { id: decodeFromFields(ID.reified(), fields.id), isExclusive: decodeFromFields("bool", fields.is_exclusive) } ) }
|
|
500
|
+
|
|
501
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Listing { if (!isListing(item.type)) { throw new Error("not a Listing type");
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return Listing.reified( ).new( { id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id), isExclusive: decodeFromFieldsWithTypes("bool", item.fields.is_exclusive) } ) }
|
|
506
|
+
|
|
507
|
+
static fromBcs( data: Uint8Array ): Listing { return Listing.fromFields( Listing.bcs.parse(data) ) }
|
|
508
|
+
|
|
509
|
+
toJSONField() { return {
|
|
510
|
+
|
|
511
|
+
id: this.id,isExclusive: this.isExclusive,
|
|
512
|
+
|
|
513
|
+
} }
|
|
514
|
+
|
|
515
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
516
|
+
|
|
517
|
+
static fromJSONField( field: any ): Listing { return Listing.reified( ).new( { id: decodeFromJSONField(ID.reified(), field.id), isExclusive: decodeFromJSONField("bool", field.isExclusive) } ) }
|
|
518
|
+
|
|
519
|
+
static fromJSON( json: Record<string, any> ): Listing { if (json.$typeName !== Listing.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
520
|
+
|
|
521
|
+
return Listing.fromJSONField( json, ) }
|
|
522
|
+
|
|
523
|
+
static fromSuiParsedData( content: SuiParsedData ): Listing { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isListing(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Listing object`); } return Listing.fromFieldsWithTypes( content ); }
|
|
524
|
+
|
|
525
|
+
static async fetch( client: SuiClient, id: string ): Promise<Listing> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Listing object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isListing(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Listing object`); }
|
|
526
|
+
return Listing.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
527
|
+
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/* ============================== Lock =============================== */
|
|
531
|
+
|
|
532
|
+
export function isLock(type: string): boolean { type = compressSuiType(type); return type === "0x2::kiosk::Lock"; }
|
|
533
|
+
|
|
534
|
+
export interface LockFields { id: ToField<ID> }
|
|
535
|
+
|
|
536
|
+
export type LockReified = Reified< Lock, LockFields >;
|
|
537
|
+
|
|
538
|
+
export class Lock implements StructClass { static readonly $typeName = "0x2::kiosk::Lock"; static readonly $numTypeParams = 0;
|
|
539
|
+
|
|
540
|
+
readonly $typeName = Lock.$typeName;
|
|
541
|
+
|
|
542
|
+
readonly $fullTypeName: "0x2::kiosk::Lock";
|
|
543
|
+
|
|
544
|
+
readonly $typeArgs: [];
|
|
545
|
+
|
|
546
|
+
readonly id: ToField<ID>
|
|
547
|
+
|
|
548
|
+
private constructor(typeArgs: [], fields: LockFields, ) { this.$fullTypeName = composeSuiType( Lock.$typeName, ...typeArgs ) as "0x2::kiosk::Lock"; this.$typeArgs = typeArgs;
|
|
549
|
+
|
|
550
|
+
this.id = fields.id; }
|
|
551
|
+
|
|
552
|
+
static reified( ): LockReified { return { typeName: Lock.$typeName, fullTypeName: composeSuiType( Lock.$typeName, ...[] ) as "0x2::kiosk::Lock", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Lock.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Lock.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Lock.fromBcs( data, ), bcs: Lock.bcs, fromJSONField: (field: any) => Lock.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Lock.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Lock.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Lock.fetch( client, id, ), new: ( fields: LockFields, ) => { return new Lock( [], fields ) }, kind: "StructClassReified", } }
|
|
553
|
+
|
|
554
|
+
static get r() { return Lock.reified() }
|
|
555
|
+
|
|
556
|
+
static phantom( ): PhantomReified<ToTypeStr<Lock>> { return phantom(Lock.reified( )); } static get p() { return Lock.phantom() }
|
|
557
|
+
|
|
558
|
+
static get bcs() { return bcs.struct("Lock", {
|
|
559
|
+
|
|
560
|
+
id: ID.bcs
|
|
561
|
+
|
|
562
|
+
}) };
|
|
563
|
+
|
|
564
|
+
static fromFields( fields: Record<string, any> ): Lock { return Lock.reified( ).new( { id: decodeFromFields(ID.reified(), fields.id) } ) }
|
|
565
|
+
|
|
566
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Lock { if (!isLock(item.type)) { throw new Error("not a Lock type");
|
|
567
|
+
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return Lock.reified( ).new( { id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id) } ) }
|
|
571
|
+
|
|
572
|
+
static fromBcs( data: Uint8Array ): Lock { return Lock.fromFields( Lock.bcs.parse(data) ) }
|
|
573
|
+
|
|
574
|
+
toJSONField() { return {
|
|
575
|
+
|
|
576
|
+
id: this.id,
|
|
577
|
+
|
|
578
|
+
} }
|
|
579
|
+
|
|
580
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
581
|
+
|
|
582
|
+
static fromJSONField( field: any ): Lock { return Lock.reified( ).new( { id: decodeFromJSONField(ID.reified(), field.id) } ) }
|
|
583
|
+
|
|
584
|
+
static fromJSON( json: Record<string, any> ): Lock { if (json.$typeName !== Lock.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
585
|
+
|
|
586
|
+
return Lock.fromJSONField( json, ) }
|
|
587
|
+
|
|
588
|
+
static fromSuiParsedData( content: SuiParsedData ): Lock { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isLock(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Lock object`); } return Lock.fromFieldsWithTypes( content ); }
|
|
589
|
+
|
|
590
|
+
static async fetch( client: SuiClient, id: string ): Promise<Lock> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Lock object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isLock(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Lock object`); }
|
|
591
|
+
return Lock.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
592
|
+
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/* ============================== PurchaseCap =============================== */
|
|
596
|
+
|
|
597
|
+
export function isPurchaseCap(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::kiosk::PurchaseCap<"); }
|
|
598
|
+
|
|
599
|
+
export interface PurchaseCapFields<T extends PhantomTypeArgument> { id: ToField<UID>; kioskId: ToField<ID>; itemId: ToField<ID>; minPrice: ToField<"u64"> }
|
|
600
|
+
|
|
601
|
+
export type PurchaseCapReified<T extends PhantomTypeArgument> = Reified< PurchaseCap<T>, PurchaseCapFields<T> >;
|
|
602
|
+
|
|
603
|
+
export class PurchaseCap<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::kiosk::PurchaseCap"; static readonly $numTypeParams = 1;
|
|
604
|
+
|
|
605
|
+
readonly $typeName = PurchaseCap.$typeName;
|
|
606
|
+
|
|
607
|
+
readonly $fullTypeName: `0x2::kiosk::PurchaseCap<${PhantomToTypeStr<T>}>`;
|
|
608
|
+
|
|
609
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
610
|
+
|
|
611
|
+
readonly id: ToField<UID>; readonly kioskId: ToField<ID>; readonly itemId: ToField<ID>; readonly minPrice: ToField<"u64">
|
|
612
|
+
|
|
613
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: PurchaseCapFields<T>, ) { this.$fullTypeName = composeSuiType( PurchaseCap.$typeName, ...typeArgs ) as `0x2::kiosk::PurchaseCap<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
614
|
+
|
|
615
|
+
this.id = fields.id;; this.kioskId = fields.kioskId;; this.itemId = fields.itemId;; this.minPrice = fields.minPrice; }
|
|
616
|
+
|
|
617
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PurchaseCapReified<ToPhantomTypeArgument<T>> { return { typeName: PurchaseCap.$typeName, fullTypeName: composeSuiType( PurchaseCap.$typeName, ...[extractType(T)] ) as `0x2::kiosk::PurchaseCap<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => PurchaseCap.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => PurchaseCap.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => PurchaseCap.fromBcs( T, data, ), bcs: PurchaseCap.bcs, fromJSONField: (field: any) => PurchaseCap.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => PurchaseCap.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => PurchaseCap.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => PurchaseCap.fetch( client, T, id, ), new: ( fields: PurchaseCapFields<ToPhantomTypeArgument<T>>, ) => { return new PurchaseCap( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
618
|
+
|
|
619
|
+
static get r() { return PurchaseCap.reified }
|
|
620
|
+
|
|
621
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<PurchaseCap<ToPhantomTypeArgument<T>>>> { return phantom(PurchaseCap.reified( T )); } static get p() { return PurchaseCap.phantom }
|
|
622
|
+
|
|
623
|
+
static get bcs() { return bcs.struct("PurchaseCap", {
|
|
624
|
+
|
|
625
|
+
id: UID.bcs, kiosk_id: ID.bcs, item_id: ID.bcs, min_price: bcs.u64()
|
|
626
|
+
|
|
627
|
+
}) };
|
|
628
|
+
|
|
629
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): PurchaseCap<ToPhantomTypeArgument<T>> { return PurchaseCap.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), kioskId: decodeFromFields(ID.reified(), fields.kiosk_id), itemId: decodeFromFields(ID.reified(), fields.item_id), minPrice: decodeFromFields("u64", fields.min_price) } ) }
|
|
630
|
+
|
|
631
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): PurchaseCap<ToPhantomTypeArgument<T>> { if (!isPurchaseCap(item.type)) { throw new Error("not a PurchaseCap type");
|
|
632
|
+
|
|
633
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
634
|
+
|
|
635
|
+
return PurchaseCap.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), kioskId: decodeFromFieldsWithTypes(ID.reified(), item.fields.kiosk_id), itemId: decodeFromFieldsWithTypes(ID.reified(), item.fields.item_id), minPrice: decodeFromFieldsWithTypes("u64", item.fields.min_price) } ) }
|
|
636
|
+
|
|
637
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): PurchaseCap<ToPhantomTypeArgument<T>> { return PurchaseCap.fromFields( typeArg, PurchaseCap.bcs.parse(data) ) }
|
|
638
|
+
|
|
639
|
+
toJSONField() { return {
|
|
640
|
+
|
|
641
|
+
id: this.id,kioskId: this.kioskId,itemId: this.itemId,minPrice: this.minPrice.toString(),
|
|
642
|
+
|
|
643
|
+
} }
|
|
644
|
+
|
|
645
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
646
|
+
|
|
647
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): PurchaseCap<ToPhantomTypeArgument<T>> { return PurchaseCap.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), kioskId: decodeFromJSONField(ID.reified(), field.kioskId), itemId: decodeFromJSONField(ID.reified(), field.itemId), minPrice: decodeFromJSONField("u64", field.minPrice) } ) }
|
|
648
|
+
|
|
649
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): PurchaseCap<ToPhantomTypeArgument<T>> { if (json.$typeName !== PurchaseCap.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(PurchaseCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
650
|
+
|
|
651
|
+
return PurchaseCap.fromJSONField( typeArg, json, ) }
|
|
652
|
+
|
|
653
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): PurchaseCap<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isPurchaseCap(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a PurchaseCap object`); } return PurchaseCap.fromFieldsWithTypes( typeArg, content ); }
|
|
654
|
+
|
|
655
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<PurchaseCap<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching PurchaseCap object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isPurchaseCap(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a PurchaseCap object`); }
|
|
656
|
+
return PurchaseCap.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
657
|
+
|
|
658
|
+
}
|