@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,202 @@
|
|
|
1
|
+
import {PhantomReified, PhantomToTypeStr, PhantomTypeArgument, Reified, StructClass, ToField, ToPhantomTypeArgument, ToTypeStr, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {String} from "../../0x1/string/structs";
|
|
4
|
+
import {ID, UID} from "../object/structs";
|
|
5
|
+
import {VecMap} from "../vec-map/structs";
|
|
6
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
7
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
8
|
+
|
|
9
|
+
/* ============================== Display =============================== */
|
|
10
|
+
|
|
11
|
+
export function isDisplay(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::display::Display<"); }
|
|
12
|
+
|
|
13
|
+
export interface DisplayFields<T extends PhantomTypeArgument> { id: ToField<UID>; fields: ToField<VecMap<String, String>>; version: ToField<"u16"> }
|
|
14
|
+
|
|
15
|
+
export type DisplayReified<T extends PhantomTypeArgument> = Reified< Display<T>, DisplayFields<T> >;
|
|
16
|
+
|
|
17
|
+
export class Display<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::display::Display"; static readonly $numTypeParams = 1;
|
|
18
|
+
|
|
19
|
+
readonly $typeName = Display.$typeName;
|
|
20
|
+
|
|
21
|
+
readonly $fullTypeName: `0x2::display::Display<${PhantomToTypeStr<T>}>`;
|
|
22
|
+
|
|
23
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
24
|
+
|
|
25
|
+
readonly id: ToField<UID>; readonly fields: ToField<VecMap<String, String>>; readonly version: ToField<"u16">
|
|
26
|
+
|
|
27
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: DisplayFields<T>, ) { this.$fullTypeName = composeSuiType( Display.$typeName, ...typeArgs ) as `0x2::display::Display<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
28
|
+
|
|
29
|
+
this.id = fields.id;; this.fields = fields.fields;; this.version = fields.version; }
|
|
30
|
+
|
|
31
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): DisplayReified<ToPhantomTypeArgument<T>> { return { typeName: Display.$typeName, fullTypeName: composeSuiType( Display.$typeName, ...[extractType(T)] ) as `0x2::display::Display<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => Display.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Display.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => Display.fromBcs( T, data, ), bcs: Display.bcs, fromJSONField: (field: any) => Display.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => Display.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => Display.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => Display.fetch( client, T, id, ), new: ( fields: DisplayFields<ToPhantomTypeArgument<T>>, ) => { return new Display( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
32
|
+
|
|
33
|
+
static get r() { return Display.reified }
|
|
34
|
+
|
|
35
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<Display<ToPhantomTypeArgument<T>>>> { return phantom(Display.reified( T )); } static get p() { return Display.phantom }
|
|
36
|
+
|
|
37
|
+
static get bcs() { return bcs.struct("Display", {
|
|
38
|
+
|
|
39
|
+
id: UID.bcs, fields: VecMap.bcs(String.bcs, String.bcs), version: bcs.u16()
|
|
40
|
+
|
|
41
|
+
}) };
|
|
42
|
+
|
|
43
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): Display<ToPhantomTypeArgument<T>> { return Display.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), fields: decodeFromFields(VecMap.reified(String.reified(), String.reified()), fields.fields), version: decodeFromFields("u16", fields.version) } ) }
|
|
44
|
+
|
|
45
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): Display<ToPhantomTypeArgument<T>> { if (!isDisplay(item.type)) { throw new Error("not a Display type");
|
|
46
|
+
|
|
47
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
48
|
+
|
|
49
|
+
return Display.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), fields: decodeFromFieldsWithTypes(VecMap.reified(String.reified(), String.reified()), item.fields.fields), version: decodeFromFieldsWithTypes("u16", item.fields.version) } ) }
|
|
50
|
+
|
|
51
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): Display<ToPhantomTypeArgument<T>> { return Display.fromFields( typeArg, Display.bcs.parse(data) ) }
|
|
52
|
+
|
|
53
|
+
toJSONField() { return {
|
|
54
|
+
|
|
55
|
+
id: this.id,fields: this.fields.toJSONField(),version: this.version,
|
|
56
|
+
|
|
57
|
+
} }
|
|
58
|
+
|
|
59
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
60
|
+
|
|
61
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): Display<ToPhantomTypeArgument<T>> { return Display.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), fields: decodeFromJSONField(VecMap.reified(String.reified(), String.reified()), field.fields), version: decodeFromJSONField("u16", field.version) } ) }
|
|
62
|
+
|
|
63
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): Display<ToPhantomTypeArgument<T>> { if (json.$typeName !== Display.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(Display.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
64
|
+
|
|
65
|
+
return Display.fromJSONField( typeArg, json, ) }
|
|
66
|
+
|
|
67
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): Display<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isDisplay(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Display object`); } return Display.fromFieldsWithTypes( typeArg, content ); }
|
|
68
|
+
|
|
69
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<Display<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Display object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isDisplay(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Display object`); }
|
|
70
|
+
return Display.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ============================== DisplayCreated =============================== */
|
|
75
|
+
|
|
76
|
+
export function isDisplayCreated(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::display::DisplayCreated<"); }
|
|
77
|
+
|
|
78
|
+
export interface DisplayCreatedFields<T extends PhantomTypeArgument> { id: ToField<ID> }
|
|
79
|
+
|
|
80
|
+
export type DisplayCreatedReified<T extends PhantomTypeArgument> = Reified< DisplayCreated<T>, DisplayCreatedFields<T> >;
|
|
81
|
+
|
|
82
|
+
export class DisplayCreated<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::display::DisplayCreated"; static readonly $numTypeParams = 1;
|
|
83
|
+
|
|
84
|
+
readonly $typeName = DisplayCreated.$typeName;
|
|
85
|
+
|
|
86
|
+
readonly $fullTypeName: `0x2::display::DisplayCreated<${PhantomToTypeStr<T>}>`;
|
|
87
|
+
|
|
88
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
89
|
+
|
|
90
|
+
readonly id: ToField<ID>
|
|
91
|
+
|
|
92
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: DisplayCreatedFields<T>, ) { this.$fullTypeName = composeSuiType( DisplayCreated.$typeName, ...typeArgs ) as `0x2::display::DisplayCreated<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
93
|
+
|
|
94
|
+
this.id = fields.id; }
|
|
95
|
+
|
|
96
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): DisplayCreatedReified<ToPhantomTypeArgument<T>> { return { typeName: DisplayCreated.$typeName, fullTypeName: composeSuiType( DisplayCreated.$typeName, ...[extractType(T)] ) as `0x2::display::DisplayCreated<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => DisplayCreated.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => DisplayCreated.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => DisplayCreated.fromBcs( T, data, ), bcs: DisplayCreated.bcs, fromJSONField: (field: any) => DisplayCreated.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => DisplayCreated.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => DisplayCreated.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => DisplayCreated.fetch( client, T, id, ), new: ( fields: DisplayCreatedFields<ToPhantomTypeArgument<T>>, ) => { return new DisplayCreated( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
97
|
+
|
|
98
|
+
static get r() { return DisplayCreated.reified }
|
|
99
|
+
|
|
100
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<DisplayCreated<ToPhantomTypeArgument<T>>>> { return phantom(DisplayCreated.reified( T )); } static get p() { return DisplayCreated.phantom }
|
|
101
|
+
|
|
102
|
+
static get bcs() { return bcs.struct("DisplayCreated", {
|
|
103
|
+
|
|
104
|
+
id: ID.bcs
|
|
105
|
+
|
|
106
|
+
}) };
|
|
107
|
+
|
|
108
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): DisplayCreated<ToPhantomTypeArgument<T>> { return DisplayCreated.reified( typeArg, ).new( { id: decodeFromFields(ID.reified(), fields.id) } ) }
|
|
109
|
+
|
|
110
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): DisplayCreated<ToPhantomTypeArgument<T>> { if (!isDisplayCreated(item.type)) { throw new Error("not a DisplayCreated type");
|
|
111
|
+
|
|
112
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
113
|
+
|
|
114
|
+
return DisplayCreated.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id) } ) }
|
|
115
|
+
|
|
116
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): DisplayCreated<ToPhantomTypeArgument<T>> { return DisplayCreated.fromFields( typeArg, DisplayCreated.bcs.parse(data) ) }
|
|
117
|
+
|
|
118
|
+
toJSONField() { return {
|
|
119
|
+
|
|
120
|
+
id: this.id,
|
|
121
|
+
|
|
122
|
+
} }
|
|
123
|
+
|
|
124
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
125
|
+
|
|
126
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): DisplayCreated<ToPhantomTypeArgument<T>> { return DisplayCreated.reified( typeArg, ).new( { id: decodeFromJSONField(ID.reified(), field.id) } ) }
|
|
127
|
+
|
|
128
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): DisplayCreated<ToPhantomTypeArgument<T>> { if (json.$typeName !== DisplayCreated.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(DisplayCreated.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
129
|
+
|
|
130
|
+
return DisplayCreated.fromJSONField( typeArg, json, ) }
|
|
131
|
+
|
|
132
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): DisplayCreated<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isDisplayCreated(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a DisplayCreated object`); } return DisplayCreated.fromFieldsWithTypes( typeArg, content ); }
|
|
133
|
+
|
|
134
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<DisplayCreated<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching DisplayCreated object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isDisplayCreated(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a DisplayCreated object`); }
|
|
135
|
+
return DisplayCreated.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* ============================== VersionUpdated =============================== */
|
|
140
|
+
|
|
141
|
+
export function isVersionUpdated(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::display::VersionUpdated<"); }
|
|
142
|
+
|
|
143
|
+
export interface VersionUpdatedFields<T extends PhantomTypeArgument> { id: ToField<ID>; version: ToField<"u16">; fields: ToField<VecMap<String, String>> }
|
|
144
|
+
|
|
145
|
+
export type VersionUpdatedReified<T extends PhantomTypeArgument> = Reified< VersionUpdated<T>, VersionUpdatedFields<T> >;
|
|
146
|
+
|
|
147
|
+
export class VersionUpdated<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::display::VersionUpdated"; static readonly $numTypeParams = 1;
|
|
148
|
+
|
|
149
|
+
readonly $typeName = VersionUpdated.$typeName;
|
|
150
|
+
|
|
151
|
+
readonly $fullTypeName: `0x2::display::VersionUpdated<${PhantomToTypeStr<T>}>`;
|
|
152
|
+
|
|
153
|
+
readonly $typeArgs: [PhantomToTypeStr<T>];
|
|
154
|
+
|
|
155
|
+
readonly id: ToField<ID>; readonly version: ToField<"u16">; readonly fields: ToField<VecMap<String, String>>
|
|
156
|
+
|
|
157
|
+
private constructor(typeArgs: [PhantomToTypeStr<T>], fields: VersionUpdatedFields<T>, ) { this.$fullTypeName = composeSuiType( VersionUpdated.$typeName, ...typeArgs ) as `0x2::display::VersionUpdated<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
|
|
158
|
+
|
|
159
|
+
this.id = fields.id;; this.version = fields.version;; this.fields = fields.fields; }
|
|
160
|
+
|
|
161
|
+
static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): VersionUpdatedReified<ToPhantomTypeArgument<T>> { return { typeName: VersionUpdated.$typeName, fullTypeName: composeSuiType( VersionUpdated.$typeName, ...[extractType(T)] ) as `0x2::display::VersionUpdated<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => VersionUpdated.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => VersionUpdated.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => VersionUpdated.fromBcs( T, data, ), bcs: VersionUpdated.bcs, fromJSONField: (field: any) => VersionUpdated.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => VersionUpdated.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => VersionUpdated.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => VersionUpdated.fetch( client, T, id, ), new: ( fields: VersionUpdatedFields<ToPhantomTypeArgument<T>>, ) => { return new VersionUpdated( [extractType(T)], fields ) }, kind: "StructClassReified", } }
|
|
162
|
+
|
|
163
|
+
static get r() { return VersionUpdated.reified }
|
|
164
|
+
|
|
165
|
+
static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<VersionUpdated<ToPhantomTypeArgument<T>>>> { return phantom(VersionUpdated.reified( T )); } static get p() { return VersionUpdated.phantom }
|
|
166
|
+
|
|
167
|
+
static get bcs() { return bcs.struct("VersionUpdated", {
|
|
168
|
+
|
|
169
|
+
id: ID.bcs, version: bcs.u16(), fields: VecMap.bcs(String.bcs, String.bcs)
|
|
170
|
+
|
|
171
|
+
}) };
|
|
172
|
+
|
|
173
|
+
static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): VersionUpdated<ToPhantomTypeArgument<T>> { return VersionUpdated.reified( typeArg, ).new( { id: decodeFromFields(ID.reified(), fields.id), version: decodeFromFields("u16", fields.version), fields: decodeFromFields(VecMap.reified(String.reified(), String.reified()), fields.fields) } ) }
|
|
174
|
+
|
|
175
|
+
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): VersionUpdated<ToPhantomTypeArgument<T>> { if (!isVersionUpdated(item.type)) { throw new Error("not a VersionUpdated type");
|
|
176
|
+
|
|
177
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
178
|
+
|
|
179
|
+
return VersionUpdated.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id), version: decodeFromFieldsWithTypes("u16", item.fields.version), fields: decodeFromFieldsWithTypes(VecMap.reified(String.reified(), String.reified()), item.fields.fields) } ) }
|
|
180
|
+
|
|
181
|
+
static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): VersionUpdated<ToPhantomTypeArgument<T>> { return VersionUpdated.fromFields( typeArg, VersionUpdated.bcs.parse(data) ) }
|
|
182
|
+
|
|
183
|
+
toJSONField() { return {
|
|
184
|
+
|
|
185
|
+
id: this.id,version: this.version,fields: this.fields.toJSONField(),
|
|
186
|
+
|
|
187
|
+
} }
|
|
188
|
+
|
|
189
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
190
|
+
|
|
191
|
+
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): VersionUpdated<ToPhantomTypeArgument<T>> { return VersionUpdated.reified( typeArg, ).new( { id: decodeFromJSONField(ID.reified(), field.id), version: decodeFromJSONField("u16", field.version), fields: decodeFromJSONField(VecMap.reified(String.reified(), String.reified()), field.fields) } ) }
|
|
192
|
+
|
|
193
|
+
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): VersionUpdated<ToPhantomTypeArgument<T>> { if (json.$typeName !== VersionUpdated.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(VersionUpdated.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
194
|
+
|
|
195
|
+
return VersionUpdated.fromJSONField( typeArg, json, ) }
|
|
196
|
+
|
|
197
|
+
static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): VersionUpdated<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isVersionUpdated(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a VersionUpdated object`); } return VersionUpdated.fromFieldsWithTypes( typeArg, content ); }
|
|
198
|
+
|
|
199
|
+
static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<VersionUpdated<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching VersionUpdated object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isVersionUpdated(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a VersionUpdated object`); }
|
|
200
|
+
return VersionUpdated.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
201
|
+
|
|
202
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeArgument, ToTypeStr, TypeArgument, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {UID} from "../object/structs";
|
|
4
|
+
import {BcsType, bcs, fromB64} from "@mysten/bcs";
|
|
5
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
6
|
+
|
|
7
|
+
/* ============================== Field =============================== */
|
|
8
|
+
|
|
9
|
+
export function isField(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::dynamic_field::Field<"); }
|
|
10
|
+
|
|
11
|
+
export interface FieldFields<Name extends TypeArgument, Value extends TypeArgument> { id: ToField<UID>; name: ToField<Name>; value: ToField<Value> }
|
|
12
|
+
|
|
13
|
+
export type FieldReified<Name extends TypeArgument, Value extends TypeArgument> = Reified< Field<Name, Value>, FieldFields<Name, Value> >;
|
|
14
|
+
|
|
15
|
+
export class Field<Name extends TypeArgument, Value extends TypeArgument> implements StructClass { static readonly $typeName = "0x2::dynamic_field::Field"; static readonly $numTypeParams = 2;
|
|
16
|
+
|
|
17
|
+
readonly $typeName = Field.$typeName;
|
|
18
|
+
|
|
19
|
+
readonly $fullTypeName: `0x2::dynamic_field::Field<${ToTypeStr<Name>}, ${ToTypeStr<Value>}>`;
|
|
20
|
+
|
|
21
|
+
readonly $typeArgs: [ToTypeStr<Name>, ToTypeStr<Value>];
|
|
22
|
+
|
|
23
|
+
readonly id: ToField<UID>; readonly name: ToField<Name>; readonly value: ToField<Value>
|
|
24
|
+
|
|
25
|
+
private constructor(typeArgs: [ToTypeStr<Name>, ToTypeStr<Value>], fields: FieldFields<Name, Value>, ) { this.$fullTypeName = composeSuiType( Field.$typeName, ...typeArgs ) as `0x2::dynamic_field::Field<${ToTypeStr<Name>}, ${ToTypeStr<Value>}>`; this.$typeArgs = typeArgs;
|
|
26
|
+
|
|
27
|
+
this.id = fields.id;; this.name = fields.name;; this.value = fields.value; }
|
|
28
|
+
|
|
29
|
+
static reified<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( Name: Name, Value: Value ): FieldReified<ToTypeArgument<Name>, ToTypeArgument<Value>> { return { typeName: Field.$typeName, fullTypeName: composeSuiType( Field.$typeName, ...[extractType(Name), extractType(Value)] ) as `0x2::dynamic_field::Field<${ToTypeStr<ToTypeArgument<Name>>}, ${ToTypeStr<ToTypeArgument<Value>>}>`, typeArgs: [ extractType(Name), extractType(Value) ] as [ToTypeStr<ToTypeArgument<Name>>, ToTypeStr<ToTypeArgument<Value>>], reifiedTypeArgs: [Name, Value], fromFields: (fields: Record<string, any>) => Field.fromFields( [Name, Value], fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Field.fromFieldsWithTypes( [Name, Value], item, ), fromBcs: (data: Uint8Array) => Field.fromBcs( [Name, Value], data, ), bcs: Field.bcs(toBcs(Name), toBcs(Value)), fromJSONField: (field: any) => Field.fromJSONField( [Name, Value], field, ), fromJSON: (json: Record<string, any>) => Field.fromJSON( [Name, Value], json, ), fromSuiParsedData: (content: SuiParsedData) => Field.fromSuiParsedData( [Name, Value], content, ), fetch: async (client: SuiClient, id: string) => Field.fetch( client, [Name, Value], id, ), new: ( fields: FieldFields<ToTypeArgument<Name>, ToTypeArgument<Value>>, ) => { return new Field( [extractType(Name), extractType(Value)], fields ) }, kind: "StructClassReified", } }
|
|
30
|
+
|
|
31
|
+
static get r() { return Field.reified }
|
|
32
|
+
|
|
33
|
+
static phantom<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( Name: Name, Value: Value ): PhantomReified<ToTypeStr<Field<ToTypeArgument<Name>, ToTypeArgument<Value>>>> { return phantom(Field.reified( Name, Value )); } static get p() { return Field.phantom }
|
|
34
|
+
|
|
35
|
+
static get bcs() { return <Name extends BcsType<any>, Value extends BcsType<any>>(Name: Name, Value: Value) => bcs.struct(`Field<${Name.name}, ${Value.name}>`, {
|
|
36
|
+
|
|
37
|
+
id: UID.bcs, name: Name, value: Value
|
|
38
|
+
|
|
39
|
+
}) };
|
|
40
|
+
|
|
41
|
+
static fromFields<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( typeArgs: [Name, Value], fields: Record<string, any> ): Field<ToTypeArgument<Name>, ToTypeArgument<Value>> { return Field.reified( typeArgs[0], typeArgs[1], ).new( { id: decodeFromFields(UID.reified(), fields.id), name: decodeFromFields(typeArgs[0], fields.name), value: decodeFromFields(typeArgs[1], fields.value) } ) }
|
|
42
|
+
|
|
43
|
+
static fromFieldsWithTypes<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( typeArgs: [Name, Value], item: FieldsWithTypes ): Field<ToTypeArgument<Name>, ToTypeArgument<Value>> { if (!isField(item.type)) { throw new Error("not a Field type");
|
|
44
|
+
|
|
45
|
+
} assertFieldsWithTypesArgsMatch(item, typeArgs);
|
|
46
|
+
|
|
47
|
+
return Field.reified( typeArgs[0], typeArgs[1], ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), name: decodeFromFieldsWithTypes(typeArgs[0], item.fields.name), value: decodeFromFieldsWithTypes(typeArgs[1], item.fields.value) } ) }
|
|
48
|
+
|
|
49
|
+
static fromBcs<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( typeArgs: [Name, Value], data: Uint8Array ): Field<ToTypeArgument<Name>, ToTypeArgument<Value>> { return Field.fromFields( typeArgs, Field.bcs( toBcs(typeArgs[0]), toBcs(typeArgs[1]) ).parse(data) ) }
|
|
50
|
+
|
|
51
|
+
toJSONField() { return {
|
|
52
|
+
|
|
53
|
+
id: this.id,name: fieldToJSON<Name>(this.$typeArgs[0], this.name),value: fieldToJSON<Value>(this.$typeArgs[1], this.value),
|
|
54
|
+
|
|
55
|
+
} }
|
|
56
|
+
|
|
57
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
58
|
+
|
|
59
|
+
static fromJSONField<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( typeArgs: [Name, Value], field: any ): Field<ToTypeArgument<Name>, ToTypeArgument<Value>> { return Field.reified( typeArgs[0], typeArgs[1], ).new( { id: decodeFromJSONField(UID.reified(), field.id), name: decodeFromJSONField(typeArgs[0], field.name), value: decodeFromJSONField(typeArgs[1], field.value) } ) }
|
|
60
|
+
|
|
61
|
+
static fromJSON<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( typeArgs: [Name, Value], json: Record<string, any> ): Field<ToTypeArgument<Name>, ToTypeArgument<Value>> { if (json.$typeName !== Field.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(Field.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs, )
|
|
62
|
+
|
|
63
|
+
return Field.fromJSONField( typeArgs, json, ) }
|
|
64
|
+
|
|
65
|
+
static fromSuiParsedData<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( typeArgs: [Name, Value], content: SuiParsedData ): Field<ToTypeArgument<Name>, ToTypeArgument<Value>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isField(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Field object`); } return Field.fromFieldsWithTypes( typeArgs, content ); }
|
|
66
|
+
|
|
67
|
+
static async fetch<Name extends Reified<TypeArgument, any>, Value extends Reified<TypeArgument, any>>( client: SuiClient, typeArgs: [Name, Value], id: string ): Promise<Field<ToTypeArgument<Name>, ToTypeArgument<Value>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Field object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isField(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Field object`); }
|
|
68
|
+
return Field.fromBcs( typeArgs, fromB64(res.data.bcs.bcsBytes) ); }
|
|
69
|
+
|
|
70
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeArgument, ToTypeStr, TypeArgument, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs} from "../../../../_framework/reified";
|
|
2
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
3
|
+
import {BcsType, bcs, fromB64} from "@mysten/bcs";
|
|
4
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
5
|
+
|
|
6
|
+
/* ============================== Wrapper =============================== */
|
|
7
|
+
|
|
8
|
+
export function isWrapper(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::dynamic_object_field::Wrapper<"); }
|
|
9
|
+
|
|
10
|
+
export interface WrapperFields<Name extends TypeArgument> { name: ToField<Name> }
|
|
11
|
+
|
|
12
|
+
export type WrapperReified<Name extends TypeArgument> = Reified< Wrapper<Name>, WrapperFields<Name> >;
|
|
13
|
+
|
|
14
|
+
export class Wrapper<Name extends TypeArgument> implements StructClass { static readonly $typeName = "0x2::dynamic_object_field::Wrapper"; static readonly $numTypeParams = 1;
|
|
15
|
+
|
|
16
|
+
readonly $typeName = Wrapper.$typeName;
|
|
17
|
+
|
|
18
|
+
readonly $fullTypeName: `0x2::dynamic_object_field::Wrapper<${ToTypeStr<Name>}>`;
|
|
19
|
+
|
|
20
|
+
readonly $typeArgs: [ToTypeStr<Name>];
|
|
21
|
+
|
|
22
|
+
readonly name: ToField<Name>
|
|
23
|
+
|
|
24
|
+
private constructor(typeArgs: [ToTypeStr<Name>], fields: WrapperFields<Name>, ) { this.$fullTypeName = composeSuiType( Wrapper.$typeName, ...typeArgs ) as `0x2::dynamic_object_field::Wrapper<${ToTypeStr<Name>}>`; this.$typeArgs = typeArgs;
|
|
25
|
+
|
|
26
|
+
this.name = fields.name; }
|
|
27
|
+
|
|
28
|
+
static reified<Name extends Reified<TypeArgument, any>>( Name: Name ): WrapperReified<ToTypeArgument<Name>> { return { typeName: Wrapper.$typeName, fullTypeName: composeSuiType( Wrapper.$typeName, ...[extractType(Name)] ) as `0x2::dynamic_object_field::Wrapper<${ToTypeStr<ToTypeArgument<Name>>}>`, typeArgs: [ extractType(Name) ] as [ToTypeStr<ToTypeArgument<Name>>], reifiedTypeArgs: [Name], fromFields: (fields: Record<string, any>) => Wrapper.fromFields( Name, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Wrapper.fromFieldsWithTypes( Name, item, ), fromBcs: (data: Uint8Array) => Wrapper.fromBcs( Name, data, ), bcs: Wrapper.bcs(toBcs(Name)), fromJSONField: (field: any) => Wrapper.fromJSONField( Name, field, ), fromJSON: (json: Record<string, any>) => Wrapper.fromJSON( Name, json, ), fromSuiParsedData: (content: SuiParsedData) => Wrapper.fromSuiParsedData( Name, content, ), fetch: async (client: SuiClient, id: string) => Wrapper.fetch( client, Name, id, ), new: ( fields: WrapperFields<ToTypeArgument<Name>>, ) => { return new Wrapper( [extractType(Name)], fields ) }, kind: "StructClassReified", } }
|
|
29
|
+
|
|
30
|
+
static get r() { return Wrapper.reified }
|
|
31
|
+
|
|
32
|
+
static phantom<Name extends Reified<TypeArgument, any>>( Name: Name ): PhantomReified<ToTypeStr<Wrapper<ToTypeArgument<Name>>>> { return phantom(Wrapper.reified( Name )); } static get p() { return Wrapper.phantom }
|
|
33
|
+
|
|
34
|
+
static get bcs() { return <Name extends BcsType<any>>(Name: Name) => bcs.struct(`Wrapper<${Name.name}>`, {
|
|
35
|
+
|
|
36
|
+
name: Name
|
|
37
|
+
|
|
38
|
+
}) };
|
|
39
|
+
|
|
40
|
+
static fromFields<Name extends Reified<TypeArgument, any>>( typeArg: Name, fields: Record<string, any> ): Wrapper<ToTypeArgument<Name>> { return Wrapper.reified( typeArg, ).new( { name: decodeFromFields(typeArg, fields.name) } ) }
|
|
41
|
+
|
|
42
|
+
static fromFieldsWithTypes<Name extends Reified<TypeArgument, any>>( typeArg: Name, item: FieldsWithTypes ): Wrapper<ToTypeArgument<Name>> { if (!isWrapper(item.type)) { throw new Error("not a Wrapper type");
|
|
43
|
+
|
|
44
|
+
} assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
45
|
+
|
|
46
|
+
return Wrapper.reified( typeArg, ).new( { name: decodeFromFieldsWithTypes(typeArg, item.fields.name) } ) }
|
|
47
|
+
|
|
48
|
+
static fromBcs<Name extends Reified<TypeArgument, any>>( typeArg: Name, data: Uint8Array ): Wrapper<ToTypeArgument<Name>> { const typeArgs = [typeArg];
|
|
49
|
+
|
|
50
|
+
return Wrapper.fromFields( typeArg, Wrapper.bcs( toBcs(typeArgs[0]) ).parse(data) ) }
|
|
51
|
+
|
|
52
|
+
toJSONField() { return {
|
|
53
|
+
|
|
54
|
+
name: fieldToJSON<Name>(this.$typeArgs[0], this.name),
|
|
55
|
+
|
|
56
|
+
} }
|
|
57
|
+
|
|
58
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
59
|
+
|
|
60
|
+
static fromJSONField<Name extends Reified<TypeArgument, any>>( typeArg: Name, field: any ): Wrapper<ToTypeArgument<Name>> { return Wrapper.reified( typeArg, ).new( { name: decodeFromJSONField(typeArg, field.name) } ) }
|
|
61
|
+
|
|
62
|
+
static fromJSON<Name extends Reified<TypeArgument, any>>( typeArg: Name, json: Record<string, any> ): Wrapper<ToTypeArgument<Name>> { if (json.$typeName !== Wrapper.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(Wrapper.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
|
|
63
|
+
|
|
64
|
+
return Wrapper.fromJSONField( typeArg, json, ) }
|
|
65
|
+
|
|
66
|
+
static fromSuiParsedData<Name extends Reified<TypeArgument, any>>( typeArg: Name, content: SuiParsedData ): Wrapper<ToTypeArgument<Name>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isWrapper(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Wrapper object`); } return Wrapper.fromFieldsWithTypes( typeArg, content ); }
|
|
67
|
+
|
|
68
|
+
static async fetch<Name extends Reified<TypeArgument, any>>( client: SuiClient, typeArg: Name, id: string ): Promise<Wrapper<ToTypeArgument<Name>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Wrapper object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isWrapper(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Wrapper object`); }
|
|
69
|
+
return Wrapper.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
|
|
70
|
+
|
|
71
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import * as reified from "../../../../_framework/reified";
|
|
2
|
+
import {PhantomReified, Reified, StructClass, ToField, ToTypeStr, Vector, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom} from "../../../../_framework/reified";
|
|
3
|
+
import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
|
|
4
|
+
import {bcs, fromB64} from "@mysten/bcs";
|
|
5
|
+
import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
|
|
6
|
+
|
|
7
|
+
/* ============================== Curve =============================== */
|
|
8
|
+
|
|
9
|
+
export function isCurve(type: string): boolean { type = compressSuiType(type); return type === "0x2::groth16::Curve"; }
|
|
10
|
+
|
|
11
|
+
export interface CurveFields { id: ToField<"u8"> }
|
|
12
|
+
|
|
13
|
+
export type CurveReified = Reified< Curve, CurveFields >;
|
|
14
|
+
|
|
15
|
+
export class Curve implements StructClass { static readonly $typeName = "0x2::groth16::Curve"; static readonly $numTypeParams = 0;
|
|
16
|
+
|
|
17
|
+
readonly $typeName = Curve.$typeName;
|
|
18
|
+
|
|
19
|
+
readonly $fullTypeName: "0x2::groth16::Curve";
|
|
20
|
+
|
|
21
|
+
readonly $typeArgs: [];
|
|
22
|
+
|
|
23
|
+
readonly id: ToField<"u8">
|
|
24
|
+
|
|
25
|
+
private constructor(typeArgs: [], fields: CurveFields, ) { this.$fullTypeName = composeSuiType( Curve.$typeName, ...typeArgs ) as "0x2::groth16::Curve"; this.$typeArgs = typeArgs;
|
|
26
|
+
|
|
27
|
+
this.id = fields.id; }
|
|
28
|
+
|
|
29
|
+
static reified( ): CurveReified { return { typeName: Curve.$typeName, fullTypeName: composeSuiType( Curve.$typeName, ...[] ) as "0x2::groth16::Curve", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => Curve.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Curve.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => Curve.fromBcs( data, ), bcs: Curve.bcs, fromJSONField: (field: any) => Curve.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => Curve.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => Curve.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => Curve.fetch( client, id, ), new: ( fields: CurveFields, ) => { return new Curve( [], fields ) }, kind: "StructClassReified", } }
|
|
30
|
+
|
|
31
|
+
static get r() { return Curve.reified() }
|
|
32
|
+
|
|
33
|
+
static phantom( ): PhantomReified<ToTypeStr<Curve>> { return phantom(Curve.reified( )); } static get p() { return Curve.phantom() }
|
|
34
|
+
|
|
35
|
+
static get bcs() { return bcs.struct("Curve", {
|
|
36
|
+
|
|
37
|
+
id: bcs.u8()
|
|
38
|
+
|
|
39
|
+
}) };
|
|
40
|
+
|
|
41
|
+
static fromFields( fields: Record<string, any> ): Curve { return Curve.reified( ).new( { id: decodeFromFields("u8", fields.id) } ) }
|
|
42
|
+
|
|
43
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): Curve { if (!isCurve(item.type)) { throw new Error("not a Curve type");
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return Curve.reified( ).new( { id: decodeFromFieldsWithTypes("u8", item.fields.id) } ) }
|
|
48
|
+
|
|
49
|
+
static fromBcs( data: Uint8Array ): Curve { return Curve.fromFields( Curve.bcs.parse(data) ) }
|
|
50
|
+
|
|
51
|
+
toJSONField() { return {
|
|
52
|
+
|
|
53
|
+
id: this.id,
|
|
54
|
+
|
|
55
|
+
} }
|
|
56
|
+
|
|
57
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
58
|
+
|
|
59
|
+
static fromJSONField( field: any ): Curve { return Curve.reified( ).new( { id: decodeFromJSONField("u8", field.id) } ) }
|
|
60
|
+
|
|
61
|
+
static fromJSON( json: Record<string, any> ): Curve { if (json.$typeName !== Curve.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
62
|
+
|
|
63
|
+
return Curve.fromJSONField( json, ) }
|
|
64
|
+
|
|
65
|
+
static fromSuiParsedData( content: SuiParsedData ): Curve { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isCurve(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Curve object`); } return Curve.fromFieldsWithTypes( content ); }
|
|
66
|
+
|
|
67
|
+
static async fetch( client: SuiClient, id: string ): Promise<Curve> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Curve object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isCurve(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Curve object`); }
|
|
68
|
+
return Curve.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ============================== PreparedVerifyingKey =============================== */
|
|
73
|
+
|
|
74
|
+
export function isPreparedVerifyingKey(type: string): boolean { type = compressSuiType(type); return type === "0x2::groth16::PreparedVerifyingKey"; }
|
|
75
|
+
|
|
76
|
+
export interface PreparedVerifyingKeyFields { vkGammaAbcG1Bytes: ToField<Vector<"u8">>; alphaG1BetaG2Bytes: ToField<Vector<"u8">>; gammaG2NegPcBytes: ToField<Vector<"u8">>; deltaG2NegPcBytes: ToField<Vector<"u8">> }
|
|
77
|
+
|
|
78
|
+
export type PreparedVerifyingKeyReified = Reified< PreparedVerifyingKey, PreparedVerifyingKeyFields >;
|
|
79
|
+
|
|
80
|
+
export class PreparedVerifyingKey implements StructClass { static readonly $typeName = "0x2::groth16::PreparedVerifyingKey"; static readonly $numTypeParams = 0;
|
|
81
|
+
|
|
82
|
+
readonly $typeName = PreparedVerifyingKey.$typeName;
|
|
83
|
+
|
|
84
|
+
readonly $fullTypeName: "0x2::groth16::PreparedVerifyingKey";
|
|
85
|
+
|
|
86
|
+
readonly $typeArgs: [];
|
|
87
|
+
|
|
88
|
+
readonly vkGammaAbcG1Bytes: ToField<Vector<"u8">>; readonly alphaG1BetaG2Bytes: ToField<Vector<"u8">>; readonly gammaG2NegPcBytes: ToField<Vector<"u8">>; readonly deltaG2NegPcBytes: ToField<Vector<"u8">>
|
|
89
|
+
|
|
90
|
+
private constructor(typeArgs: [], fields: PreparedVerifyingKeyFields, ) { this.$fullTypeName = composeSuiType( PreparedVerifyingKey.$typeName, ...typeArgs ) as "0x2::groth16::PreparedVerifyingKey"; this.$typeArgs = typeArgs;
|
|
91
|
+
|
|
92
|
+
this.vkGammaAbcG1Bytes = fields.vkGammaAbcG1Bytes;; this.alphaG1BetaG2Bytes = fields.alphaG1BetaG2Bytes;; this.gammaG2NegPcBytes = fields.gammaG2NegPcBytes;; this.deltaG2NegPcBytes = fields.deltaG2NegPcBytes; }
|
|
93
|
+
|
|
94
|
+
static reified( ): PreparedVerifyingKeyReified { return { typeName: PreparedVerifyingKey.$typeName, fullTypeName: composeSuiType( PreparedVerifyingKey.$typeName, ...[] ) as "0x2::groth16::PreparedVerifyingKey", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => PreparedVerifyingKey.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => PreparedVerifyingKey.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => PreparedVerifyingKey.fromBcs( data, ), bcs: PreparedVerifyingKey.bcs, fromJSONField: (field: any) => PreparedVerifyingKey.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => PreparedVerifyingKey.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => PreparedVerifyingKey.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => PreparedVerifyingKey.fetch( client, id, ), new: ( fields: PreparedVerifyingKeyFields, ) => { return new PreparedVerifyingKey( [], fields ) }, kind: "StructClassReified", } }
|
|
95
|
+
|
|
96
|
+
static get r() { return PreparedVerifyingKey.reified() }
|
|
97
|
+
|
|
98
|
+
static phantom( ): PhantomReified<ToTypeStr<PreparedVerifyingKey>> { return phantom(PreparedVerifyingKey.reified( )); } static get p() { return PreparedVerifyingKey.phantom() }
|
|
99
|
+
|
|
100
|
+
static get bcs() { return bcs.struct("PreparedVerifyingKey", {
|
|
101
|
+
|
|
102
|
+
vk_gamma_abc_g1_bytes: bcs.vector(bcs.u8()), alpha_g1_beta_g2_bytes: bcs.vector(bcs.u8()), gamma_g2_neg_pc_bytes: bcs.vector(bcs.u8()), delta_g2_neg_pc_bytes: bcs.vector(bcs.u8())
|
|
103
|
+
|
|
104
|
+
}) };
|
|
105
|
+
|
|
106
|
+
static fromFields( fields: Record<string, any> ): PreparedVerifyingKey { return PreparedVerifyingKey.reified( ).new( { vkGammaAbcG1Bytes: decodeFromFields(reified.vector("u8"), fields.vk_gamma_abc_g1_bytes), alphaG1BetaG2Bytes: decodeFromFields(reified.vector("u8"), fields.alpha_g1_beta_g2_bytes), gammaG2NegPcBytes: decodeFromFields(reified.vector("u8"), fields.gamma_g2_neg_pc_bytes), deltaG2NegPcBytes: decodeFromFields(reified.vector("u8"), fields.delta_g2_neg_pc_bytes) } ) }
|
|
107
|
+
|
|
108
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): PreparedVerifyingKey { if (!isPreparedVerifyingKey(item.type)) { throw new Error("not a PreparedVerifyingKey type");
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return PreparedVerifyingKey.reified( ).new( { vkGammaAbcG1Bytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.vk_gamma_abc_g1_bytes), alphaG1BetaG2Bytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.alpha_g1_beta_g2_bytes), gammaG2NegPcBytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.gamma_g2_neg_pc_bytes), deltaG2NegPcBytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.delta_g2_neg_pc_bytes) } ) }
|
|
113
|
+
|
|
114
|
+
static fromBcs( data: Uint8Array ): PreparedVerifyingKey { return PreparedVerifyingKey.fromFields( PreparedVerifyingKey.bcs.parse(data) ) }
|
|
115
|
+
|
|
116
|
+
toJSONField() { return {
|
|
117
|
+
|
|
118
|
+
vkGammaAbcG1Bytes: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.vkGammaAbcG1Bytes),alphaG1BetaG2Bytes: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.alphaG1BetaG2Bytes),gammaG2NegPcBytes: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.gammaG2NegPcBytes),deltaG2NegPcBytes: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.deltaG2NegPcBytes),
|
|
119
|
+
|
|
120
|
+
} }
|
|
121
|
+
|
|
122
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
123
|
+
|
|
124
|
+
static fromJSONField( field: any ): PreparedVerifyingKey { return PreparedVerifyingKey.reified( ).new( { vkGammaAbcG1Bytes: decodeFromJSONField(reified.vector("u8"), field.vkGammaAbcG1Bytes), alphaG1BetaG2Bytes: decodeFromJSONField(reified.vector("u8"), field.alphaG1BetaG2Bytes), gammaG2NegPcBytes: decodeFromJSONField(reified.vector("u8"), field.gammaG2NegPcBytes), deltaG2NegPcBytes: decodeFromJSONField(reified.vector("u8"), field.deltaG2NegPcBytes) } ) }
|
|
125
|
+
|
|
126
|
+
static fromJSON( json: Record<string, any> ): PreparedVerifyingKey { if (json.$typeName !== PreparedVerifyingKey.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
127
|
+
|
|
128
|
+
return PreparedVerifyingKey.fromJSONField( json, ) }
|
|
129
|
+
|
|
130
|
+
static fromSuiParsedData( content: SuiParsedData ): PreparedVerifyingKey { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isPreparedVerifyingKey(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a PreparedVerifyingKey object`); } return PreparedVerifyingKey.fromFieldsWithTypes( content ); }
|
|
131
|
+
|
|
132
|
+
static async fetch( client: SuiClient, id: string ): Promise<PreparedVerifyingKey> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching PreparedVerifyingKey object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isPreparedVerifyingKey(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a PreparedVerifyingKey object`); }
|
|
133
|
+
return PreparedVerifyingKey.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ============================== ProofPoints =============================== */
|
|
138
|
+
|
|
139
|
+
export function isProofPoints(type: string): boolean { type = compressSuiType(type); return type === "0x2::groth16::ProofPoints"; }
|
|
140
|
+
|
|
141
|
+
export interface ProofPointsFields { bytes: ToField<Vector<"u8">> }
|
|
142
|
+
|
|
143
|
+
export type ProofPointsReified = Reified< ProofPoints, ProofPointsFields >;
|
|
144
|
+
|
|
145
|
+
export class ProofPoints implements StructClass { static readonly $typeName = "0x2::groth16::ProofPoints"; static readonly $numTypeParams = 0;
|
|
146
|
+
|
|
147
|
+
readonly $typeName = ProofPoints.$typeName;
|
|
148
|
+
|
|
149
|
+
readonly $fullTypeName: "0x2::groth16::ProofPoints";
|
|
150
|
+
|
|
151
|
+
readonly $typeArgs: [];
|
|
152
|
+
|
|
153
|
+
readonly bytes: ToField<Vector<"u8">>
|
|
154
|
+
|
|
155
|
+
private constructor(typeArgs: [], fields: ProofPointsFields, ) { this.$fullTypeName = composeSuiType( ProofPoints.$typeName, ...typeArgs ) as "0x2::groth16::ProofPoints"; this.$typeArgs = typeArgs;
|
|
156
|
+
|
|
157
|
+
this.bytes = fields.bytes; }
|
|
158
|
+
|
|
159
|
+
static reified( ): ProofPointsReified { return { typeName: ProofPoints.$typeName, fullTypeName: composeSuiType( ProofPoints.$typeName, ...[] ) as "0x2::groth16::ProofPoints", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => ProofPoints.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => ProofPoints.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => ProofPoints.fromBcs( data, ), bcs: ProofPoints.bcs, fromJSONField: (field: any) => ProofPoints.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => ProofPoints.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => ProofPoints.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => ProofPoints.fetch( client, id, ), new: ( fields: ProofPointsFields, ) => { return new ProofPoints( [], fields ) }, kind: "StructClassReified", } }
|
|
160
|
+
|
|
161
|
+
static get r() { return ProofPoints.reified() }
|
|
162
|
+
|
|
163
|
+
static phantom( ): PhantomReified<ToTypeStr<ProofPoints>> { return phantom(ProofPoints.reified( )); } static get p() { return ProofPoints.phantom() }
|
|
164
|
+
|
|
165
|
+
static get bcs() { return bcs.struct("ProofPoints", {
|
|
166
|
+
|
|
167
|
+
bytes: bcs.vector(bcs.u8())
|
|
168
|
+
|
|
169
|
+
}) };
|
|
170
|
+
|
|
171
|
+
static fromFields( fields: Record<string, any> ): ProofPoints { return ProofPoints.reified( ).new( { bytes: decodeFromFields(reified.vector("u8"), fields.bytes) } ) }
|
|
172
|
+
|
|
173
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): ProofPoints { if (!isProofPoints(item.type)) { throw new Error("not a ProofPoints type");
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return ProofPoints.reified( ).new( { bytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.bytes) } ) }
|
|
178
|
+
|
|
179
|
+
static fromBcs( data: Uint8Array ): ProofPoints { return ProofPoints.fromFields( ProofPoints.bcs.parse(data) ) }
|
|
180
|
+
|
|
181
|
+
toJSONField() { return {
|
|
182
|
+
|
|
183
|
+
bytes: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.bytes),
|
|
184
|
+
|
|
185
|
+
} }
|
|
186
|
+
|
|
187
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
188
|
+
|
|
189
|
+
static fromJSONField( field: any ): ProofPoints { return ProofPoints.reified( ).new( { bytes: decodeFromJSONField(reified.vector("u8"), field.bytes) } ) }
|
|
190
|
+
|
|
191
|
+
static fromJSON( json: Record<string, any> ): ProofPoints { if (json.$typeName !== ProofPoints.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
192
|
+
|
|
193
|
+
return ProofPoints.fromJSONField( json, ) }
|
|
194
|
+
|
|
195
|
+
static fromSuiParsedData( content: SuiParsedData ): ProofPoints { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isProofPoints(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a ProofPoints object`); } return ProofPoints.fromFieldsWithTypes( content ); }
|
|
196
|
+
|
|
197
|
+
static async fetch( client: SuiClient, id: string ): Promise<ProofPoints> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching ProofPoints object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isProofPoints(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a ProofPoints object`); }
|
|
198
|
+
return ProofPoints.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* ============================== PublicProofInputs =============================== */
|
|
203
|
+
|
|
204
|
+
export function isPublicProofInputs(type: string): boolean { type = compressSuiType(type); return type === "0x2::groth16::PublicProofInputs"; }
|
|
205
|
+
|
|
206
|
+
export interface PublicProofInputsFields { bytes: ToField<Vector<"u8">> }
|
|
207
|
+
|
|
208
|
+
export type PublicProofInputsReified = Reified< PublicProofInputs, PublicProofInputsFields >;
|
|
209
|
+
|
|
210
|
+
export class PublicProofInputs implements StructClass { static readonly $typeName = "0x2::groth16::PublicProofInputs"; static readonly $numTypeParams = 0;
|
|
211
|
+
|
|
212
|
+
readonly $typeName = PublicProofInputs.$typeName;
|
|
213
|
+
|
|
214
|
+
readonly $fullTypeName: "0x2::groth16::PublicProofInputs";
|
|
215
|
+
|
|
216
|
+
readonly $typeArgs: [];
|
|
217
|
+
|
|
218
|
+
readonly bytes: ToField<Vector<"u8">>
|
|
219
|
+
|
|
220
|
+
private constructor(typeArgs: [], fields: PublicProofInputsFields, ) { this.$fullTypeName = composeSuiType( PublicProofInputs.$typeName, ...typeArgs ) as "0x2::groth16::PublicProofInputs"; this.$typeArgs = typeArgs;
|
|
221
|
+
|
|
222
|
+
this.bytes = fields.bytes; }
|
|
223
|
+
|
|
224
|
+
static reified( ): PublicProofInputsReified { return { typeName: PublicProofInputs.$typeName, fullTypeName: composeSuiType( PublicProofInputs.$typeName, ...[] ) as "0x2::groth16::PublicProofInputs", typeArgs: [ ] as [], reifiedTypeArgs: [], fromFields: (fields: Record<string, any>) => PublicProofInputs.fromFields( fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => PublicProofInputs.fromFieldsWithTypes( item, ), fromBcs: (data: Uint8Array) => PublicProofInputs.fromBcs( data, ), bcs: PublicProofInputs.bcs, fromJSONField: (field: any) => PublicProofInputs.fromJSONField( field, ), fromJSON: (json: Record<string, any>) => PublicProofInputs.fromJSON( json, ), fromSuiParsedData: (content: SuiParsedData) => PublicProofInputs.fromSuiParsedData( content, ), fetch: async (client: SuiClient, id: string) => PublicProofInputs.fetch( client, id, ), new: ( fields: PublicProofInputsFields, ) => { return new PublicProofInputs( [], fields ) }, kind: "StructClassReified", } }
|
|
225
|
+
|
|
226
|
+
static get r() { return PublicProofInputs.reified() }
|
|
227
|
+
|
|
228
|
+
static phantom( ): PhantomReified<ToTypeStr<PublicProofInputs>> { return phantom(PublicProofInputs.reified( )); } static get p() { return PublicProofInputs.phantom() }
|
|
229
|
+
|
|
230
|
+
static get bcs() { return bcs.struct("PublicProofInputs", {
|
|
231
|
+
|
|
232
|
+
bytes: bcs.vector(bcs.u8())
|
|
233
|
+
|
|
234
|
+
}) };
|
|
235
|
+
|
|
236
|
+
static fromFields( fields: Record<string, any> ): PublicProofInputs { return PublicProofInputs.reified( ).new( { bytes: decodeFromFields(reified.vector("u8"), fields.bytes) } ) }
|
|
237
|
+
|
|
238
|
+
static fromFieldsWithTypes( item: FieldsWithTypes ): PublicProofInputs { if (!isPublicProofInputs(item.type)) { throw new Error("not a PublicProofInputs type");
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return PublicProofInputs.reified( ).new( { bytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.bytes) } ) }
|
|
243
|
+
|
|
244
|
+
static fromBcs( data: Uint8Array ): PublicProofInputs { return PublicProofInputs.fromFields( PublicProofInputs.bcs.parse(data) ) }
|
|
245
|
+
|
|
246
|
+
toJSONField() { return {
|
|
247
|
+
|
|
248
|
+
bytes: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.bytes),
|
|
249
|
+
|
|
250
|
+
} }
|
|
251
|
+
|
|
252
|
+
toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
|
|
253
|
+
|
|
254
|
+
static fromJSONField( field: any ): PublicProofInputs { return PublicProofInputs.reified( ).new( { bytes: decodeFromJSONField(reified.vector("u8"), field.bytes) } ) }
|
|
255
|
+
|
|
256
|
+
static fromJSON( json: Record<string, any> ): PublicProofInputs { if (json.$typeName !== PublicProofInputs.$typeName) { throw new Error("not a WithTwoGenerics json object") };
|
|
257
|
+
|
|
258
|
+
return PublicProofInputs.fromJSONField( json, ) }
|
|
259
|
+
|
|
260
|
+
static fromSuiParsedData( content: SuiParsedData ): PublicProofInputs { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isPublicProofInputs(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a PublicProofInputs object`); } return PublicProofInputs.fromFieldsWithTypes( content ); }
|
|
261
|
+
|
|
262
|
+
static async fetch( client: SuiClient, id: string ): Promise<PublicProofInputs> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching PublicProofInputs object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isPublicProofInputs(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a PublicProofInputs object`); }
|
|
263
|
+
return PublicProofInputs.fromBcs( fromB64(res.data.bcs.bcsBytes) ); }
|
|
264
|
+
|
|
265
|
+
}
|