@polymeshassociation/polymesh-sdk 23.0.0-alpha.3 → 23.0.0-alpha.31

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 (500) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/README.md +49 -7
  3. package/api/client/Assets.d.ts +30 -7
  4. package/api/client/Assets.d.ts.map +1 -1
  5. package/api/client/Assets.js +56 -10
  6. package/api/client/Assets.js.map +1 -1
  7. package/api/client/Claims.d.ts +21 -1
  8. package/api/client/Claims.d.ts.map +1 -1
  9. package/api/client/Claims.js +33 -2
  10. package/api/client/Claims.js.map +1 -1
  11. package/api/client/Network.d.ts +1 -1
  12. package/api/client/Network.d.ts.map +1 -1
  13. package/api/client/Network.js +2 -1
  14. package/api/client/Network.js.map +1 -1
  15. package/api/entities/Account/MultiSig/index.d.ts.map +1 -1
  16. package/api/entities/Account/MultiSig/index.js +2 -5
  17. package/api/entities/Account/MultiSig/index.js.map +1 -1
  18. package/api/entities/Account/helpers.d.ts +3 -2
  19. package/api/entities/Account/helpers.d.ts.map +1 -1
  20. package/api/entities/Account/helpers.js.map +1 -1
  21. package/api/entities/Account/index.d.ts.map +1 -1
  22. package/api/entities/Account/index.js +20 -16
  23. package/api/entities/Account/index.js.map +1 -1
  24. package/api/entities/Account/types.d.ts +1 -1
  25. package/api/entities/Asset/Base/BaseAsset.d.ts +82 -0
  26. package/api/entities/Asset/Base/BaseAsset.d.ts.map +1 -0
  27. package/api/entities/Asset/Base/BaseAsset.js +174 -0
  28. package/api/entities/Asset/Base/BaseAsset.js.map +1 -0
  29. package/api/entities/Asset/{Compliance → Base/Compliance}/Requirements.d.ts +10 -10
  30. package/api/entities/Asset/Base/Compliance/Requirements.d.ts.map +1 -0
  31. package/api/entities/Asset/{Compliance → Base/Compliance}/Requirements.js +3 -3
  32. package/api/entities/Asset/Base/Compliance/Requirements.js.map +1 -0
  33. package/api/entities/Asset/{Compliance → Base/Compliance}/TrustedClaimIssuers.d.ts +7 -7
  34. package/api/entities/Asset/Base/Compliance/TrustedClaimIssuers.d.ts.map +1 -0
  35. package/api/entities/Asset/{Compliance → Base/Compliance}/TrustedClaimIssuers.js +4 -4
  36. package/api/entities/Asset/Base/Compliance/TrustedClaimIssuers.js.map +1 -0
  37. package/api/entities/Asset/{Compliance → Base/Compliance}/index.d.ts +3 -3
  38. package/api/entities/Asset/Base/Compliance/index.d.ts.map +1 -0
  39. package/api/entities/Asset/{Compliance → Base/Compliance}/index.js +1 -1
  40. package/api/entities/Asset/Base/Compliance/index.js.map +1 -0
  41. package/api/entities/Asset/{Documents.d.ts → Base/Documents/index.d.ts} +7 -8
  42. package/api/entities/Asset/Base/Documents/index.d.ts.map +1 -0
  43. package/api/entities/Asset/{Documents.js → Base/Documents/index.js} +4 -4
  44. package/api/entities/Asset/Base/Documents/index.js.map +1 -0
  45. package/api/entities/Asset/{Metadata.d.ts → Base/Metadata/index.d.ts} +11 -5
  46. package/api/entities/Asset/Base/Metadata/index.d.ts.map +1 -0
  47. package/api/entities/Asset/{Metadata.js → Base/Metadata/index.js} +17 -5
  48. package/api/entities/Asset/Base/Metadata/index.js.map +1 -0
  49. package/api/entities/Asset/{Permissions.d.ts → Base/Permissions/index.d.ts} +5 -5
  50. package/api/entities/Asset/Base/Permissions/index.d.ts.map +1 -0
  51. package/api/entities/Asset/{Permissions.js → Base/Permissions/index.js} +5 -5
  52. package/api/entities/Asset/Base/Permissions/index.js.map +1 -0
  53. package/api/entities/Asset/Base/Settlements/index.d.ts +85 -0
  54. package/api/entities/Asset/Base/Settlements/index.d.ts.map +1 -0
  55. package/api/entities/Asset/Base/Settlements/index.js +141 -0
  56. package/api/entities/Asset/Base/Settlements/index.js.map +1 -0
  57. package/api/entities/Asset/Base/index.d.ts +2 -0
  58. package/api/entities/Asset/Base/index.d.ts.map +1 -0
  59. package/api/entities/Asset/Base/index.js +18 -0
  60. package/api/entities/Asset/Base/index.js.map +1 -0
  61. package/api/entities/Asset/{AssetHolders.d.ts → Fungible/AssetHolders/index.d.ts} +4 -4
  62. package/api/entities/Asset/Fungible/AssetHolders/index.d.ts.map +1 -0
  63. package/api/entities/Asset/{AssetHolders.js → Fungible/AssetHolders/index.js} +4 -4
  64. package/api/entities/Asset/Fungible/AssetHolders/index.js.map +1 -0
  65. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/Schedules.d.ts +4 -4
  66. package/api/entities/Asset/Fungible/Checkpoints/Schedules.d.ts.map +1 -0
  67. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/Schedules.js +4 -4
  68. package/api/entities/Asset/Fungible/Checkpoints/Schedules.js.map +1 -0
  69. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/index.d.ts +4 -4
  70. package/api/entities/Asset/Fungible/Checkpoints/index.d.ts.map +1 -0
  71. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/index.js +5 -5
  72. package/api/entities/Asset/Fungible/Checkpoints/index.js.map +1 -0
  73. package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/types.d.ts +1 -1
  74. package/api/entities/Asset/Fungible/Checkpoints/types.d.ts.map +1 -0
  75. package/api/entities/Asset/Fungible/Checkpoints/types.js.map +1 -0
  76. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/Distributions.d.ts +4 -4
  77. package/api/entities/Asset/Fungible/CorporateActions/Distributions.d.ts.map +1 -0
  78. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/Distributions.js +4 -4
  79. package/api/entities/Asset/Fungible/CorporateActions/Distributions.js.map +1 -0
  80. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/index.d.ts +4 -4
  81. package/api/entities/Asset/Fungible/CorporateActions/index.d.ts.map +1 -0
  82. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/index.js +3 -3
  83. package/api/entities/Asset/Fungible/CorporateActions/index.js.map +1 -0
  84. package/api/entities/Asset/{CorporateActions → Fungible/CorporateActions}/types.d.ts +1 -1
  85. package/api/entities/Asset/Fungible/CorporateActions/types.d.ts.map +1 -0
  86. package/api/entities/Asset/Fungible/CorporateActions/types.js.map +1 -0
  87. package/api/entities/Asset/{Issuance.d.ts → Fungible/Issuance/index.d.ts} +6 -6
  88. package/api/entities/Asset/Fungible/Issuance/index.d.ts.map +1 -0
  89. package/api/entities/Asset/{Issuance.js → Fungible/Issuance/index.js} +3 -3
  90. package/api/entities/Asset/Fungible/Issuance/index.js.map +1 -0
  91. package/api/entities/Asset/{Offerings.d.ts → Fungible/Offerings/index.d.ts} +5 -5
  92. package/api/entities/Asset/Fungible/Offerings/index.d.ts.map +1 -0
  93. package/api/entities/Asset/{Offerings.js → Fungible/Offerings/index.js} +5 -5
  94. package/api/entities/Asset/Fungible/Offerings/index.js.map +1 -0
  95. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimCount.d.ts +2 -2
  96. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.d.ts.map +1 -0
  97. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimCount.js +2 -2
  98. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.js.map +1 -0
  99. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimPercentage.d.ts +2 -2
  100. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.d.ts.map +1 -0
  101. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/ClaimPercentage.js +2 -2
  102. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.js.map +1 -0
  103. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Count.d.ts +5 -5
  104. package/api/entities/Asset/Fungible/TransferRestrictions/Count.d.ts.map +1 -0
  105. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Count.js +2 -2
  106. package/api/entities/Asset/Fungible/TransferRestrictions/Count.js.map +1 -0
  107. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Percentage.d.ts +2 -2
  108. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.d.ts.map +1 -0
  109. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/Percentage.js +2 -2
  110. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.js.map +1 -0
  111. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/TransferRestrictionBase.d.ts +4 -4
  112. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.d.ts.map +1 -0
  113. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/TransferRestrictionBase.js +4 -4
  114. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.js.map +1 -0
  115. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/index.d.ts +3 -3
  116. package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts.map +1 -0
  117. package/api/entities/Asset/{TransferRestrictions → Fungible/TransferRestrictions}/index.js +1 -1
  118. package/api/entities/Asset/Fungible/TransferRestrictions/index.js.map +1 -0
  119. package/api/entities/Asset/Fungible/index.d.ts +88 -0
  120. package/api/entities/Asset/Fungible/index.d.ts.map +1 -0
  121. package/api/entities/Asset/Fungible/index.js +159 -0
  122. package/api/entities/Asset/Fungible/index.js.map +1 -0
  123. package/api/entities/Asset/NonFungible/Nft.d.ts +110 -0
  124. package/api/entities/Asset/NonFungible/Nft.d.ts.map +1 -0
  125. package/api/entities/Asset/NonFungible/Nft.js +243 -0
  126. package/api/entities/Asset/NonFungible/Nft.js.map +1 -0
  127. package/api/entities/Asset/NonFungible/NftCollection.d.ts +69 -0
  128. package/api/entities/Asset/NonFungible/NftCollection.d.ts.map +1 -0
  129. package/api/entities/Asset/NonFungible/NftCollection.js +185 -0
  130. package/api/entities/Asset/NonFungible/NftCollection.js.map +1 -0
  131. package/api/entities/Asset/NonFungible/index.d.ts +3 -0
  132. package/api/entities/Asset/NonFungible/index.d.ts.map +1 -0
  133. package/api/entities/Asset/NonFungible/index.js +19 -0
  134. package/api/entities/Asset/NonFungible/index.js.map +1 -0
  135. package/api/entities/Asset/index.d.ts +4 -158
  136. package/api/entities/Asset/index.d.ts.map +1 -1
  137. package/api/entities/Asset/index.js +17 -270
  138. package/api/entities/Asset/index.js.map +1 -1
  139. package/api/entities/Asset/types.d.ts +48 -6
  140. package/api/entities/Asset/types.d.ts.map +1 -1
  141. package/api/entities/Asset/types.js +2 -2
  142. package/api/entities/Asset/types.js.map +1 -1
  143. package/api/entities/Checkpoint.d.ts +2 -2
  144. package/api/entities/Checkpoint.d.ts.map +1 -1
  145. package/api/entities/Checkpoint.js +1 -1
  146. package/api/entities/Checkpoint.js.map +1 -1
  147. package/api/entities/CheckpointSchedule/index.d.ts +2 -2
  148. package/api/entities/CheckpointSchedule/index.d.ts.map +1 -1
  149. package/api/entities/CheckpointSchedule/index.js +1 -1
  150. package/api/entities/CheckpointSchedule/index.js.map +1 -1
  151. package/api/entities/CorporateActionBase/index.d.ts +2 -2
  152. package/api/entities/CorporateActionBase/index.d.ts.map +1 -1
  153. package/api/entities/CorporateActionBase/index.js +1 -1
  154. package/api/entities/CorporateActionBase/index.js.map +1 -1
  155. package/api/entities/DefaultTrustedClaimIssuer.d.ts +2 -2
  156. package/api/entities/DefaultTrustedClaimIssuer.d.ts.map +1 -1
  157. package/api/entities/DefaultTrustedClaimIssuer.js +1 -1
  158. package/api/entities/DefaultTrustedClaimIssuer.js.map +1 -1
  159. package/api/entities/Identity/AssetPermissions.d.ts +8 -8
  160. package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
  161. package/api/entities/Identity/AssetPermissions.js +2 -2
  162. package/api/entities/Identity/AssetPermissions.js.map +1 -1
  163. package/api/entities/Identity/index.d.ts +20 -5
  164. package/api/entities/Identity/index.d.ts.map +1 -1
  165. package/api/entities/Identity/index.js +39 -2
  166. package/api/entities/Identity/index.js.map +1 -1
  167. package/api/entities/Instruction/index.d.ts.map +1 -1
  168. package/api/entities/Instruction/index.js +30 -21
  169. package/api/entities/Instruction/index.js.map +1 -1
  170. package/api/entities/Instruction/types.d.ts +11 -4
  171. package/api/entities/Instruction/types.d.ts.map +1 -1
  172. package/api/entities/Instruction/types.js.map +1 -1
  173. package/api/entities/MetadataEntry/index.d.ts +2 -2
  174. package/api/entities/MetadataEntry/index.d.ts.map +1 -1
  175. package/api/entities/MetadataEntry/index.js +1 -1
  176. package/api/entities/MetadataEntry/index.js.map +1 -1
  177. package/api/entities/MultiSigProposal/index.d.ts +36 -2
  178. package/api/entities/MultiSigProposal/index.d.ts.map +1 -1
  179. package/api/entities/MultiSigProposal/index.js +91 -10
  180. package/api/entities/MultiSigProposal/index.js.map +1 -1
  181. package/api/entities/MultiSigProposal/types.d.ts +15 -2
  182. package/api/entities/MultiSigProposal/types.d.ts.map +1 -1
  183. package/api/entities/MultiSigProposal/types.js +6 -1
  184. package/api/entities/MultiSigProposal/types.js.map +1 -1
  185. package/api/entities/Offering/index.d.ts +2 -2
  186. package/api/entities/Offering/index.d.ts.map +1 -1
  187. package/api/entities/Offering/index.js +1 -1
  188. package/api/entities/Offering/index.js.map +1 -1
  189. package/api/entities/PermissionGroup.d.ts +2 -2
  190. package/api/entities/PermissionGroup.d.ts.map +1 -1
  191. package/api/entities/PermissionGroup.js +1 -1
  192. package/api/entities/PermissionGroup.js.map +1 -1
  193. package/api/entities/Portfolio/index.d.ts +13 -5
  194. package/api/entities/Portfolio/index.d.ts.map +1 -1
  195. package/api/entities/Portfolio/index.js +70 -10
  196. package/api/entities/Portfolio/index.js.map +1 -1
  197. package/api/entities/Portfolio/types.d.ts +21 -6
  198. package/api/entities/Portfolio/types.d.ts.map +1 -1
  199. package/api/entities/TickerReservation/index.d.ts +2 -2
  200. package/api/entities/TickerReservation/index.d.ts.map +1 -1
  201. package/api/entities/Venue/types.d.ts +1 -1
  202. package/api/entities/common/namespaces/Authorizations.d.ts +2 -1
  203. package/api/entities/common/namespaces/Authorizations.d.ts.map +1 -1
  204. package/api/entities/common/namespaces/Authorizations.js.map +1 -1
  205. package/api/entities/types.d.ts +5 -2
  206. package/api/entities/types.d.ts.map +1 -1
  207. package/api/entities/types.js.map +1 -1
  208. package/api/procedures/addAssetRequirement.d.ts +4 -4
  209. package/api/procedures/addAssetRequirement.d.ts.map +1 -1
  210. package/api/procedures/addAssetRequirement.js +3 -3
  211. package/api/procedures/addAssetRequirement.js.map +1 -1
  212. package/api/procedures/addAssetStat.d.ts.map +1 -1
  213. package/api/procedures/addAssetStat.js +1 -1
  214. package/api/procedures/addAssetStat.js.map +1 -1
  215. package/api/procedures/addInstruction.d.ts.map +1 -1
  216. package/api/procedures/addInstruction.js +76 -17
  217. package/api/procedures/addInstruction.js.map +1 -1
  218. package/api/procedures/addTransferRestriction.d.ts.map +1 -1
  219. package/api/procedures/addTransferRestriction.js +1 -1
  220. package/api/procedures/addTransferRestriction.js.map +1 -1
  221. package/api/procedures/closeOffering.d.ts.map +1 -1
  222. package/api/procedures/closeOffering.js +1 -1
  223. package/api/procedures/closeOffering.js.map +1 -1
  224. package/api/procedures/configureDividendDistribution.d.ts.map +1 -1
  225. package/api/procedures/configureDividendDistribution.js +1 -1
  226. package/api/procedures/configureDividendDistribution.js.map +1 -1
  227. package/api/procedures/controllerTransfer.d.ts.map +1 -1
  228. package/api/procedures/controllerTransfer.js +2 -2
  229. package/api/procedures/controllerTransfer.js.map +1 -1
  230. package/api/procedures/createAsset.d.ts +5 -5
  231. package/api/procedures/createAsset.d.ts.map +1 -1
  232. package/api/procedures/createAsset.js +4 -20
  233. package/api/procedures/createAsset.js.map +1 -1
  234. package/api/procedures/createCheckpoint.d.ts.map +1 -1
  235. package/api/procedures/createCheckpoint.js +1 -1
  236. package/api/procedures/createCheckpoint.js.map +1 -1
  237. package/api/procedures/createCheckpointSchedule.d.ts.map +1 -1
  238. package/api/procedures/createCheckpointSchedule.js +1 -1
  239. package/api/procedures/createCheckpointSchedule.js.map +1 -1
  240. package/api/procedures/createGroup.d.ts +2 -2
  241. package/api/procedures/createGroup.d.ts.map +1 -1
  242. package/api/procedures/createGroup.js +1 -1
  243. package/api/procedures/createGroup.js.map +1 -1
  244. package/api/procedures/createNftCollection.d.ts +41 -0
  245. package/api/procedures/createNftCollection.d.ts.map +1 -0
  246. package/api/procedures/createNftCollection.js +248 -0
  247. package/api/procedures/createNftCollection.js.map +1 -0
  248. package/api/procedures/createTransactionBatch.d.ts.map +1 -1
  249. package/api/procedures/createTransactionBatch.js +1 -1
  250. package/api/procedures/createTransactionBatch.js.map +1 -1
  251. package/api/procedures/evaluateMultiSigProposal.d.ts +19 -0
  252. package/api/procedures/evaluateMultiSigProposal.d.ts.map +1 -0
  253. package/api/procedures/evaluateMultiSigProposal.js +92 -0
  254. package/api/procedures/evaluateMultiSigProposal.js.map +1 -0
  255. package/api/procedures/inviteExternalAgent.d.ts +2 -2
  256. package/api/procedures/inviteExternalAgent.d.ts.map +1 -1
  257. package/api/procedures/inviteExternalAgent.js +1 -1
  258. package/api/procedures/inviteExternalAgent.js.map +1 -1
  259. package/api/procedures/issueNft.d.ts +35 -0
  260. package/api/procedures/issueNft.d.ts.map +1 -0
  261. package/api/procedures/issueNft.js +98 -0
  262. package/api/procedures/issueNft.js.map +1 -0
  263. package/api/procedures/issueTokens.d.ts +6 -6
  264. package/api/procedures/issueTokens.d.ts.map +1 -1
  265. package/api/procedures/issueTokens.js +1 -1
  266. package/api/procedures/issueTokens.js.map +1 -1
  267. package/api/procedures/launchOffering.d.ts.map +1 -1
  268. package/api/procedures/launchOffering.js +1 -1
  269. package/api/procedures/launchOffering.js.map +1 -1
  270. package/api/procedures/linkCaDocs.d.ts.map +1 -1
  271. package/api/procedures/linkCaDocs.js +1 -1
  272. package/api/procedures/linkCaDocs.js.map +1 -1
  273. package/api/procedures/modifyAsset.d.ts +4 -4
  274. package/api/procedures/modifyAsset.d.ts.map +1 -1
  275. package/api/procedures/modifyAsset.js +2 -2
  276. package/api/procedures/modifyAsset.js.map +1 -1
  277. package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts +4 -4
  278. package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts.map +1 -1
  279. package/api/procedures/modifyAssetTrustedClaimIssuers.js +2 -2
  280. package/api/procedures/modifyAssetTrustedClaimIssuers.js.map +1 -1
  281. package/api/procedures/modifyCaCheckpoint.d.ts.map +1 -1
  282. package/api/procedures/modifyCaCheckpoint.js +1 -1
  283. package/api/procedures/modifyCaCheckpoint.js.map +1 -1
  284. package/api/procedures/modifyCaDefaultConfig.d.ts.map +1 -1
  285. package/api/procedures/modifyCaDefaultConfig.js +2 -2
  286. package/api/procedures/modifyCaDefaultConfig.js.map +1 -1
  287. package/api/procedures/modifyClaims.d.ts.map +1 -1
  288. package/api/procedures/modifyClaims.js +7 -21
  289. package/api/procedures/modifyClaims.js.map +1 -1
  290. package/api/procedures/modifyComplianceRequirement.d.ts.map +1 -1
  291. package/api/procedures/modifyComplianceRequirement.js +2 -2
  292. package/api/procedures/modifyComplianceRequirement.js.map +1 -1
  293. package/api/procedures/modifyCorporateActionsAgent.d.ts.map +1 -1
  294. package/api/procedures/modifyCorporateActionsAgent.js +2 -2
  295. package/api/procedures/modifyCorporateActionsAgent.js.map +1 -1
  296. package/api/procedures/modifyOfferingTimes.d.ts.map +1 -1
  297. package/api/procedures/modifyOfferingTimes.js +1 -1
  298. package/api/procedures/modifyOfferingTimes.js.map +1 -1
  299. package/api/procedures/moveFunds.d.ts.map +1 -1
  300. package/api/procedures/moveFunds.js +82 -16
  301. package/api/procedures/moveFunds.js.map +1 -1
  302. package/api/procedures/reclaimDividendDistributionFunds.d.ts.map +1 -1
  303. package/api/procedures/reclaimDividendDistributionFunds.js +1 -1
  304. package/api/procedures/reclaimDividendDistributionFunds.js.map +1 -1
  305. package/api/procedures/redeemNft.d.ts +31 -0
  306. package/api/procedures/redeemNft.d.ts.map +1 -0
  307. package/api/procedures/redeemNft.js +87 -0
  308. package/api/procedures/redeemNft.js.map +1 -0
  309. package/api/procedures/redeemTokens.d.ts.map +1 -1
  310. package/api/procedures/redeemTokens.js +2 -2
  311. package/api/procedures/redeemTokens.js.map +1 -1
  312. package/api/procedures/registerCustomClaimType.d.ts +22 -0
  313. package/api/procedures/registerCustomClaimType.d.ts.map +1 -0
  314. package/api/procedures/registerCustomClaimType.js +69 -0
  315. package/api/procedures/registerCustomClaimType.js.map +1 -0
  316. package/api/procedures/registerMetadata.d.ts.map +1 -1
  317. package/api/procedures/registerMetadata.js +1 -1
  318. package/api/procedures/registerMetadata.js.map +1 -1
  319. package/api/procedures/removeAssetRequirement.d.ts +4 -4
  320. package/api/procedures/removeAssetRequirement.d.ts.map +1 -1
  321. package/api/procedures/removeAssetRequirement.js +2 -2
  322. package/api/procedures/removeAssetRequirement.js.map +1 -1
  323. package/api/procedures/removeAssetStat.d.ts.map +1 -1
  324. package/api/procedures/removeAssetStat.js +1 -1
  325. package/api/procedures/removeAssetStat.js.map +1 -1
  326. package/api/procedures/removeCheckpointSchedule.d.ts.map +1 -1
  327. package/api/procedures/removeCheckpointSchedule.js +1 -1
  328. package/api/procedures/removeCheckpointSchedule.js.map +1 -1
  329. package/api/procedures/removeCorporateAction.js +1 -1
  330. package/api/procedures/removeCorporateAction.js.map +1 -1
  331. package/api/procedures/removeExternalAgent.d.ts +2 -2
  332. package/api/procedures/removeExternalAgent.d.ts.map +1 -1
  333. package/api/procedures/removeExternalAgent.js +1 -1
  334. package/api/procedures/removeExternalAgent.js.map +1 -1
  335. package/api/procedures/setAssetDocuments.d.ts +5 -5
  336. package/api/procedures/setAssetDocuments.d.ts.map +1 -1
  337. package/api/procedures/setAssetDocuments.js +2 -2
  338. package/api/procedures/setAssetDocuments.js.map +1 -1
  339. package/api/procedures/setAssetRequirements.d.ts +4 -4
  340. package/api/procedures/setAssetRequirements.d.ts.map +1 -1
  341. package/api/procedures/setAssetRequirements.js +4 -4
  342. package/api/procedures/setAssetRequirements.js.map +1 -1
  343. package/api/procedures/setMetadata.d.ts.map +1 -1
  344. package/api/procedures/setMetadata.js +1 -1
  345. package/api/procedures/setMetadata.js.map +1 -1
  346. package/api/procedures/setPermissionGroup.d.ts +2 -2
  347. package/api/procedures/setPermissionGroup.d.ts.map +1 -1
  348. package/api/procedures/setPermissionGroup.js +1 -1
  349. package/api/procedures/setPermissionGroup.js.map +1 -1
  350. package/api/procedures/setTransferRestrictions.d.ts +1 -1
  351. package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
  352. package/api/procedures/setTransferRestrictions.js +2 -2
  353. package/api/procedures/setTransferRestrictions.js.map +1 -1
  354. package/api/procedures/setVenueFiltering.d.ts.map +1 -1
  355. package/api/procedures/setVenueFiltering.js +1 -1
  356. package/api/procedures/setVenueFiltering.js.map +1 -1
  357. package/api/procedures/toggleFreezeOffering.d.ts.map +1 -1
  358. package/api/procedures/toggleFreezeOffering.js +1 -1
  359. package/api/procedures/toggleFreezeOffering.js.map +1 -1
  360. package/api/procedures/toggleFreezeTransfers.d.ts +4 -4
  361. package/api/procedures/toggleFreezeTransfers.d.ts.map +1 -1
  362. package/api/procedures/toggleFreezeTransfers.js +4 -4
  363. package/api/procedures/toggleFreezeTransfers.js.map +1 -1
  364. package/api/procedures/togglePauseRequirements.d.ts +4 -4
  365. package/api/procedures/togglePauseRequirements.d.ts.map +1 -1
  366. package/api/procedures/togglePauseRequirements.js +2 -2
  367. package/api/procedures/togglePauseRequirements.js.map +1 -1
  368. package/api/procedures/transferAssetOwnership.d.ts.map +1 -1
  369. package/api/procedures/transferAssetOwnership.js +1 -1
  370. package/api/procedures/transferAssetOwnership.js.map +1 -1
  371. package/api/procedures/types.d.ts +82 -13
  372. package/api/procedures/types.d.ts.map +1 -1
  373. package/api/procedures/types.js.map +1 -1
  374. package/api/procedures/utils.d.ts +10 -4
  375. package/api/procedures/utils.d.ts.map +1 -1
  376. package/api/procedures/utils.js +19 -2
  377. package/api/procedures/utils.js.map +1 -1
  378. package/api/procedures/waivePermissions.d.ts +2 -2
  379. package/api/procedures/waivePermissions.d.ts.map +1 -1
  380. package/api/procedures/waivePermissions.js +1 -1
  381. package/api/procedures/waivePermissions.js.map +1 -1
  382. package/base/Context.d.ts +2 -2
  383. package/base/Context.d.ts.map +1 -1
  384. package/base/Context.js +24 -24
  385. package/base/Context.js.map +1 -1
  386. package/base/PolymeshTransactionBatch.js +2 -2
  387. package/base/PolymeshTransactionBatch.js.map +1 -1
  388. package/base/Procedure.js.map +1 -1
  389. package/generated/types.d.ts +5 -1
  390. package/generated/types.d.ts.map +1 -1
  391. package/generated/types.js +4 -0
  392. package/generated/types.js.map +1 -1
  393. package/internal.d.ts +6 -2
  394. package/internal.d.ts.map +1 -1
  395. package/internal.js +16 -5
  396. package/internal.js.map +1 -1
  397. package/middleware/queries.d.ts +19 -2
  398. package/middleware/queries.d.ts.map +1 -1
  399. package/middleware/queries.js +104 -6
  400. package/middleware/queries.js.map +1 -1
  401. package/middleware/types.d.ts +68950 -15292
  402. package/middleware/types.d.ts.map +1 -1
  403. package/middleware/types.js +36222 -999
  404. package/middleware/types.js.map +1 -1
  405. package/middleware/typesV1.d.ts +1 -1
  406. package/middleware/typesV1.d.ts.map +1 -1
  407. package/npm-package/polymeshassociation-polymesh-sdk-23.0.0-alpha.31.tgz +0 -0
  408. package/package.json +2 -2
  409. package/polkadot/augment-api-errors.d.ts +4 -18
  410. package/polkadot/augment-api-errors.d.ts.map +1 -1
  411. package/polkadot/augment-api-events.d.ts +0 -6
  412. package/polkadot/augment-api-events.d.ts.map +1 -1
  413. package/polkadot/augment-api-query.d.ts +33 -26
  414. package/polkadot/augment-api-query.d.ts.map +1 -1
  415. package/polkadot/augment-api-tx.d.ts +123 -51
  416. package/polkadot/augment-api-tx.d.ts.map +1 -1
  417. package/polkadot/lookup.d.ts +246 -248
  418. package/polkadot/lookup.d.ts.map +1 -1
  419. package/polkadot/lookup.js +248 -253
  420. package/polkadot/lookup.js.map +1 -1
  421. package/polkadot/registry.d.ts +3 -5
  422. package/polkadot/registry.d.ts.map +1 -1
  423. package/polkadot/types-lookup.d.ts +251 -248
  424. package/polkadot/types-lookup.d.ts.map +1 -1
  425. package/types/index.d.ts +55 -12
  426. package/types/index.d.ts.map +1 -1
  427. package/types/index.js +24 -2
  428. package/types/index.js.map +1 -1
  429. package/types/internal.d.ts +7 -2
  430. package/types/internal.d.ts.map +1 -1
  431. package/types/internal.js.map +1 -1
  432. package/utils/constants.d.ts +16 -0
  433. package/utils/constants.d.ts.map +1 -1
  434. package/utils/constants.js +17 -1
  435. package/utils/constants.js.map +1 -1
  436. package/utils/conversion.d.ts +74 -17
  437. package/utils/conversion.d.ts.map +1 -1
  438. package/utils/conversion.js +514 -365
  439. package/utils/conversion.js.map +1 -1
  440. package/utils/internal.d.ts +60 -7
  441. package/utils/internal.d.ts.map +1 -1
  442. package/utils/internal.js +200 -63
  443. package/utils/internal.js.map +1 -1
  444. package/utils/typeguards.d.ts +34 -6
  445. package/utils/typeguards.d.ts.map +1 -1
  446. package/utils/typeguards.js +52 -8
  447. package/utils/typeguards.js.map +1 -1
  448. package/api/entities/Asset/AssetHolders.d.ts.map +0 -1
  449. package/api/entities/Asset/AssetHolders.js.map +0 -1
  450. package/api/entities/Asset/Checkpoints/Schedules.d.ts.map +0 -1
  451. package/api/entities/Asset/Checkpoints/Schedules.js.map +0 -1
  452. package/api/entities/Asset/Checkpoints/index.d.ts.map +0 -1
  453. package/api/entities/Asset/Checkpoints/index.js.map +0 -1
  454. package/api/entities/Asset/Checkpoints/types.d.ts.map +0 -1
  455. package/api/entities/Asset/Checkpoints/types.js.map +0 -1
  456. package/api/entities/Asset/Compliance/Requirements.d.ts.map +0 -1
  457. package/api/entities/Asset/Compliance/Requirements.js.map +0 -1
  458. package/api/entities/Asset/Compliance/TrustedClaimIssuers.d.ts.map +0 -1
  459. package/api/entities/Asset/Compliance/TrustedClaimIssuers.js.map +0 -1
  460. package/api/entities/Asset/Compliance/index.d.ts.map +0 -1
  461. package/api/entities/Asset/Compliance/index.js.map +0 -1
  462. package/api/entities/Asset/CorporateActions/Distributions.d.ts.map +0 -1
  463. package/api/entities/Asset/CorporateActions/Distributions.js.map +0 -1
  464. package/api/entities/Asset/CorporateActions/index.d.ts.map +0 -1
  465. package/api/entities/Asset/CorporateActions/index.js.map +0 -1
  466. package/api/entities/Asset/CorporateActions/types.d.ts.map +0 -1
  467. package/api/entities/Asset/CorporateActions/types.js.map +0 -1
  468. package/api/entities/Asset/Documents.d.ts.map +0 -1
  469. package/api/entities/Asset/Documents.js.map +0 -1
  470. package/api/entities/Asset/Issuance.d.ts.map +0 -1
  471. package/api/entities/Asset/Issuance.js.map +0 -1
  472. package/api/entities/Asset/Metadata.d.ts.map +0 -1
  473. package/api/entities/Asset/Metadata.js.map +0 -1
  474. package/api/entities/Asset/Offerings.d.ts.map +0 -1
  475. package/api/entities/Asset/Offerings.js.map +0 -1
  476. package/api/entities/Asset/Permissions.d.ts.map +0 -1
  477. package/api/entities/Asset/Permissions.js.map +0 -1
  478. package/api/entities/Asset/Settlements.d.ts +0 -29
  479. package/api/entities/Asset/Settlements.d.ts.map +0 -1
  480. package/api/entities/Asset/Settlements.js +0 -70
  481. package/api/entities/Asset/Settlements.js.map +0 -1
  482. package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts.map +0 -1
  483. package/api/entities/Asset/TransferRestrictions/ClaimCount.js.map +0 -1
  484. package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts.map +0 -1
  485. package/api/entities/Asset/TransferRestrictions/ClaimPercentage.js.map +0 -1
  486. package/api/entities/Asset/TransferRestrictions/Count.d.ts.map +0 -1
  487. package/api/entities/Asset/TransferRestrictions/Count.js.map +0 -1
  488. package/api/entities/Asset/TransferRestrictions/Percentage.d.ts.map +0 -1
  489. package/api/entities/Asset/TransferRestrictions/Percentage.js.map +0 -1
  490. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.d.ts.map +0 -1
  491. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js.map +0 -1
  492. package/api/entities/Asset/TransferRestrictions/index.d.ts.map +0 -1
  493. package/api/entities/Asset/TransferRestrictions/index.js.map +0 -1
  494. package/middleware/enums.d.ts +0 -3
  495. package/middleware/enums.d.ts.map +0 -1
  496. package/middleware/enums.js +0 -38
  497. package/middleware/enums.js.map +0 -1
  498. package/npm-package/polymeshassociation-polymesh-sdk-23.0.0-alpha.3.tgz +0 -0
  499. /package/api/entities/Asset/{Checkpoints → Fungible/Checkpoints}/types.js +0 -0
  500. /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,IAAI,2CAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpE,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,gBAAgB,GAAG,IAA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AS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;KAAA;CAMF;AA7QD,sCA6QC"}
