@polymeshassociation/polymesh-sdk 23.0.0-alpha.2 → 23.0.0-alpha.20

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.
Files changed (467) hide show
  1. package/CHANGELOG.md +9 -2
  2. package/api/client/Assets.d.ts +23 -8
  3. package/api/client/Assets.d.ts.map +1 -1
  4. package/api/client/Assets.js +44 -10
  5. package/api/client/Assets.js.map +1 -1
  6. package/api/client/Claims.d.ts +21 -1
  7. package/api/client/Claims.d.ts.map +1 -1
  8. package/api/client/Claims.js +50 -5
  9. package/api/client/Claims.js.map +1 -1
  10. package/api/client/Network.d.ts.map +1 -1
  11. package/api/client/Network.js +2 -1
  12. package/api/client/Network.js.map +1 -1
  13. package/api/entities/Account/MultiSig/index.d.ts.map +1 -1
  14. package/api/entities/Account/MultiSig/index.js +2 -5
  15. package/api/entities/Account/MultiSig/index.js.map +1 -1
  16. package/api/entities/Account/helpers.d.ts +3 -2
  17. package/api/entities/Account/helpers.d.ts.map +1 -1
  18. package/api/entities/Account/helpers.js.map +1 -1
  19. package/api/entities/Account/index.d.ts.map +1 -1
  20. package/api/entities/Account/index.js +19 -15
  21. package/api/entities/Account/index.js.map +1 -1
  22. package/api/entities/Asset/Base/BaseAsset.d.ts +82 -0
  23. package/api/entities/Asset/Base/BaseAsset.d.ts.map +1 -0
  24. package/api/entities/Asset/Base/BaseAsset.js +174 -0
  25. package/api/entities/Asset/Base/BaseAsset.js.map +1 -0
  26. package/api/entities/Asset/{Compliance → Base/Compliance}/Requirements.d.ts +10 -10
  27. package/api/entities/Asset/Base/Compliance/Requirements.d.ts.map +1 -0
  28. package/api/entities/Asset/{Compliance → Base/Compliance}/Requirements.js +3 -3
  29. package/api/entities/Asset/Base/Compliance/Requirements.js.map +1 -0
  30. package/api/entities/Asset/{Compliance → Base/Compliance}/TrustedClaimIssuers.d.ts +7 -7
  31. package/api/entities/Asset/Base/Compliance/TrustedClaimIssuers.d.ts.map +1 -0
  32. package/api/entities/Asset/{Compliance → Base/Compliance}/TrustedClaimIssuers.js +4 -4
  33. package/api/entities/Asset/Base/Compliance/TrustedClaimIssuers.js.map +1 -0
  34. package/api/entities/Asset/{Compliance → Base/Compliance}/index.d.ts +3 -3
  35. package/api/entities/Asset/Base/Compliance/index.d.ts.map +1 -0
  36. package/api/entities/Asset/{Compliance → Base/Compliance}/index.js +1 -1
  37. package/api/entities/Asset/Base/Compliance/index.js.map +1 -0
  38. package/api/entities/Asset/{Documents.d.ts → Base/Documents/index.d.ts} +7 -8
  39. package/api/entities/Asset/Base/Documents/index.d.ts.map +1 -0
  40. package/api/entities/Asset/{Documents.js → Base/Documents/index.js} +4 -4
  41. package/api/entities/Asset/Base/Documents/index.js.map +1 -0
  42. package/api/entities/Asset/{Metadata.d.ts → Base/Metadata/index.d.ts} +11 -5
  43. package/api/entities/Asset/Base/Metadata/index.d.ts.map +1 -0
  44. package/api/entities/Asset/{Metadata.js → Base/Metadata/index.js} +17 -5
  45. package/api/entities/Asset/Base/Metadata/index.js.map +1 -0
  46. package/api/entities/Asset/{Permissions.d.ts → Base/Permissions/index.d.ts} +5 -5
  47. package/api/entities/Asset/Base/Permissions/index.d.ts.map +1 -0
  48. package/api/entities/Asset/{Permissions.js → Base/Permissions/index.js} +5 -5
  49. package/api/entities/Asset/Base/Permissions/index.js.map +1 -0
  50. package/api/entities/Asset/Base/Settlements/index.d.ts +85 -0
  51. package/api/entities/Asset/Base/Settlements/index.d.ts.map +1 -0
  52. package/api/entities/Asset/Base/Settlements/index.js +141 -0
  53. package/api/entities/Asset/Base/Settlements/index.js.map +1 -0
  54. package/api/entities/Asset/Base/index.d.ts +2 -0
  55. package/api/entities/Asset/Base/index.d.ts.map +1 -0
  56. package/api/entities/Asset/Base/index.js +18 -0
  57. package/api/entities/Asset/Base/index.js.map +1 -0
  58. package/api/entities/Asset/{AssetHolders.d.ts → Fungible/AssetHolders/index.d.ts} +4 -4
  59. package/api/entities/Asset/Fungible/AssetHolders/index.d.ts.map +1 -0
  60. package/api/entities/Asset/{AssetHolders.js → Fungible/AssetHolders/index.js} +4 -4
  61. package/api/entities/Asset/Fungible/AssetHolders/index.js.map +1 -0
  62. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/Schedules.d.ts +4 -4
  63. package/api/entities/Asset/Fungible/Checkpoints/Schedules.d.ts.map +1 -0
  64. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/Schedules.js +4 -4
  65. package/api/entities/Asset/Fungible/Checkpoints/Schedules.js.map +1 -0
  66. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/index.d.ts +4 -4
  67. package/api/entities/Asset/Fungible/Checkpoints/index.d.ts.map +1 -0
  68. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/index.js +5 -5
  69. package/api/entities/Asset/Fungible/Checkpoints/index.js.map +1 -0
  70. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/types.d.ts +1 -1
  71. package/api/entities/Asset/Fungible/Checkpoints/types.d.ts.map +1 -0
  72. package/api/entities/Asset/Fungible/Checkpoints/types.js.map +1 -0
  73. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/Distributions.d.ts +4 -4
  74. package/api/entities/Asset/Fungible/CorporateActions/Distributions.d.ts.map +1 -0
  75. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/Distributions.js +4 -4
  76. package/api/entities/Asset/Fungible/CorporateActions/Distributions.js.map +1 -0
  77. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/index.d.ts +4 -4
  78. package/api/entities/Asset/Fungible/CorporateActions/index.d.ts.map +1 -0
  79. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/index.js +3 -3
  80. package/api/entities/Asset/Fungible/CorporateActions/index.js.map +1 -0
  81. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/types.d.ts +1 -1
  82. package/api/entities/Asset/Fungible/CorporateActions/types.d.ts.map +1 -0
  83. package/api/entities/Asset/Fungible/CorporateActions/types.js.map +1 -0
  84. package/api/entities/Asset/{Issuance.d.ts → Fungible/Issuance/index.d.ts} +6 -6
  85. package/api/entities/Asset/Fungible/Issuance/index.d.ts.map +1 -0
  86. package/api/entities/Asset/{Issuance.js → Fungible/Issuance/index.js} +3 -3
  87. package/api/entities/Asset/Fungible/Issuance/index.js.map +1 -0
  88. package/api/entities/Asset/{Offerings.d.ts → Fungible/Offerings/index.d.ts} +5 -5
  89. package/api/entities/Asset/Fungible/Offerings/index.d.ts.map +1 -0
  90. package/api/entities/Asset/{Offerings.js → Fungible/Offerings/index.js} +5 -5
  91. package/api/entities/Asset/Fungible/Offerings/index.js.map +1 -0
  92. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimCount.d.ts +2 -2
  93. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.d.ts.map +1 -0
  94. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimCount.js +2 -2
  95. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.js.map +1 -0
  96. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimPercentage.d.ts +2 -2
  97. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.d.ts.map +1 -0
  98. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimPercentage.js +2 -2
  99. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.js.map +1 -0
  100. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Count.d.ts +5 -5
  101. package/api/entities/Asset/Fungible/TransferRestrictions/Count.d.ts.map +1 -0
  102. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Count.js +2 -2
  103. package/api/entities/Asset/Fungible/TransferRestrictions/Count.js.map +1 -0
  104. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Percentage.d.ts +2 -2
  105. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.d.ts.map +1 -0
  106. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Percentage.js +2 -2
  107. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.js.map +1 -0
  108. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/TransferRestrictionBase.d.ts +4 -4
  109. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.d.ts.map +1 -0
  110. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/TransferRestrictionBase.js +4 -4
  111. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.js.map +1 -0
  112. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/index.d.ts +3 -3
  113. package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts.map +1 -0
  114. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/index.js +1 -1
  115. package/api/entities/Asset/Fungible/TransferRestrictions/index.js.map +1 -0
  116. package/api/entities/Asset/Fungible/index.d.ts +88 -0
  117. package/api/entities/Asset/Fungible/index.d.ts.map +1 -0
  118. package/api/entities/Asset/Fungible/index.js +159 -0
  119. package/api/entities/Asset/Fungible/index.js.map +1 -0
  120. package/api/entities/Asset/NonFungible/Nft.d.ts +46 -0
  121. package/api/entities/Asset/NonFungible/Nft.d.ts.map +1 -0
  122. package/api/entities/Asset/NonFungible/Nft.js +88 -0
  123. package/api/entities/Asset/NonFungible/Nft.js.map +1 -0
  124. package/api/entities/Asset/NonFungible/NftCollection.d.ts +62 -0
  125. package/api/entities/Asset/NonFungible/NftCollection.d.ts.map +1 -0
  126. package/api/entities/Asset/NonFungible/NftCollection.js +159 -0
  127. package/api/entities/Asset/NonFungible/NftCollection.js.map +1 -0
  128. package/api/entities/Asset/NonFungible/index.d.ts +3 -0
  129. package/api/entities/Asset/NonFungible/index.d.ts.map +1 -0
  130. package/api/entities/Asset/NonFungible/index.js +19 -0
  131. package/api/entities/Asset/NonFungible/index.js.map +1 -0
  132. package/api/entities/Asset/index.d.ts +4 -158
  133. package/api/entities/Asset/index.d.ts.map +1 -1
  134. package/api/entities/Asset/index.js +17 -270
  135. package/api/entities/Asset/index.js.map +1 -1
  136. package/api/entities/Asset/types.d.ts +42 -5
  137. package/api/entities/Asset/types.d.ts.map +1 -1
  138. package/api/entities/Asset/types.js +2 -2
  139. package/api/entities/Asset/types.js.map +1 -1
  140. package/api/entities/Checkpoint.d.ts +2 -2
  141. package/api/entities/Checkpoint.d.ts.map +1 -1
  142. package/api/entities/Checkpoint.js +1 -1
  143. package/api/entities/Checkpoint.js.map +1 -1
  144. package/api/entities/CheckpointSchedule/index.d.ts +2 -2
  145. package/api/entities/CheckpointSchedule/index.d.ts.map +1 -1
  146. package/api/entities/CheckpointSchedule/index.js +1 -1
  147. package/api/entities/CheckpointSchedule/index.js.map +1 -1
  148. package/api/entities/CorporateActionBase/index.d.ts +2 -2
  149. package/api/entities/CorporateActionBase/index.d.ts.map +1 -1
  150. package/api/entities/CorporateActionBase/index.js +1 -1
  151. package/api/entities/CorporateActionBase/index.js.map +1 -1
  152. package/api/entities/DefaultTrustedClaimIssuer.d.ts +2 -2
  153. package/api/entities/DefaultTrustedClaimIssuer.d.ts.map +1 -1
  154. package/api/entities/DefaultTrustedClaimIssuer.js +1 -1
  155. package/api/entities/DefaultTrustedClaimIssuer.js.map +1 -1
  156. package/api/entities/Identity/AssetPermissions.d.ts +6 -6
  157. package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
  158. package/api/entities/Identity/AssetPermissions.js +2 -2
  159. package/api/entities/Identity/AssetPermissions.js.map +1 -1
  160. package/api/entities/Identity/index.d.ts +7 -3
  161. package/api/entities/Identity/index.d.ts.map +1 -1
  162. package/api/entities/Identity/index.js +12 -2
  163. package/api/entities/Identity/index.js.map +1 -1
  164. package/api/entities/Instruction/index.d.ts.map +1 -1
  165. package/api/entities/Instruction/index.js +11 -2
  166. package/api/entities/Instruction/index.js.map +1 -1
  167. package/api/entities/Instruction/types.d.ts +11 -4
  168. package/api/entities/Instruction/types.d.ts.map +1 -1
  169. package/api/entities/Instruction/types.js.map +1 -1
  170. package/api/entities/MetadataEntry/index.d.ts +2 -2
  171. package/api/entities/MetadataEntry/index.d.ts.map +1 -1
  172. package/api/entities/MetadataEntry/index.js +1 -1
  173. package/api/entities/MetadataEntry/index.js.map +1 -1
  174. package/api/entities/MultiSigProposal/index.d.ts +5 -1
  175. package/api/entities/MultiSigProposal/index.d.ts.map +1 -1
  176. package/api/entities/MultiSigProposal/index.js +24 -10
  177. package/api/entities/MultiSigProposal/index.js.map +1 -1
  178. package/api/entities/MultiSigProposal/types.d.ts +2 -2
  179. package/api/entities/MultiSigProposal/types.d.ts.map +1 -1
  180. package/api/entities/Offering/index.d.ts +2 -2
  181. package/api/entities/Offering/index.d.ts.map +1 -1
  182. package/api/entities/Offering/index.js +1 -1
  183. package/api/entities/Offering/index.js.map +1 -1
  184. package/api/entities/PermissionGroup.d.ts +2 -2
  185. package/api/entities/PermissionGroup.d.ts.map +1 -1
  186. package/api/entities/PermissionGroup.js +1 -1
  187. package/api/entities/PermissionGroup.js.map +1 -1
  188. package/api/entities/Portfolio/index.d.ts +13 -5
  189. package/api/entities/Portfolio/index.d.ts.map +1 -1
  190. package/api/entities/Portfolio/index.js +65 -6
  191. package/api/entities/Portfolio/index.js.map +1 -1
  192. package/api/entities/Portfolio/types.d.ts +20 -5
  193. package/api/entities/Portfolio/types.d.ts.map +1 -1
  194. package/api/entities/TickerReservation/index.d.ts +2 -2
  195. package/api/entities/TickerReservation/index.d.ts.map +1 -1
  196. package/api/entities/types.d.ts +5 -2
  197. package/api/entities/types.d.ts.map +1 -1
  198. package/api/entities/types.js.map +1 -1
  199. package/api/procedures/addAssetRequirement.d.ts +4 -4
  200. package/api/procedures/addAssetRequirement.d.ts.map +1 -1
  201. package/api/procedures/addAssetRequirement.js +3 -3
  202. package/api/procedures/addAssetRequirement.js.map +1 -1
  203. package/api/procedures/addAssetStat.d.ts.map +1 -1
  204. package/api/procedures/addAssetStat.js +1 -1
  205. package/api/procedures/addAssetStat.js.map +1 -1
  206. package/api/procedures/addInstruction.d.ts.map +1 -1
  207. package/api/procedures/addInstruction.js +61 -17
  208. package/api/procedures/addInstruction.js.map +1 -1
  209. package/api/procedures/addTransferRestriction.d.ts.map +1 -1
  210. package/api/procedures/addTransferRestriction.js +1 -1
  211. package/api/procedures/addTransferRestriction.js.map +1 -1
  212. package/api/procedures/closeOffering.d.ts.map +1 -1
  213. package/api/procedures/closeOffering.js +1 -1
  214. package/api/procedures/closeOffering.js.map +1 -1
  215. package/api/procedures/configureDividendDistribution.d.ts.map +1 -1
  216. package/api/procedures/configureDividendDistribution.js +1 -1
  217. package/api/procedures/configureDividendDistribution.js.map +1 -1
  218. package/api/procedures/controllerTransfer.d.ts.map +1 -1
  219. package/api/procedures/controllerTransfer.js +2 -2
  220. package/api/procedures/controllerTransfer.js.map +1 -1
  221. package/api/procedures/createAsset.d.ts +5 -5
  222. package/api/procedures/createAsset.d.ts.map +1 -1
  223. package/api/procedures/createAsset.js +4 -20
  224. package/api/procedures/createAsset.js.map +1 -1
  225. package/api/procedures/createCheckpoint.d.ts.map +1 -1
  226. package/api/procedures/createCheckpoint.js +1 -1
  227. package/api/procedures/createCheckpoint.js.map +1 -1
  228. package/api/procedures/createCheckpointSchedule.d.ts.map +1 -1
  229. package/api/procedures/createCheckpointSchedule.js +1 -1
  230. package/api/procedures/createCheckpointSchedule.js.map +1 -1
  231. package/api/procedures/createGroup.d.ts +2 -2
  232. package/api/procedures/createGroup.d.ts.map +1 -1
  233. package/api/procedures/createGroup.js +1 -1
  234. package/api/procedures/createGroup.js.map +1 -1
  235. package/api/procedures/createNftCollection.d.ts +41 -0
  236. package/api/procedures/createNftCollection.d.ts.map +1 -0
  237. package/api/procedures/createNftCollection.js +248 -0
  238. package/api/procedures/createNftCollection.js.map +1 -0
  239. package/api/procedures/createTransactionBatch.d.ts.map +1 -1
  240. package/api/procedures/createTransactionBatch.js +1 -1
  241. package/api/procedures/createTransactionBatch.js.map +1 -1
  242. package/api/procedures/inviteExternalAgent.d.ts +2 -2
  243. package/api/procedures/inviteExternalAgent.d.ts.map +1 -1
  244. package/api/procedures/inviteExternalAgent.js +1 -1
  245. package/api/procedures/inviteExternalAgent.js.map +1 -1
  246. package/api/procedures/issueNft.d.ts +35 -0
  247. package/api/procedures/issueNft.d.ts.map +1 -0
  248. package/api/procedures/issueNft.js +98 -0
  249. package/api/procedures/issueNft.js.map +1 -0
  250. package/api/procedures/issueTokens.d.ts +6 -6
  251. package/api/procedures/issueTokens.d.ts.map +1 -1
  252. package/api/procedures/issueTokens.js +1 -1
  253. package/api/procedures/issueTokens.js.map +1 -1
  254. package/api/procedures/launchOffering.d.ts.map +1 -1
  255. package/api/procedures/launchOffering.js +1 -1
  256. package/api/procedures/launchOffering.js.map +1 -1
  257. package/api/procedures/linkCaDocs.d.ts.map +1 -1
  258. package/api/procedures/linkCaDocs.js +1 -1
  259. package/api/procedures/linkCaDocs.js.map +1 -1
  260. package/api/procedures/modifyAsset.d.ts +4 -4
  261. package/api/procedures/modifyAsset.d.ts.map +1 -1
  262. package/api/procedures/modifyAsset.js +2 -2
  263. package/api/procedures/modifyAsset.js.map +1 -1
  264. package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts +4 -4
  265. package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts.map +1 -1
  266. package/api/procedures/modifyAssetTrustedClaimIssuers.js +2 -2
  267. package/api/procedures/modifyAssetTrustedClaimIssuers.js.map +1 -1
  268. package/api/procedures/modifyCaCheckpoint.d.ts.map +1 -1
  269. package/api/procedures/modifyCaCheckpoint.js +1 -1
  270. package/api/procedures/modifyCaCheckpoint.js.map +1 -1
  271. package/api/procedures/modifyCaDefaultConfig.d.ts.map +1 -1
  272. package/api/procedures/modifyCaDefaultConfig.js +2 -2
  273. package/api/procedures/modifyCaDefaultConfig.js.map +1 -1
  274. package/api/procedures/modifyComplianceRequirement.d.ts.map +1 -1
  275. package/api/procedures/modifyComplianceRequirement.js +2 -2
  276. package/api/procedures/modifyComplianceRequirement.js.map +1 -1
  277. package/api/procedures/modifyCorporateActionsAgent.d.ts.map +1 -1
  278. package/api/procedures/modifyCorporateActionsAgent.js +2 -2
  279. package/api/procedures/modifyCorporateActionsAgent.js.map +1 -1
  280. package/api/procedures/modifyOfferingTimes.d.ts.map +1 -1
  281. package/api/procedures/modifyOfferingTimes.js +1 -1
  282. package/api/procedures/modifyOfferingTimes.js.map +1 -1
  283. package/api/procedures/moveFunds.d.ts.map +1 -1
  284. package/api/procedures/moveFunds.js +67 -16
  285. package/api/procedures/moveFunds.js.map +1 -1
  286. package/api/procedures/reclaimDividendDistributionFunds.d.ts.map +1 -1
  287. package/api/procedures/reclaimDividendDistributionFunds.js +1 -1
  288. package/api/procedures/reclaimDividendDistributionFunds.js.map +1 -1
  289. package/api/procedures/redeemNft.d.ts +31 -0
  290. package/api/procedures/redeemNft.d.ts.map +1 -0
  291. package/api/procedures/redeemNft.js +87 -0
  292. package/api/procedures/redeemNft.js.map +1 -0
  293. package/api/procedures/redeemTokens.d.ts.map +1 -1
  294. package/api/procedures/redeemTokens.js +2 -2
  295. package/api/procedures/redeemTokens.js.map +1 -1
  296. package/api/procedures/registerCustomClaimType.d.ts +22 -0
  297. package/api/procedures/registerCustomClaimType.d.ts.map +1 -0
  298. package/api/procedures/registerCustomClaimType.js +69 -0
  299. package/api/procedures/registerCustomClaimType.js.map +1 -0
  300. package/api/procedures/registerMetadata.d.ts.map +1 -1
  301. package/api/procedures/registerMetadata.js +1 -1
  302. package/api/procedures/registerMetadata.js.map +1 -1
  303. package/api/procedures/removeAssetRequirement.d.ts +4 -4
  304. package/api/procedures/removeAssetRequirement.d.ts.map +1 -1
  305. package/api/procedures/removeAssetRequirement.js +2 -2
  306. package/api/procedures/removeAssetRequirement.js.map +1 -1
  307. package/api/procedures/removeAssetStat.d.ts.map +1 -1
  308. package/api/procedures/removeAssetStat.js +1 -1
  309. package/api/procedures/removeAssetStat.js.map +1 -1
  310. package/api/procedures/removeCheckpointSchedule.d.ts.map +1 -1
  311. package/api/procedures/removeCheckpointSchedule.js +1 -1
  312. package/api/procedures/removeCheckpointSchedule.js.map +1 -1
  313. package/api/procedures/removeCorporateAction.js +1 -1
  314. package/api/procedures/removeCorporateAction.js.map +1 -1
  315. package/api/procedures/removeExternalAgent.d.ts +2 -2
  316. package/api/procedures/removeExternalAgent.d.ts.map +1 -1
  317. package/api/procedures/removeExternalAgent.js +1 -1
  318. package/api/procedures/removeExternalAgent.js.map +1 -1
  319. package/api/procedures/setAssetDocuments.d.ts +5 -5
  320. package/api/procedures/setAssetDocuments.d.ts.map +1 -1
  321. package/api/procedures/setAssetDocuments.js +2 -2
  322. package/api/procedures/setAssetDocuments.js.map +1 -1
  323. package/api/procedures/setAssetRequirements.d.ts +4 -4
  324. package/api/procedures/setAssetRequirements.d.ts.map +1 -1
  325. package/api/procedures/setAssetRequirements.js +4 -4
  326. package/api/procedures/setAssetRequirements.js.map +1 -1
  327. package/api/procedures/setMetadata.d.ts.map +1 -1
  328. package/api/procedures/setMetadata.js +1 -1
  329. package/api/procedures/setMetadata.js.map +1 -1
  330. package/api/procedures/setPermissionGroup.d.ts +2 -2
  331. package/api/procedures/setPermissionGroup.d.ts.map +1 -1
  332. package/api/procedures/setPermissionGroup.js +1 -1
  333. package/api/procedures/setPermissionGroup.js.map +1 -1
  334. package/api/procedures/setTransferRestrictions.d.ts +1 -1
  335. package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
  336. package/api/procedures/setTransferRestrictions.js +2 -2
  337. package/api/procedures/setTransferRestrictions.js.map +1 -1
  338. package/api/procedures/setVenueFiltering.d.ts.map +1 -1
  339. package/api/procedures/setVenueFiltering.js +1 -1
  340. package/api/procedures/setVenueFiltering.js.map +1 -1
  341. package/api/procedures/toggleFreezeOffering.d.ts.map +1 -1
  342. package/api/procedures/toggleFreezeOffering.js +1 -1
  343. package/api/procedures/toggleFreezeOffering.js.map +1 -1
  344. package/api/procedures/toggleFreezeTransfers.d.ts +4 -4
  345. package/api/procedures/toggleFreezeTransfers.d.ts.map +1 -1
  346. package/api/procedures/toggleFreezeTransfers.js +4 -4
  347. package/api/procedures/toggleFreezeTransfers.js.map +1 -1
  348. package/api/procedures/togglePauseRequirements.d.ts +4 -4
  349. package/api/procedures/togglePauseRequirements.d.ts.map +1 -1
  350. package/api/procedures/togglePauseRequirements.js +2 -2
  351. package/api/procedures/togglePauseRequirements.js.map +1 -1
  352. package/api/procedures/transferAssetOwnership.d.ts.map +1 -1
  353. package/api/procedures/transferAssetOwnership.js +1 -1
  354. package/api/procedures/transferAssetOwnership.js.map +1 -1
  355. package/api/procedures/types.d.ts +79 -13
  356. package/api/procedures/types.d.ts.map +1 -1
  357. package/api/procedures/types.js.map +1 -1
  358. package/api/procedures/utils.d.ts +10 -4
  359. package/api/procedures/utils.d.ts.map +1 -1
  360. package/api/procedures/utils.js +19 -2
  361. package/api/procedures/utils.js.map +1 -1
  362. package/api/procedures/waivePermissions.d.ts +2 -2
  363. package/api/procedures/waivePermissions.d.ts.map +1 -1
  364. package/api/procedures/waivePermissions.js +1 -1
  365. package/api/procedures/waivePermissions.js.map +1 -1
  366. package/base/Context.d.ts +2 -2
  367. package/base/Context.d.ts.map +1 -1
  368. package/base/PolymeshTransactionBatch.js +2 -2
  369. package/base/PolymeshTransactionBatch.js.map +1 -1
  370. package/base/Procedure.js.map +1 -1
  371. package/generated/types.d.ts +5 -1
  372. package/generated/types.d.ts.map +1 -1
  373. package/generated/types.js +4 -0
  374. package/generated/types.js.map +1 -1
  375. package/internal.d.ts +5 -2
  376. package/internal.d.ts.map +1 -1
  377. package/internal.js +14 -5
  378. package/internal.js.map +1 -1
  379. package/middleware/queries.d.ts.map +1 -1
  380. package/middleware/queries.js +1 -0
  381. package/middleware/queries.js.map +1 -1
  382. package/npm-package/polymeshassociation-polymesh-sdk-23.0.0-alpha.20.tgz +0 -0
  383. package/package.json +1 -1
  384. package/polkadot/augment-api-errors.d.ts +4 -18
  385. package/polkadot/augment-api-errors.d.ts.map +1 -1
  386. package/polkadot/augment-api-events.d.ts +0 -6
  387. package/polkadot/augment-api-events.d.ts.map +1 -1
  388. package/polkadot/augment-api-query.d.ts +33 -26
  389. package/polkadot/augment-api-query.d.ts.map +1 -1
  390. package/polkadot/augment-api-tx.d.ts +123 -51
  391. package/polkadot/augment-api-tx.d.ts.map +1 -1
  392. package/polkadot/lookup.d.ts +246 -248
  393. package/polkadot/lookup.d.ts.map +1 -1
  394. package/polkadot/lookup.js +248 -253
  395. package/polkadot/lookup.js.map +1 -1
  396. package/polkadot/registry.d.ts +3 -5
  397. package/polkadot/registry.d.ts.map +1 -1
  398. package/polkadot/types-lookup.d.ts +251 -248
  399. package/polkadot/types-lookup.d.ts.map +1 -1
  400. package/types/index.d.ts +39 -8
  401. package/types/index.d.ts.map +1 -1
  402. package/types/index.js +13 -1
  403. package/types/index.js.map +1 -1
  404. package/types/internal.d.ts +6 -1
  405. package/types/internal.d.ts.map +1 -1
  406. package/types/internal.js.map +1 -1
  407. package/utils/conversion.d.ts +73 -15
  408. package/utils/conversion.d.ts.map +1 -1
  409. package/utils/conversion.js +169 -25
  410. package/utils/conversion.js.map +1 -1
  411. package/utils/internal.d.ts +54 -6
  412. package/utils/internal.d.ts.map +1 -1
  413. package/utils/internal.js +124 -24
  414. package/utils/internal.js.map +1 -1
  415. package/utils/typeguards.d.ts +34 -6
  416. package/utils/typeguards.d.ts.map +1 -1
  417. package/utils/typeguards.js +52 -8
  418. package/utils/typeguards.js.map +1 -1
  419. package/api/entities/Asset/AssetHolders.d.ts.map +0 -1
  420. package/api/entities/Asset/AssetHolders.js.map +0 -1
  421. package/api/entities/Asset/Checkpoints/Schedules.d.ts.map +0 -1
  422. package/api/entities/Asset/Checkpoints/Schedules.js.map +0 -1
  423. package/api/entities/Asset/Checkpoints/index.d.ts.map +0 -1
  424. package/api/entities/Asset/Checkpoints/index.js.map +0 -1
  425. package/api/entities/Asset/Checkpoints/types.d.ts.map +0 -1
  426. package/api/entities/Asset/Checkpoints/types.js.map +0 -1
  427. package/api/entities/Asset/Compliance/Requirements.d.ts.map +0 -1
  428. package/api/entities/Asset/Compliance/Requirements.js.map +0 -1
  429. package/api/entities/Asset/Compliance/TrustedClaimIssuers.d.ts.map +0 -1
  430. package/api/entities/Asset/Compliance/TrustedClaimIssuers.js.map +0 -1
  431. package/api/entities/Asset/Compliance/index.d.ts.map +0 -1
  432. package/api/entities/Asset/Compliance/index.js.map +0 -1
  433. package/api/entities/Asset/CorporateActions/Distributions.d.ts.map +0 -1
  434. package/api/entities/Asset/CorporateActions/Distributions.js.map +0 -1
  435. package/api/entities/Asset/CorporateActions/index.d.ts.map +0 -1
  436. package/api/entities/Asset/CorporateActions/index.js.map +0 -1
  437. package/api/entities/Asset/CorporateActions/types.d.ts.map +0 -1
  438. package/api/entities/Asset/CorporateActions/types.js.map +0 -1
  439. package/api/entities/Asset/Documents.d.ts.map +0 -1
  440. package/api/entities/Asset/Documents.js.map +0 -1
  441. package/api/entities/Asset/Issuance.d.ts.map +0 -1
  442. package/api/entities/Asset/Issuance.js.map +0 -1
  443. package/api/entities/Asset/Metadata.d.ts.map +0 -1
  444. package/api/entities/Asset/Metadata.js.map +0 -1
  445. package/api/entities/Asset/Offerings.d.ts.map +0 -1
  446. package/api/entities/Asset/Offerings.js.map +0 -1
  447. package/api/entities/Asset/Permissions.d.ts.map +0 -1
  448. package/api/entities/Asset/Permissions.js.map +0 -1
  449. package/api/entities/Asset/Settlements.d.ts +0 -29
  450. package/api/entities/Asset/Settlements.d.ts.map +0 -1
  451. package/api/entities/Asset/Settlements.js +0 -70
  452. package/api/entities/Asset/Settlements.js.map +0 -1
  453. package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts.map +0 -1
  454. package/api/entities/Asset/TransferRestrictions/ClaimCount.js.map +0 -1
  455. package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts.map +0 -1
  456. package/api/entities/Asset/TransferRestrictions/ClaimPercentage.js.map +0 -1
  457. package/api/entities/Asset/TransferRestrictions/Count.d.ts.map +0 -1
  458. package/api/entities/Asset/TransferRestrictions/Count.js.map +0 -1
  459. package/api/entities/Asset/TransferRestrictions/Percentage.d.ts.map +0 -1
  460. package/api/entities/Asset/TransferRestrictions/Percentage.js.map +0 -1
  461. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.d.ts.map +0 -1
  462. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js.map +0 -1
  463. package/api/entities/Asset/TransferRestrictions/index.d.ts.map +0 -1
  464. package/api/entities/Asset/TransferRestrictions/index.js.map +0 -1
  465. package/npm-package/polymeshassociation-polymesh-sdk-23.0.0-alpha.2.tgz +0 -0
  466. /package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/types.js +0 -0
  467. /package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/types.js +0 -0
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.FungibleAsset = void 0;
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const lodash_1 = require("lodash");
18
+ const Base_1 = require("../Base");
19
+ const internal_1 = require("../../../../internal");
20
+ const queries_1 = require("../../../../middleware/queries");
21
+ const conversion_1 = require("../../../../utils/conversion");
22
+ const internal_2 = require("../../../../utils/internal");
23
+ const Settlements_1 = require("../Base/Settlements");
24
+ const AssetHolders_1 = require("./AssetHolders");
25
+ const Checkpoints_1 = require("./Checkpoints");
26
+ const CorporateActions_1 = require("./CorporateActions");
27
+ const Issuance_1 = require("./Issuance");
28
+ const Offerings_1 = require("./Offerings");
29
+ const TransferRestrictions_1 = require("./TransferRestrictions");
30
+ /**
31
+ * Class used to manage all Fungible Asset functionality
32
+ */
33
+ class FungibleAsset extends Base_1.BaseAsset {
34
+ /**
35
+ * @hidden
36
+ */
37
+ constructor(identifiers, context) {
38
+ super(identifiers, context);
39
+ const { ticker } = identifiers;
40
+ this.ticker = ticker;
41
+ this.did = (0, conversion_1.tickerToDid)(ticker);
42
+ this.settlements = new Settlements_1.FungibleSettlements(this, context);
43
+ this.assetHolders = new AssetHolders_1.AssetHolders(this, context);
44
+ this.issuance = new Issuance_1.Issuance(this, context);
45
+ this.transferRestrictions = new TransferRestrictions_1.TransferRestrictions(this, context);
46
+ this.offerings = new Offerings_1.Offerings(this, context);
47
+ this.checkpoints = new Checkpoints_1.Checkpoints(this, context);
48
+ this.corporateActions = new CorporateActions_1.CorporateActions(this, context);
49
+ this.modify = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.modifyAsset, Object.assign({ ticker }, args)] }, context);
50
+ this.redeem = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.redeemTokens, Object.assign({ ticker }, args)] }, context);
51
+ this.controllerTransfer = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.controllerTransfer, Object.assign({ ticker }, args)] }, context);
52
+ this.setVenueFiltering = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.setVenueFiltering, Object.assign({ ticker }, args)] }, context);
53
+ }
54
+ // eslint-disable-next-line require-jsdoc
55
+ currentFundingRound(callback) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const { context: { polymeshApi: { query: { asset }, }, }, ticker, context, } = this;
58
+ const rawTicker = (0, conversion_1.stringToTicker)(ticker, context);
59
+ const assembleResult = (roundName) => (0, conversion_1.bytesToString)(roundName) || null;
60
+ if (callback) {
61
+ return asset.fundingRound(rawTicker, round => {
62
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises -- callback errors should be handled by the caller
63
+ callback(assembleResult(round));
64
+ });
65
+ }
66
+ const fundingRound = yield asset.fundingRound(rawTicker);
67
+ return assembleResult(fundingRound);
68
+ });
69
+ }
70
+ /**
71
+ * Retrieve the identifier data (block number, date and event index) of the event that was emitted when the token was created
72
+ *
73
+ * @note uses the middlewareV2
74
+ * @note there is a possibility that the data is not ready by the time it is requested. In that case, `null` is returned
75
+ */
76
+ createdAt() {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const { ticker, context } = this;
79
+ const { data: { assets: { nodes: [asset], }, }, } = yield context.queryMiddleware((0, queries_1.assetQuery)({
80
+ ticker,
81
+ }));
82
+ return (0, internal_2.optionize)(conversion_1.middlewareEventDetailsToEventIdentifier)(asset === null || asset === void 0 ? void 0 : asset.createdBlock, asset === null || asset === void 0 ? void 0 : asset.eventIdx);
83
+ });
84
+ }
85
+ /**
86
+ * Retrieve the amount of unique investors that hold this Asset
87
+ */
88
+ investorCount() {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const { context: { polymeshApi: { query: { asset: { balanceOf }, }, }, }, context, ticker, } = this;
91
+ const rawTicker = (0, conversion_1.stringToTicker)(ticker, context);
92
+ const balanceEntries = yield balanceOf.entries(rawTicker);
93
+ const assetBalances = balanceEntries.filter(([, balance]) => !(0, conversion_1.balanceToBigNumber)(balance).isZero());
94
+ return new bignumber_js_1.default(assetBalances.length);
95
+ });
96
+ }
97
+ /**
98
+ * Retrieve this Asset's Operation History
99
+ *
100
+ * @note Operations are grouped by the agent Identity who performed them
101
+ *
102
+ * @note uses the middlewareV2
103
+ */
104
+ getOperationHistory() {
105
+ return __awaiter(this, void 0, void 0, function* () {
106
+ const { context, ticker: assetId } = this;
107
+ const { data: { tickerExternalAgentHistories: { nodes }, }, } = yield context.queryMiddleware((0, queries_1.tickerExternalAgentHistoryQuery)({
108
+ assetId,
109
+ }));
110
+ const groupedData = (0, lodash_1.groupBy)(nodes, 'identityId');
111
+ return (0, lodash_1.map)(groupedData, (history, did) => ({
112
+ identity: new internal_1.Identity({ did }, context),
113
+ history: history.map(({ createdBlock, eventIdx }) =>
114
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
115
+ (0, conversion_1.middlewareEventDetailsToEventIdentifier)(createdBlock, eventIdx)),
116
+ }));
117
+ });
118
+ }
119
+ /**
120
+ * Retrieve this Asset's transaction History
121
+ *
122
+ * @note uses the middlewareV2
123
+ */
124
+ getTransactionHistory(opts) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ const { context, ticker } = this;
127
+ const { size, start } = opts;
128
+ const { data: { assetTransactions: { nodes, totalCount }, }, } = yield context.queryMiddleware((0, queries_1.assetTransactionQuery)({
129
+ assetId: ticker,
130
+ }, size, start));
131
+ const data = nodes.map(({ assetId, amount, fromPortfolio, toPortfolio, createdBlock, eventId, eventIdx, extrinsicIdx, }) => (Object.assign({ asset: new FungibleAsset({ ticker: assetId }, context), amount: new bignumber_js_1.default(amount).shiftedBy(-6), event: eventId, from: (0, internal_2.optionize)(conversion_1.middlewarePortfolioToPortfolio)(fromPortfolio, context), to: (0, internal_2.optionize)(conversion_1.middlewarePortfolioToPortfolio)(toPortfolio, context),
132
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
133
+ extrinsicIndex: new bignumber_js_1.default(extrinsicIdx) }, (0, conversion_1.middlewareEventDetailsToEventIdentifier)(createdBlock, eventIdx))));
134
+ const count = new bignumber_js_1.default(totalCount);
135
+ const next = (0, internal_2.calculateNextKey)(count, data.length, start);
136
+ return {
137
+ data,
138
+ next,
139
+ count,
140
+ };
141
+ });
142
+ }
143
+ /**
144
+ * Determine whether this FungibleAsset exists on chain
145
+ */
146
+ exists() {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ const { ticker, context, context: { polymeshApi: { query }, }, } = this;
149
+ const rawTicker = (0, conversion_1.stringToTicker)(ticker, context);
150
+ const [tokenSize, nftId] = yield Promise.all([
151
+ query.asset.tokens.size(rawTicker),
152
+ query.nft.collectionTicker(rawTicker),
153
+ ]);
154
+ return !tokenSize.isZero() && nftId.isZero();
155
+ });
156
+ }
157
+ }
158
+ exports.FungibleAsset = FungibleAsset;
159
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/entities/Asset/Fungible/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gEAAqC;AACrC,mCAAsC;AAEtC,kCAAsD;AACtD,mDAOoB;AACpB,4DAI8B;AAgB9B,6DAO4B;AAC5B,yDAAsF;AAEtF,qDAA0D;AAE1D,iDAA8C;AAC9C,+CAA4C;AAC5C,yDAAsD;AACtD,yCAAsC;AACtC,2CAAwC;AACxC,iEAA8D;AAE9D;;GAEG;AACH,MAAa,aAAc,SAAQ,gBAAS;IAS1C;;OAEG;IACH,YAAY,WAA8B,EAAE,OAAgB;QAC1D,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAE5B,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;QAE/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,IAAA,wBAAW,EAAC,MAAM,CAAC,CAAC;QAE/B,IAAI,CAAC,WAAW,GAAG,IAAI,iCAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,YAAY,GAAG,IAAI,2BAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,oBAAoB,GAAG,IAA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YAElD,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAC3C,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;gBAClC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,SAAS,CAAC;aACtC,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;KAAA;CAMF;AA7QD,sCA6QC"}
@@ -0,0 +1,46 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { Context, Entity, NftCollection } from "../../../../internal";
3
+ import { NftMetadata, OptionalArgsProcedureMethod, RedeemNftParams } from "../../../../types";
4
+ export declare type NftUniqueIdentifiers = {
5
+ ticker: string;
6
+ id: BigNumber;
7
+ };
8
+ export interface HumanReadable {
9
+ id: string;
10
+ collection: string;
11
+ }
12
+ /**
13
+ * Class used to manage Nft functionality
14
+ */
15
+ export declare class Nft extends Entity<NftUniqueIdentifiers, HumanReadable> {
16
+ id: BigNumber;
17
+ collection: NftCollection;
18
+ /**
19
+ * Redeem (or "burns") the NFT
20
+ */
21
+ redeem: OptionalArgsProcedureMethod<RedeemNftParams, void>;
22
+ /**
23
+ * @hidden
24
+ * Check if a value is of type {@link UniqueIdentifiers}
25
+ */
26
+ static isUniqueIdentifiers(identifier: unknown): identifier is NftUniqueIdentifiers;
27
+ /**
28
+ * @hidden
29
+ */
30
+ constructor(identifiers: NftUniqueIdentifiers, context: Context);
31
+ /**
32
+ * Get metadata associated with this token
33
+ */
34
+ getMetadata(): Promise<NftMetadata[]>;
35
+ /**
36
+ * Determine if the NFT exists on chain
37
+ *
38
+ * @note This method returns true, even if the token has been redeemed/burned
39
+ */
40
+ exists(): Promise<boolean>;
41
+ /**
42
+ * @hidden
43
+ */
44
+ toHuman(): HumanReadable;
45
+ }
46
+ //# sourceMappingURL=Nft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Nft.d.ts","sourceRoot":"","sources":["../../../../../src/api/entities/Asset/NonFungible/Nft.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAa,6BAAmB;AACvE,OAAO,EAAE,WAAW,EAAE,2BAA2B,EAAE,eAAe,EAAE,0BAAgB;AASpF,oBAAY,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,SAAS,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,GAAI,SAAQ,MAAM,CAAC,oBAAoB,EAAE,aAAa,CAAC;IAC3D,EAAE,EAAE,SAAS,CAAC;IAEd,UAAU,EAAE,aAAa,CAAC;IAEjC;;OAEG;IACI,MAAM,EAAE,2BAA2B,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAElE;;;OAGG;WACoB,mBAAmB,CACxC,UAAU,EAAE,OAAO,GAClB,UAAU,IAAI,oBAAoB;IAMrC;;OAEG;gBACS,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO;IAe/D;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IA0BlD;;;;OAIG;IACU,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAmBvC;;OAEG;IACI,OAAO,IAAI,aAAa;CAWhC"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Nft = void 0;
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const internal_1 = require("../../../../internal");
18
+ const conversion_1 = require("../../../../utils/conversion");
19
+ const internal_2 = require("../../../../utils/internal");
20
+ /**
21
+ * Class used to manage Nft functionality
22
+ */
23
+ class Nft extends internal_1.Entity {
24
+ /**
25
+ * @hidden
26
+ */
27
+ constructor(identifiers, context) {
28
+ super(identifiers, context);
29
+ const { ticker, id } = identifiers;
30
+ this.id = id;
31
+ this.collection = new internal_1.NftCollection({ ticker }, context);
32
+ this.redeem = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.redeemNft, Object.assign({ ticker, id }, args)], optionalArgs: true }, context);
33
+ }
34
+ /**
35
+ * @hidden
36
+ * Check if a value is of type {@link UniqueIdentifiers}
37
+ */
38
+ static isUniqueIdentifiers(identifier) {
39
+ const { ticker, id } = identifier;
40
+ return typeof ticker === 'string' && id instanceof bignumber_js_1.default;
41
+ }
42
+ /**
43
+ * Get metadata associated with this token
44
+ */
45
+ getMetadata() {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const { id, context, collection, context: { polymeshApi: { query }, }, } = this;
48
+ const collectionId = yield collection.getCollectionId();
49
+ const rawCollectionId = (0, conversion_1.bigNumberToU64)(collectionId, context);
50
+ const rawId = (0, conversion_1.bigNumberToU64)(id, context);
51
+ const entries = yield query.nft.metadataValue.entries([rawCollectionId, rawId]);
52
+ return entries.map(([storageKey, rawValue]) => {
53
+ const rawMetadataKey = storageKey.args[1];
54
+ const key = (0, conversion_1.meshMetadataKeyToMetadataKey)(rawMetadataKey, collection.ticker);
55
+ const value = (0, conversion_1.bytesToString)(rawValue);
56
+ return { key, value };
57
+ });
58
+ });
59
+ }
60
+ /**
61
+ * Determine if the NFT exists on chain
62
+ *
63
+ * @note This method returns true, even if the token has been redeemed/burned
64
+ */
65
+ exists() {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const { context, context: { polymeshApi: { query }, }, collection, id, } = this;
68
+ const collectionId = yield collection.getCollectionId();
69
+ const rawCollectionId = (0, conversion_1.bigNumberToU64)(collectionId, context);
70
+ // note: "nextId" is actually the last used id
71
+ const rawNextId = yield query.nft.nextNFTId(rawCollectionId);
72
+ const nextId = (0, conversion_1.u64ToBigNumber)(rawNextId);
73
+ return id.lte(nextId);
74
+ });
75
+ }
76
+ /**
77
+ * @hidden
78
+ */
79
+ toHuman() {
80
+ const { collection: { ticker }, id, } = this;
81
+ return {
82
+ collection: ticker,
83
+ id: id.toString(),
84
+ };
85
+ }
86
+ }
87
+ exports.Nft = Nft;
88
+ //# sourceMappingURL=Nft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Nft.js","sourceRoot":"","sources":["../../../../../src/api/entities/Asset/NonFungible/Nft.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AAErC,mDAAuE;AAEvE,6DAK4B;AAC5B,yDAAyD;AAYzD;;GAEG;AACH,MAAa,GAAI,SAAQ,iBAA2C;IAsBlE;;OAEG;IACH,YAAY,WAAiC,EAAE,OAAgB;QAC7D,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAE5B,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,CAAC;QAEnC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAEb,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAa,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;QAEzD,IAAI,CAAC,MAAM,GAAG,IAAA,gCAAqB,EACjC,EAAE,mBAAmB,EAAE,IAA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OAIG;IACU,MAAM;;YACjB,MAAM,EACJ,OAAO,EACP,OAAO,EAAE,EACP,WAAW,EAAE,EAAE,KAAK,EAAE,GACvB,EACD,UAAU,EACV,EAAE,GACH,GAAG,IAAI,CAAC;YACT,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,eAAe,EAAE,CAAC;YACxD,MAAM,eAAe,GAAG,IAAA,2BAAc,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAE9D,8CAA8C;YAC9C,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YAC7D,MAAM,MAAM,GAAG,IAAA,2BAAc,EAAC,SAAS,CAAC,CAAC;YAEzC,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;KAAA;IAED;;OAEG;IACI,OAAO;QACZ,MAAM,EACJ,UAAU,EAAE,EAAE,MAAM,EAAE,EACtB,EAAE,GACH,GAAG,IAAI,CAAC;QAET,OAAO;YACL,UAAU,EAAE,MAAM;YAClB,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE;SAClB,CAAC;IACJ,CAAC;CACF;AA3GD,kBA2GC"}
@@ -0,0 +1,62 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { BaseAsset } from "../Base";
3
+ import { NonFungibleSettlements } from "../Base/Settlements";
4
+ import { Nft } from "./Nft";
5
+ import { Context } from "../../../../internal";
6
+ import { AssetDetails, CollectionMetadata, EventIdentifier, IssueNftParams, ProcedureMethod, SubCallback, UniqueIdentifiers, UnsubCallback } from "../../../../types";
7
+ /**
8
+ * Class used to manage Nft functionality
9
+ */
10
+ export declare class NftCollection extends BaseAsset {
11
+ settlements: NonFungibleSettlements;
12
+ /**
13
+ * Issues a new NFT for the collection
14
+ *
15
+ * @note Each NFT requires metadata for each value returned by `collectionMetadata`. The SDK and chain only validate the presence of these fields. Additional validation may be needed to ensure each value is compliant with the expected specification
16
+ */
17
+ issue: ProcedureMethod<IssueNftParams, Nft>;
18
+ /**
19
+ * Caches value for `getCollectionId`
20
+ *
21
+ * @hidden
22
+ */
23
+ private id?;
24
+ /**
25
+ * @hidden
26
+ */
27
+ constructor(identifiers: UniqueIdentifiers, context: Context);
28
+ /**
29
+ * Retrieve the identifier data (block number, date and event index) of the event that was emitted when the token was created
30
+ *
31
+ * @note uses the middlewareV2
32
+ * @note there is a possibility that the data is not ready by the time it is requested. In that case, `null` is returned
33
+ */
34
+ createdAt(): Promise<EventIdentifier | null>;
35
+ /**
36
+ * Retrieve the NftCollection's data
37
+ *
38
+ * @note can be subscribed to
39
+ */
40
+ details(): Promise<AssetDetails>;
41
+ details(callback: SubCallback<AssetDetails>): Promise<UnsubCallback>;
42
+ /**
43
+ * Get the metadata that each NFT in the collection must have
44
+ *
45
+ * @note Each NFT **must** have an entry for each value, it **should** comply with the spec
46
+ * the SDK validates only presence of metadata keys, additional validation may be needed for issuers
47
+ */
48
+ collectionMetadata(): Promise<CollectionMetadata[]>;
49
+ /**
50
+ * Retrieve the amount of unique investors that hold this Nft
51
+ */
52
+ investorCount(): Promise<BigNumber>;
53
+ /**
54
+ * Determine whether this NftCollection exists on chain
55
+ */
56
+ exists(): Promise<boolean>;
57
+ /**
58
+ * Returns the collection id
59
+ */
60
+ getCollectionId(): Promise<BigNumber>;
61
+ }
62
+ //# sourceMappingURL=NftCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NftCollection.d.ts","sourceRoot":"","sources":["../../../../../src/api/entities/Asset/NonFungible/NftCollection.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,gBAAkC;AACtD,OAAO,EAAE,sBAAsB,EAAE,4BAA8C;AAC/E,OAAO,EAAE,GAAG,EAAE,cAA6C;AAE3D,OAAO,EAAE,OAAO,EAAyC,6BAAmB;AAG5E,OAAO,EACL,YAAY,EACZ,kBAAkB,EAElB,eAAe,EACf,cAAc,EACd,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,aAAa,EACd,0BAAgB;AAuBjB;;GAEG;AACH,qBAAa,aAAc,SAAQ,SAAS;IACnC,WAAW,EAAE,sBAAsB,CAAC;IAC3C;;;;OAIG;IACI,KAAK,EAAE,eAAe,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IAEnD;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,CAAY;IAEvB;;OAEG;gBACS,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO;IAmB5D;;;;;OAKG;IACU,SAAS,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAkBzD;;;;OAIG;IACa,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC;IAChC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IA0CpF;;;;;OAKG;IACU,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAiChE;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,SAAS,CAAC;IAkBhD;;OAEG;IACmB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAUhD;;OAEG;IACU,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC;CAoBnD"}
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.NftCollection = void 0;
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const Base_1 = require("../Base");
18
+ const Settlements_1 = require("../Base/Settlements");
19
+ const issueNft_1 = require("../../../procedures/issueNft");
20
+ const internal_1 = require("../../../../internal");
21
+ const queries_1 = require("../../../../middleware/queries");
22
+ const types_1 = require("../../../../types");
23
+ const conversion_1 = require("../../../../utils/conversion");
24
+ const internal_2 = require("../../../../utils/internal");
25
+ const sumNftIssuance = (numberOfNfts) => {
26
+ let numberIssued = new bignumber_js_1.default(0);
27
+ numberOfNfts.forEach(([, holderEntry]) => {
28
+ const holderAmount = (0, conversion_1.u64ToBigNumber)(holderEntry);
29
+ numberIssued = numberIssued.plus(holderAmount);
30
+ });
31
+ return numberIssued;
32
+ };
33
+ /**
34
+ * Class used to manage Nft functionality
35
+ */
36
+ class NftCollection extends Base_1.BaseAsset {
37
+ /**
38
+ * @hidden
39
+ */
40
+ constructor(identifiers, context) {
41
+ super(identifiers, context);
42
+ const { ticker } = identifiers;
43
+ this.settlements = new Settlements_1.NonFungibleSettlements(this, context);
44
+ this.transferOwnership = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.transferAssetOwnership, Object.assign({ ticker }, args)] }, context);
45
+ this.issue = (0, internal_2.createProcedureMethod)({
46
+ getProcedureAndArgs: args => [issueNft_1.issueNft, Object.assign({ ticker }, args)],
47
+ }, context);
48
+ }
49
+ /**
50
+ * Retrieve the identifier data (block number, date and event index) of the event that was emitted when the token was created
51
+ *
52
+ * @note uses the middlewareV2
53
+ * @note there is a possibility that the data is not ready by the time it is requested. In that case, `null` is returned
54
+ */
55
+ createdAt() {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const { ticker, context } = this;
58
+ const { data: { assets: { nodes: [asset], }, }, } = yield context.queryMiddleware((0, queries_1.assetQuery)({
59
+ ticker,
60
+ }));
61
+ return (0, internal_2.optionize)(conversion_1.middlewareEventDetailsToEventIdentifier)(asset === null || asset === void 0 ? void 0 : asset.createdBlock, asset === null || asset === void 0 ? void 0 : asset.eventIdx);
62
+ });
63
+ }
64
+ // eslint-disable-next-line require-jsdoc
65
+ details(callback) {
66
+ const _super = Object.create(null, {
67
+ details: { get: () => super.details }
68
+ });
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const { context: { polymeshApi: { query }, }, ticker, context, } = this;
71
+ const rawTicker = (0, conversion_1.stringToTicker)(ticker, context);
72
+ const rawNumberNftsPromise = query.nft.numberOfNFTs.entries(rawTicker);
73
+ if (callback) {
74
+ const rawNumberNfts = yield rawNumberNftsPromise;
75
+ const numberIssued = sumNftIssuance(rawNumberNfts);
76
+ // currently `asset.tokens` does not track Nft `totalSupply', we wrap the callback to provide it
77
+ const wrappedCallback = (commonDetails) => __awaiter(this, void 0, void 0, function* () {
78
+ const nftDetails = Object.assign(Object.assign({}, commonDetails), { totalSupply: numberIssued });
79
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
80
+ callback(nftDetails);
81
+ });
82
+ return _super.details.call(this, wrappedCallback);
83
+ }
84
+ const [rawNumberNfts, commonDetails] = yield Promise.all([
85
+ rawNumberNftsPromise,
86
+ _super.details.call(this),
87
+ ]);
88
+ const numberIssued = sumNftIssuance(rawNumberNfts);
89
+ return Object.assign(Object.assign({}, commonDetails), { totalSupply: numberIssued });
90
+ });
91
+ }
92
+ /**
93
+ * Get the metadata that each NFT in the collection must have
94
+ *
95
+ * @note Each NFT **must** have an entry for each value, it **should** comply with the spec
96
+ * the SDK validates only presence of metadata keys, additional validation may be needed for issuers
97
+ */
98
+ collectionMetadata() {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const { context, ticker, context: { polymeshApi: { query }, }, } = this;
101
+ const collectionId = yield this.getCollectionId();
102
+ const rawCollectionId = (0, conversion_1.bigNumberToU64)(collectionId, context);
103
+ const rawKeys = yield query.nft.collectionKeys(rawCollectionId);
104
+ const neededKeys = [...rawKeys].map(value => (0, conversion_1.meshMetadataKeyToMetadataKey)(value, ticker));
105
+ const allMetadata = yield this.metadata.get();
106
+ return Promise.all(neededKeys.map(({ type, id }) => __awaiter(this, void 0, void 0, function* () {
107
+ const neededMetadata = allMetadata.find(entry => entry.type === type && entry.id.eq(id));
108
+ if (!neededMetadata) {
109
+ throw new internal_1.PolymeshError({
110
+ code: types_1.ErrorCode.DataUnavailable,
111
+ message: 'Failed to find metadata details',
112
+ data: { type, id },
113
+ });
114
+ }
115
+ const details = yield neededMetadata.details();
116
+ return Object.assign(Object.assign({}, details), { id, type, ticker });
117
+ })));
118
+ });
119
+ }
120
+ /**
121
+ * Retrieve the amount of unique investors that hold this Nft
122
+ */
123
+ investorCount() {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ const { context: { polymeshApi: { query }, }, context, ticker, } = this;
126
+ const rawTicker = (0, conversion_1.stringToTicker)(ticker, context);
127
+ const holderEntries = yield query.nft.numberOfNFTs.entries(rawTicker);
128
+ const assetBalances = holderEntries.filter(([, balance]) => !balance.isZero());
129
+ return new bignumber_js_1.default(assetBalances.length);
130
+ });
131
+ }
132
+ /**
133
+ * Determine whether this NftCollection exists on chain
134
+ */
135
+ exists() {
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ const { ticker, context } = this;
138
+ const rawTokenId = yield context.polymeshApi.query.nft.collectionTicker((0, conversion_1.stringToTicker)(ticker, context));
139
+ return !rawTokenId.isZero();
140
+ });
141
+ }
142
+ /**
143
+ * Returns the collection id
144
+ */
145
+ getCollectionId() {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ const { ticker, context, context: { polymeshApi: { query }, }, } = this;
148
+ if (this.id) {
149
+ return this.id;
150
+ }
151
+ const rawTicker = (0, conversion_1.stringToTicker)(ticker, context);
152
+ const rawId = yield query.nft.collectionTicker(rawTicker);
153
+ this.id = (0, conversion_1.u64ToBigNumber)(rawId);
154
+ return this.id;
155
+ });
156
+ }
157
+ }
158
+ exports.NftCollection = NftCollection;
159
+ //# sourceMappingURL=NftCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NftCollection.js","sourceRoot":"","sources":["../../../../../src/api/entities/Asset/NonFungible/NftCollection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,gEAAqC;AAErC,kCAAsD;AACtD,qDAA+E;AAE/E,2DAAqD;AACrD,mDAA4E;AAC5E,4DAAkD;AAElD,6CAUiB;AAEjB,6DAM4B;AAC5B,yDAAoE;AAEpE,MAAM,cAAc,GAAG,CACrB,YAA2F,EAChF,EAAE;IACb,IAAI,YAAY,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IACpC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,EAAE;QACvC,MAAM,YAAY,GAAG,IAAA,2BAAc,EAAC,WAAW,CAAC,CAAC;QACjD,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAa,aAAc,SAAQ,gBAAS;IAgB1C;;OAEG;IACH,YAAY,WAA8B,EAAE,OAAgB;QAC1D,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAE5B,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,oCAAsB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE7D,IAAI,CAAC,iBAAiB,GAAG,IAAA,gCAAqB,EAC5C,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,iCAAsB,kBAAI,MAAM,IAAK,IAAI,EAAG,EAAE,EAC9E,OAAO,CACR,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,IAAA,gCAAqB,EAChC;YACE,mBAAmB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAQ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GACvB,GACF,GAAG,IAAI,CAAC;YAET,IAAI,IAAI,CAAC,EAAE,EAAE;gBACX,OAAO,IAAI,CAAC,EAAE,CAAC;aAChB;YAED,MAAM,SAAS,GAAG,IAAA,2BAAc,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAClD,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YAE1D,IAAI,CAAC,EAAE,GAAG,IAAA,2BAAc,EAAC,KAAK,CAAC,CAAC;YAEhC,OAAO,IAAI,CAAC,EAAE,CAAC;QACjB,CAAC;KAAA;CACF;AA9MD,sCA8MC"}
@@ -0,0 +1,3 @@
1
+ export * from './NftCollection';
2
+ export * from './Nft';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/entities/Asset/NonFungible/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./NftCollection"), exports);
18
+ __exportStar(require("./Nft"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/entities/Asset/NonFungible/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,wCAAsB"}