@@ -0,0 +1,110 @@
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. Each NFT belongs to an NftCollection, which specifies the expected metadata values for each NFT
14
+ */
15
+ export declare class Nft extends Entity<NftUniqueIdentifiers, HumanReadable> {
16
+ id: BigNumber;
17
+ /**
18
+ * The {@link api/entities/Asset/NonFungible/NftCollection | NftCollection} this NFT belongs to
19
+ */
20
+ collection: NftCollection;
21
+ /**
22
+ * Redeem (or "burns") the NFT, removing it from circulation
23
+ */
24
+ redeem: OptionalArgsProcedureMethod<RedeemNftParams, void>;
25
+ /**
26
+ * @hidden
27
+ * Check if a value is of type {@link UniqueIdentifiers}
28
+ */
29
+ static isUniqueIdentifiers(identifier: unknown): identifier is NftUniqueIdentifiers;
30
+ /**
31
+ * @hidden
32
+ */
33
+ constructor(identifiers: NftUniqueIdentifiers, context: Context);
34
+ /**
35
+ * Get metadata associated with this token
36
+ */
37
+ getMetadata(): Promise<NftMetadata[]>;
38
+ /**
39
+ * Determine if the NFT exists on chain
40
+ *
41
+ * @note This method returns true, even if the token has been redeemed/burned
42
+ */
43
+ exists(): Promise<boolean>;
44
+ /**
45
+ * Get the conventional image URI for the NFT
46
+ *
47
+ * This function will check for a token level value and a collection level value. Token level values take precedence over base values in case of a conflict.
48
+ *
49
+ * When creating a collection an issuer can either require per token images by specifying global metadata key `imageUri` as a collection key or by
50
+ * setting a collection base image URL by setting a value on the collection corresponding to the global metadata key `baseImageUri`.
51
+ *
52
+ * This method will return `null` if the NFT issuer did not configure the collection according to the convention.
53
+ *
54
+ * Per token URIs provide the most flexibility, but require more chain space to store, increasing the POLYX fee to issue each token.
55
+ *
56
+ * The URI values can include `{tokenId}` that will be replaced with the NFTs ID. If a base URI does not specify this the ID will be appended onto the URL. Examples:
57
+ * - `https://example.com/nfts/{tokenId}/image.png` becomes `https://example.com/nfts/1/image.png`
58
+ * - `https://example.com/nfts` becomes `https://example.com/nfts/1` if used a base value, but remain unchanged as a local value
59
+ */
60
+ getImageUri(): Promise<string | null>;
61
+ /**
62
+ * Get the conventional token URI for the NFT
63
+ *
64
+ * This function will check for a token level value and a collection level value. Token level values take precedence over base values in case of a conflict.
65
+ *
66
+ * When creating a collection an issuer can either require per token URL by specifying global metadata key `tokenURI` as a collection key or by
67
+ * setting a collection base URL by setting a value on the collection corresponding to the global metadata key `baseTokenUri` on the collection.
68
+ *
69
+ * This method will return `null` if the NFT issuer did not configure the collection according to the convention.
70
+ *
71
+ * Per token URIs provide the most flexibility, but require more chain space to store, increasing the POLYX fee to issue each token.
72
+ *
73
+ * The URI values can include `{tokenId}` that will be replaced with the NFTs ID. If a base URI does not specify this the ID will be appended onto the URL. Examples:
74
+ * - `https://example.com/nfts/{tokenId}/info.json` becomes `https://example.com/nfts/1/info.json`
75
+ * - `https://example.com/nfts` becomes `https://example.com/nfts/1` if used a base value, but remain unchanged as a local value
76
+ */
77
+ getTokenUri(): Promise<string | null>;
78
+ /**
79
+ * @hidden
80
+ */
81
+ toHuman(): HumanReadable;
82
+ /**
83
+ * given a global metadata ID fetches a local URI value
84
+ *
85
+ * @hidden
86
+ */
87
+ private getLocalUri;
88
+ /**
89
+ *
90
+ * given a global metadata ID fetches a base URI value
91
+ *
92
+ * @hidden
93
+ */
94
+ private getBaseUri;
95
+ /**
96
+ * @hidden
97
+ */
98
+ private templateId;
99
+ /**
100
+ * @hidden
101
+ */
102
+ private templateBaseUri;
103
+ /**
104
+ * helper to lookup global metadata ID by name
105
+ *
106
+ * @hidden
107
+ */
108
+ private getGlobalMetadataId;
109
+ }
110
+ //# 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;AAgBpF,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;IAErB;;OAEG;IACI,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;IACU,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAoBlD;;;;;;;;;;;;;;;OAeG;IACU,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAoBlD;;OAEG;IACI,OAAO,IAAI,aAAa;IAY/B;;;;OAIG;YACW,WAAW;IA+BzB;;;;;OAKG;YACW,UAAU;IAyBxB;;OAEG;IACH,OAAO,CAAC,UAAU;IAMlB;;OAEG;IACH,OAAO,CAAC,eAAe;IAcvB;;;;OAIG;YACW,mBAAmB;CAclC"}
@@ -0,0 +1,243 @@
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 constants_1 = require("../../../../utils/constants");
19
+ const conversion_1 = require("../../../../utils/conversion");
20
+ const internal_2 = require("../../../../utils/internal");
21
+ /**
22
+ * Class used to manage Nft functionality. Each NFT belongs to an NftCollection, which specifies the expected metadata values for each NFT
23
+ */
24
+ class Nft extends internal_1.Entity {
25
+ /**
26
+ * @hidden
27
+ */
28
+ constructor(identifiers, context) {
29
+ super(identifiers, context);
30
+ const { ticker, id } = identifiers;
31
+ this.id = id;
32
+ this.collection = new internal_1.NftCollection({ ticker }, context);
33
+ this.redeem = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.redeemNft, Object.assign({ ticker, id }, args)], optionalArgs: true }, context);
34
+ }
35
+ /**
36
+ * @hidden
37
+ * Check if a value is of type {@link UniqueIdentifiers}
38
+ */
39
+ static isUniqueIdentifiers(identifier) {
40
+ const { ticker, id } = identifier;
41
+ return typeof ticker === 'string' && id instanceof bignumber_js_1.default;
42
+ }
43
+ /**
44
+ * Get metadata associated with this token
45
+ */
46
+ getMetadata() {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const { id, context, collection, context: { polymeshApi: { query }, }, } = this;
49
+ const collectionId = yield collection.getCollectionId();
50
+ const rawCollectionId = (0, conversion_1.bigNumberToU64)(collectionId, context);
51
+ const rawId = (0, conversion_1.bigNumberToU64)(id, context);
52
+ const entries = yield query.nft.metadataValue.entries([rawCollectionId, rawId]);
53
+ return entries.map(([storageKey, rawValue]) => {
54
+ const rawMetadataKey = storageKey.args[1];
55
+ const key = (0, conversion_1.meshMetadataKeyToMetadataKey)(rawMetadataKey, collection.ticker);
56
+ const value = (0, conversion_1.bytesToString)(rawValue);
57
+ return { key, value };
58
+ });
59
+ });
60
+ }
61
+ /**
62
+ * Determine if the NFT exists on chain
63
+ *
64
+ * @note This method returns true, even if the token has been redeemed/burned
65
+ */
66
+ exists() {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const { context, context: { polymeshApi: { query }, }, collection, id, } = this;
69
+ const collectionId = yield collection.getCollectionId();
70
+ const rawCollectionId = (0, conversion_1.bigNumberToU64)(collectionId, context);
71
+ // note: "nextId" is actually the last used id
72
+ const rawNextId = yield query.nft.nextNFTId(rawCollectionId);
73
+ const nextId = (0, conversion_1.u64ToBigNumber)(rawNextId);
74
+ return id.lte(nextId);
75
+ });
76
+ }
77
+ /**
78
+ * Get the conventional image URI for the NFT
79
+ *
80
+ * This function will check for a token level value and a collection level value. Token level values take precedence over base values in case of a conflict.
81
+ *
82
+ * When creating a collection an issuer can either require per token images by specifying global metadata key `imageUri` as a collection key or by
83
+ * setting a collection base image URL by setting a value on the collection corresponding to the global metadata key `baseImageUri`.
84
+ *
85
+ * This method will return `null` if the NFT issuer did not configure the collection according to the convention.
86
+ *
87
+ * Per token URIs provide the most flexibility, but require more chain space to store, increasing the POLYX fee to issue each token.
88
+ *
89
+ * The URI values can include `{tokenId}` that will be replaced with the NFTs ID. If a base URI does not specify this the ID will be appended onto the URL. Examples:
90
+ * - `https://example.com/nfts/{tokenId}/image.png` becomes `https://example.com/nfts/1/image.png`
91
+ * - `https://example.com/nfts` becomes `https://example.com/nfts/1` if used a base value, but remain unchanged as a local value
92
+ */
93
+ getImageUri() {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const [localId, collectionId] = yield Promise.all([
96
+ this.getGlobalMetadataId(constants_1.GLOBAL_IMAGE_URI_NAME),
97
+ this.getGlobalMetadataId(constants_1.GLOBAL_BASE_IMAGE_URI_NAME),
98
+ ]);
99
+ const [localImageUrl, collectionBaseImageUrl] = yield Promise.all([
100
+ this.getLocalUri(localId),
101
+ this.getBaseUri(collectionId),
102
+ ]);
103
+ if (localImageUrl) {
104
+ return localImageUrl;
105
+ }
106
+ else if (collectionBaseImageUrl) {
107
+ return collectionBaseImageUrl;
108
+ }
109
+ return null;
110
+ });
111
+ }
112
+ /**
113
+ * Get the conventional token URI for the NFT
114
+ *
115
+ * This function will check for a token level value and a collection level value. Token level values take precedence over base values in case of a conflict.
116
+ *
117
+ * When creating a collection an issuer can either require per token URL by specifying global metadata key `tokenURI` as a collection key or by
118
+ * setting a collection base URL by setting a value on the collection corresponding to the global metadata key `baseTokenUri` on the collection.
119
+ *
120
+ * This method will return `null` if the NFT issuer did not configure the collection according to the convention.
121
+ *
122
+ * Per token URIs provide the most flexibility, but require more chain space to store, increasing the POLYX fee to issue each token.
123
+ *
124
+ * The URI values can include `{tokenId}` that will be replaced with the NFTs ID. If a base URI does not specify this the ID will be appended onto the URL. Examples:
125
+ * - `https://example.com/nfts/{tokenId}/info.json` becomes `https://example.com/nfts/1/info.json`
126
+ * - `https://example.com/nfts` becomes `https://example.com/nfts/1` if used a base value, but remain unchanged as a local value
127
+ */
128
+ getTokenUri() {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ const [localId, baseId] = yield Promise.all([
131
+ this.getGlobalMetadataId(constants_1.GLOBAL_TOKEN_URI_NAME),
132
+ this.getGlobalMetadataId(constants_1.GLOBAL_BASE_TOKEN_URI_NAME),
133
+ ]);
134
+ const [localTokenUri, baseUri] = yield Promise.all([
135
+ this.getLocalUri(localId),
136
+ this.getBaseUri(baseId),
137
+ ]);
138
+ if (localTokenUri) {
139
+ return localTokenUri;
140
+ }
141
+ else if (baseUri) {
142
+ return baseUri;
143
+ }
144
+ return null;
145
+ });
146
+ }
147
+ /**
148
+ * @hidden
149
+ */
150
+ toHuman() {
151
+ const { collection: { ticker }, id, } = this;
152
+ return {
153
+ collection: ticker,
154
+ id: id.toString(),
155
+ };
156
+ }
157
+ /**
158
+ * given a global metadata ID fetches a local URI value
159
+ *
160
+ * @hidden
161
+ */
162
+ getLocalUri(metadataId) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ const { id, context, collection, context: { polymeshApi: { query }, }, } = this;
165
+ if (!metadataId) {
166
+ return null;
167
+ }
168
+ const collectionId = yield collection.getCollectionId();
169
+ const rawCollectionId = (0, conversion_1.bigNumberToU64)(collectionId, context);
170
+ const rawNftId = (0, conversion_1.bigNumberToU64)(id, context);
171
+ const rawNftValue = yield query.nft.metadataValue([rawCollectionId, rawNftId], {
172
+ Global: (0, conversion_1.bigNumberToU64)(metadataId, context),
173
+ });
174
+ const nftValue = (0, conversion_1.bytesToString)(rawNftValue);
175
+ if (nftValue === '') {
176
+ return null;
177
+ }
178
+ return this.templateId(nftValue);
179
+ });
180
+ }
181
+ /**
182
+ *
183
+ * given a global metadata ID fetches a base URI value
184
+ *
185
+ * @hidden
186
+ */
187
+ getBaseUri(metadataId) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ const { collection: { ticker }, context, context: { polymeshApi: { query }, }, } = this;
190
+ if (!metadataId) {
191
+ return null;
192
+ }
193
+ const rawId = (0, conversion_1.bigNumberToU64)(metadataId, context);
194
+ const rawTicker = (0, conversion_1.stringToTicker)(ticker, context);
195
+ const rawValue = yield query.asset.assetMetadataValues(rawTicker, { Global: rawId });
196
+ if (rawValue.isNone) {
197
+ return null;
198
+ }
199
+ const baseUrl = (0, conversion_1.bytesToString)(rawValue.unwrap());
200
+ return this.templateBaseUri(baseUrl);
201
+ });
202
+ }
203
+ /**
204
+ * @hidden
205
+ */
206
+ templateId(input) {
207
+ const { id } = this;
208
+ return input.replace('{tokenId}', id.toString());
209
+ }
210
+ /**
211
+ * @hidden
212
+ */
213
+ templateBaseUri(input) {
214
+ const { id } = this;
215
+ const templatedPath = this.templateId(input);
216
+ if (input !== templatedPath) {
217
+ return templatedPath;
218
+ }
219
+ else if (input.endsWith('/')) {
220
+ return `${input}${id.toString()}`;
221
+ }
222
+ else {
223
+ return `${input}/${id.toString()}`;
224
+ }
225
+ }
226
+ /**
227
+ * helper to lookup global metadata ID by name
228
+ *
229
+ * @hidden
230
+ */
231
+ getGlobalMetadataId(keyName) {
232
+ return __awaiter(this, void 0, void 0, function* () {
233
+ const { context: { polymeshApi: { query }, }, } = this;
234
+ const metadataId = yield query.asset.assetMetadataGlobalNameToKey(keyName);
235
+ if (metadataId.isSome) {
236
+ return (0, conversion_1.u64ToBigNumber)(metadataId.unwrap());
237
+ }
238
+ return null;
239
+ });
240
+ }
241
+ }
242
+ exports.Nft = Nft;
243
+ //# 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,2DAK2B;AAC3B,6DAM4B;AAC5B,yDAAyD;AAYzD;;GAEG;AACH,MAAa,GAAI,SAAQ,iBAA2C;IAyBlE;;OAEG;IACH,YAAY,WAAiC,EAAE,OAAgB;QAC7D,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAE5B,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GA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E,EAAE,EAAE,GAAG,IAAI,CAAC;QAEpB,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,KAAa;QACnC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;QAEpB,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,KAAK,KAAK,aAAa,EAAE;YAC3B,OAAO,aAAa,CAAC;SACtB;aAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC9B,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;SACnC;aAAM;YACL,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;SACpC;IACH,CAAC;IAED;;;;OAIG;IACW,mBAAmB,CAAC,OAAe;;YAC/C,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EAAE,KAAK,EAAE,GACvB,GACF,GAAG,IAAI,CAAC;YAET,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;YAE3E,IAAI,UAAU,CAAC,MAAM,EAAE;gBACrB,OAAO,IAAA,2BAAc,EAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;aAC5C;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF;AAvSD,kBAuSC"}
@@ -0,0 +1,69 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { BaseAsset } from "../Base";
3
+ import { NonFungibleSettlements } from "../Base/Settlements";
4
+ import { Context, Nft } from "../../../../internal";
5
+ import { AssetDetails, CollectionKey, EventIdentifier, IssueNftParams, ProcedureMethod, SubCallback, UniqueIdentifiers, UnsubCallback } from "../../../../types";
6
+ /**
7
+ * Class used to manage NFT functionality
8
+ */
9
+ export declare class NftCollection extends BaseAsset {
10
+ settlements: NonFungibleSettlements;
11
+ /**
12
+ * Issues a new NFT for the collection
13
+ *
14
+ * @note Each NFT requires metadata for each value returned by `collectionKeys`. The SDK and chain only validate the presence of these fields. Additional validation may be needed to ensure each value complies with the specification.
15
+ */
16
+ issue: ProcedureMethod<IssueNftParams, Nft>;
17
+ /**
18
+ * Local cache for `getCollectionId`
19
+ *
20
+ * @hidden
21
+ */
22
+ private _id?;
23
+ /**
24
+ * @hidden
25
+ */
26
+ constructor(identifiers: UniqueIdentifiers, context: Context);
27
+ /**
28
+ * Retrieve the NftCollection's data
29
+ *
30
+ * @note can be subscribed to
31
+ */
32
+ details(): Promise<AssetDetails>;
33
+ details(callback: SubCallback<AssetDetails>): Promise<UnsubCallback>;
34
+ /**
35
+ * Retrieve the metadata that defines the NFT collection. Every `issue` call for this collection must provide a value for each element returned
36
+ *
37
+ * @note Each NFT **must** have an entry for each value, it **should** comply with the spec.
38
+ * In other words, the SDK only validates the presence of metadata keys, additional validation should be used when issuing
39
+ */
40
+ collectionKeys(): Promise<CollectionKey[]>;
41
+ /**
42
+ * Retrieve the amount of unique investors that hold this Nft
43
+ */
44
+ investorCount(): Promise<BigNumber>;
45
+ /**
46
+ * Get an NFT belonging to this collection
47
+ *
48
+ * @throws if the given NFT does not exist
49
+ */
50
+ getNft(args: {
51
+ id: BigNumber;
52
+ }): Promise<Nft>;
53
+ /**
54
+ * Retrieve the identifier data (block number, date and event index) of the event that was emitted when the token was created
55
+ *
56
+ * @note uses the middlewareV2
57
+ * @note there is a possibility that the data is not ready by the time it is requested. In that case, `null` is returned
58
+ */
59
+ createdAt(): Promise<EventIdentifier | null>;
60
+ /**
61
+ * Determine whether this NftCollection exists on chain
62
+ */
63
+ exists(): Promise<boolean>;
64
+ /**
65
+ * Returns the collection's on chain numeric ID. Used primarily to access NFT specific storage values
66
+ */
67
+ getCollectionId(): Promise<BigNumber>;
68
+ }
69
+ //# 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;AAE/E,OAAO,EAAE,OAAO,EAAE,GAAG,EAAyC,6BAAmB;AAGjF,OAAO,EACL,YAAY,EACZ,aAAa,EAEb,eAAe,EACf,cAAc,EAEd,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,GAAG,CAAC,CAAY;IAExB;;OAEG;gBACS,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO;IAmB5D;;;;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,cAAc,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAsCvD;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,SAAS,CAAC;IAkBhD;;;;OAIG;IACU,MAAM,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,SAAS,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAkB1D;;;;;OAKG;IACU,SAAS,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAkBzD;;OAEG;IACmB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAUhD;;OAEG;IACU,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC;CAoBnD"}