@polymeshassociation/polymesh-sdk 16.0.0-alpha.1 → 16.0.0-beta.1

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 (440) hide show
  1. package/CHANGELOG.md +6 -6
  2. package/README.md +3 -3
  3. package/api/client/AccountManagement.d.ts +12 -3
  4. package/api/client/AccountManagement.d.ts.map +1 -1
  5. package/api/client/AccountManagement.js +14 -3
  6. package/api/client/AccountManagement.js.map +1 -1
  7. package/api/client/Network.d.ts +3 -3
  8. package/api/client/Network.d.ts.map +1 -1
  9. package/api/client/Network.js +7 -11
  10. package/api/client/Network.js.map +1 -1
  11. package/api/client/Polymesh.d.ts +3 -37
  12. package/api/client/Polymesh.d.ts.map +1 -1
  13. package/api/client/Polymesh.js +3 -4
  14. package/api/client/Polymesh.js.map +1 -1
  15. package/api/entities/Account.d.ts +5 -5
  16. package/api/entities/Account.d.ts.map +1 -1
  17. package/api/entities/Account.js +18 -10
  18. package/api/entities/Account.js.map +1 -1
  19. package/api/entities/Asset/Checkpoints/Schedules.d.ts +1 -1
  20. package/api/entities/Asset/Settlements.d.ts +2 -2
  21. package/api/entities/Asset/Settlements.js +2 -2
  22. package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts +0 -3
  23. package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts.map +1 -1
  24. package/api/entities/Asset/TransferRestrictions/ClaimCount.js.map +1 -1
  25. package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts +0 -3
  26. package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts.map +1 -1
  27. package/api/entities/Asset/TransferRestrictions/ClaimPercentage.js.map +1 -1
  28. package/api/entities/Asset/TransferRestrictions/Count.d.ts +0 -3
  29. package/api/entities/Asset/TransferRestrictions/Count.d.ts.map +1 -1
  30. package/api/entities/Asset/TransferRestrictions/Count.js.map +1 -1
  31. package/api/entities/Asset/TransferRestrictions/Percentage.d.ts +0 -3
  32. package/api/entities/Asset/TransferRestrictions/Percentage.d.ts.map +1 -1
  33. package/api/entities/Asset/TransferRestrictions/Percentage.js.map +1 -1
  34. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.d.ts.map +1 -1
  35. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js +10 -11
  36. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js.map +1 -1
  37. package/api/entities/DividendDistribution/index.d.ts.map +1 -1
  38. package/api/entities/DividendDistribution/index.js +2 -2
  39. package/api/entities/DividendDistribution/index.js.map +1 -1
  40. package/api/entities/MultiSig/index.d.ts +26 -0
  41. package/api/entities/MultiSig/index.d.ts.map +1 -0
  42. package/api/entities/MultiSig/index.js +75 -0
  43. package/api/entities/MultiSig/index.js.map +1 -0
  44. package/api/entities/MultiSig/types.d.ts +7 -0
  45. package/api/entities/MultiSig/types.d.ts.map +1 -0
  46. package/api/entities/MultiSig/types.js +3 -0
  47. package/api/entities/MultiSig/types.js.map +1 -0
  48. package/api/entities/MultiSigProposal/index.d.ts +36 -0
  49. package/api/entities/MultiSigProposal/index.d.ts.map +1 -0
  50. package/api/entities/MultiSigProposal/index.js +93 -0
  51. package/api/entities/MultiSigProposal/index.js.map +1 -0
  52. package/api/entities/MultiSigProposal/types.d.ts +41 -0
  53. package/api/entities/MultiSigProposal/types.d.ts.map +1 -0
  54. package/api/entities/MultiSigProposal/types.js +13 -0
  55. package/api/entities/MultiSigProposal/types.js.map +1 -0
  56. package/api/entities/types.d.ts +4 -1
  57. package/api/entities/types.d.ts.map +1 -1
  58. package/api/entities/types.js +2 -0
  59. package/api/entities/types.js.map +1 -1
  60. package/api/procedures/addAssetRequirement.d.ts +2 -2
  61. package/api/procedures/addAssetRequirement.d.ts.map +1 -1
  62. package/api/procedures/addAssetRequirement.js +3 -3
  63. package/api/procedures/addAssetRequirement.js.map +1 -1
  64. package/api/procedures/addAssetStat.d.ts +2 -2
  65. package/api/procedures/addAssetStat.d.ts.map +1 -1
  66. package/api/procedures/addAssetStat.js +8 -6
  67. package/api/procedures/addAssetStat.js.map +1 -1
  68. package/api/procedures/addInstruction.d.ts +4 -4
  69. package/api/procedures/addInstruction.d.ts.map +1 -1
  70. package/api/procedures/addInstruction.js +8 -4
  71. package/api/procedures/addInstruction.js.map +1 -1
  72. package/api/procedures/addInvestorUniquenessClaim.d.ts +2 -2
  73. package/api/procedures/addInvestorUniquenessClaim.d.ts.map +1 -1
  74. package/api/procedures/addInvestorUniquenessClaim.js +4 -6
  75. package/api/procedures/addInvestorUniquenessClaim.js.map +1 -1
  76. package/api/procedures/addTransferRestriction.d.ts +2 -2
  77. package/api/procedures/addTransferRestriction.d.ts.map +1 -1
  78. package/api/procedures/addTransferRestriction.js +19 -16
  79. package/api/procedures/addTransferRestriction.js.map +1 -1
  80. package/api/procedures/claimClassicTicker.d.ts +1 -2
  81. package/api/procedures/claimClassicTicker.d.ts.map +1 -1
  82. package/api/procedures/claimClassicTicker.js +3 -3
  83. package/api/procedures/claimClassicTicker.js.map +1 -1
  84. package/api/procedures/claimDividends.d.ts +1 -2
  85. package/api/procedures/claimDividends.d.ts.map +1 -1
  86. package/api/procedures/claimDividends.js +2 -3
  87. package/api/procedures/claimDividends.js.map +1 -1
  88. package/api/procedures/closeOffering.d.ts +2 -2
  89. package/api/procedures/closeOffering.d.ts.map +1 -1
  90. package/api/procedures/closeOffering.js +2 -3
  91. package/api/procedures/closeOffering.js.map +1 -1
  92. package/api/procedures/configureDividendDistribution.d.ts +3 -3
  93. package/api/procedures/configureDividendDistribution.d.ts.map +1 -1
  94. package/api/procedures/configureDividendDistribution.js +4 -3
  95. package/api/procedures/configureDividendDistribution.js.map +1 -1
  96. package/api/procedures/consumeAddMultiSigSignerAuthorization.d.ts +2 -2
  97. package/api/procedures/consumeAddMultiSigSignerAuthorization.d.ts.map +1 -1
  98. package/api/procedures/consumeAddMultiSigSignerAuthorization.js +4 -3
  99. package/api/procedures/consumeAddMultiSigSignerAuthorization.js.map +1 -1
  100. package/api/procedures/consumeAuthorizationRequests.d.ts +2 -2
  101. package/api/procedures/consumeAuthorizationRequests.d.ts.map +1 -1
  102. package/api/procedures/consumeAuthorizationRequests.js +4 -8
  103. package/api/procedures/consumeAuthorizationRequests.js.map +1 -1
  104. package/api/procedures/consumeJoinOrRotateAuthorization.d.ts +2 -2
  105. package/api/procedures/consumeJoinOrRotateAuthorization.d.ts.map +1 -1
  106. package/api/procedures/consumeJoinOrRotateAuthorization.js +7 -8
  107. package/api/procedures/consumeJoinOrRotateAuthorization.js.map +1 -1
  108. package/api/procedures/controllerTransfer.d.ts +2 -2
  109. package/api/procedures/controllerTransfer.d.ts.map +1 -1
  110. package/api/procedures/controllerTransfer.js +2 -3
  111. package/api/procedures/controllerTransfer.js.map +1 -1
  112. package/api/procedures/createAsset.d.ts +2 -2
  113. package/api/procedures/createAsset.d.ts.map +1 -1
  114. package/api/procedures/createAsset.js +41 -21
  115. package/api/procedures/createAsset.js.map +1 -1
  116. package/api/procedures/createCheckpoint.d.ts +3 -3
  117. package/api/procedures/createCheckpoint.d.ts.map +1 -1
  118. package/api/procedures/createCheckpoint.js +4 -3
  119. package/api/procedures/createCheckpoint.js.map +1 -1
  120. package/api/procedures/createCheckpointSchedule.d.ts +3 -3
  121. package/api/procedures/createCheckpointSchedule.d.ts.map +1 -1
  122. package/api/procedures/createCheckpointSchedule.js +4 -3
  123. package/api/procedures/createCheckpointSchedule.js.map +1 -1
  124. package/api/procedures/createGroup.d.ts +3 -3
  125. package/api/procedures/createGroup.d.ts.map +1 -1
  126. package/api/procedures/createGroup.js +4 -3
  127. package/api/procedures/createGroup.js.map +1 -1
  128. package/api/procedures/createMultiSig.d.ts +13 -0
  129. package/api/procedures/createMultiSig.d.ts.map +1 -0
  130. package/api/procedures/createMultiSig.js +56 -0
  131. package/api/procedures/createMultiSig.js.map +1 -0
  132. package/api/procedures/createPortfolios.d.ts +2 -3
  133. package/api/procedures/createPortfolios.d.ts.map +1 -1
  134. package/api/procedures/createPortfolios.js +6 -4
  135. package/api/procedures/createPortfolios.js.map +1 -1
  136. package/api/procedures/createVenue.d.ts +2 -3
  137. package/api/procedures/createVenue.d.ts.map +1 -1
  138. package/api/procedures/createVenue.js +4 -3
  139. package/api/procedures/createVenue.js.map +1 -1
  140. package/api/procedures/deletePortfolio.d.ts +2 -2
  141. package/api/procedures/deletePortfolio.d.ts.map +1 -1
  142. package/api/procedures/deletePortfolio.js +2 -3
  143. package/api/procedures/deletePortfolio.js.map +1 -1
  144. package/api/procedures/investInOffering.d.ts +2 -2
  145. package/api/procedures/investInOffering.d.ts.map +1 -1
  146. package/api/procedures/investInOffering.js +2 -3
  147. package/api/procedures/investInOffering.js.map +1 -1
  148. package/api/procedures/inviteAccount.d.ts +2 -3
  149. package/api/procedures/inviteAccount.d.ts.map +1 -1
  150. package/api/procedures/inviteAccount.js +4 -3
  151. package/api/procedures/inviteAccount.js.map +1 -1
  152. package/api/procedures/inviteExternalAgent.d.ts +3 -3
  153. package/api/procedures/inviteExternalAgent.d.ts.map +1 -1
  154. package/api/procedures/inviteExternalAgent.js +10 -6
  155. package/api/procedures/inviteExternalAgent.js.map +1 -1
  156. package/api/procedures/issueTokens.d.ts +2 -2
  157. package/api/procedures/issueTokens.d.ts.map +1 -1
  158. package/api/procedures/issueTokens.js +3 -3
  159. package/api/procedures/issueTokens.js.map +1 -1
  160. package/api/procedures/launchOffering.d.ts +3 -3
  161. package/api/procedures/launchOffering.d.ts.map +1 -1
  162. package/api/procedures/launchOffering.js +4 -3
  163. package/api/procedures/launchOffering.js.map +1 -1
  164. package/api/procedures/leaveIdentity.d.ts +1 -2
  165. package/api/procedures/leaveIdentity.d.ts.map +1 -1
  166. package/api/procedures/leaveIdentity.js +1 -1
  167. package/api/procedures/leaveIdentity.js.map +1 -1
  168. package/api/procedures/linkCaDocs.d.ts +2 -2
  169. package/api/procedures/linkCaDocs.d.ts.map +1 -1
  170. package/api/procedures/linkCaDocs.js +2 -3
  171. package/api/procedures/linkCaDocs.js.map +1 -1
  172. package/api/procedures/modifyAllowance.d.ts +2 -2
  173. package/api/procedures/modifyAllowance.d.ts.map +1 -1
  174. package/api/procedures/modifyAllowance.js +2 -3
  175. package/api/procedures/modifyAllowance.js.map +1 -1
  176. package/api/procedures/modifyAsset.d.ts +2 -2
  177. package/api/procedures/modifyAsset.d.ts.map +1 -1
  178. package/api/procedures/modifyAsset.js +4 -3
  179. package/api/procedures/modifyAsset.js.map +1 -1
  180. package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts +2 -2
  181. package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts.map +1 -1
  182. package/api/procedures/modifyAssetTrustedClaimIssuers.js +2 -1
  183. package/api/procedures/modifyAssetTrustedClaimIssuers.js.map +1 -1
  184. package/api/procedures/modifyCaCheckpoint.d.ts +2 -2
  185. package/api/procedures/modifyCaCheckpoint.d.ts.map +1 -1
  186. package/api/procedures/modifyCaCheckpoint.js +3 -19
  187. package/api/procedures/modifyCaCheckpoint.js.map +1 -1
  188. package/api/procedures/modifyCaDefaultConfig.d.ts +2 -2
  189. package/api/procedures/modifyCaDefaultConfig.d.ts.map +1 -1
  190. package/api/procedures/modifyCaDefaultConfig.js +1 -1
  191. package/api/procedures/modifyCaDefaultConfig.js.map +1 -1
  192. package/api/procedures/modifyClaims.d.ts +2 -2
  193. package/api/procedures/modifyClaims.d.ts.map +1 -1
  194. package/api/procedures/modifyClaims.js +3 -2
  195. package/api/procedures/modifyClaims.js.map +1 -1
  196. package/api/procedures/modifyComplianceRequirement.d.ts +2 -2
  197. package/api/procedures/modifyComplianceRequirement.d.ts.map +1 -1
  198. package/api/procedures/modifyComplianceRequirement.js +2 -3
  199. package/api/procedures/modifyComplianceRequirement.js.map +1 -1
  200. package/api/procedures/modifyCorporateActionsAgent.d.ts +2 -2
  201. package/api/procedures/modifyCorporateActionsAgent.d.ts.map +1 -1
  202. package/api/procedures/modifyCorporateActionsAgent.js +2 -3
  203. package/api/procedures/modifyCorporateActionsAgent.js.map +1 -1
  204. package/api/procedures/modifyDistributionCheckpoint.d.ts +25 -0
  205. package/api/procedures/modifyDistributionCheckpoint.d.ts.map +1 -0
  206. package/api/procedures/modifyDistributionCheckpoint.js +60 -0
  207. package/api/procedures/modifyDistributionCheckpoint.js.map +1 -0
  208. package/api/procedures/modifyInstructionAffirmation.d.ts +2 -2
  209. package/api/procedures/modifyInstructionAffirmation.d.ts.map +1 -1
  210. package/api/procedures/modifyInstructionAffirmation.js +10 -9
  211. package/api/procedures/modifyInstructionAffirmation.js.map +1 -1
  212. package/api/procedures/modifyOfferingTimes.d.ts +2 -2
  213. package/api/procedures/modifyOfferingTimes.d.ts.map +1 -1
  214. package/api/procedures/modifyOfferingTimes.js +2 -3
  215. package/api/procedures/modifyOfferingTimes.js.map +1 -1
  216. package/api/procedures/modifyPrimaryIssuanceAgent.d.ts +2 -2
  217. package/api/procedures/modifyPrimaryIssuanceAgent.d.ts.map +1 -1
  218. package/api/procedures/modifyPrimaryIssuanceAgent.js +2 -3
  219. package/api/procedures/modifyPrimaryIssuanceAgent.js.map +1 -1
  220. package/api/procedures/modifySignerPermissions.d.ts +2 -2
  221. package/api/procedures/modifySignerPermissions.d.ts.map +1 -1
  222. package/api/procedures/modifySignerPermissions.js +2 -3
  223. package/api/procedures/modifySignerPermissions.js.map +1 -1
  224. package/api/procedures/modifyVenue.d.ts +2 -2
  225. package/api/procedures/modifyVenue.d.ts.map +1 -1
  226. package/api/procedures/modifyVenue.js +1 -1
  227. package/api/procedures/modifyVenue.js.map +1 -1
  228. package/api/procedures/moveFunds.d.ts +2 -2
  229. package/api/procedures/moveFunds.d.ts.map +1 -1
  230. package/api/procedures/moveFunds.js +2 -3
  231. package/api/procedures/moveFunds.js.map +1 -1
  232. package/api/procedures/payDividends.d.ts +2 -2
  233. package/api/procedures/payDividends.d.ts.map +1 -1
  234. package/api/procedures/payDividends.js +2 -3
  235. package/api/procedures/payDividends.js.map +1 -1
  236. package/api/procedures/quitCustody.d.ts +2 -2
  237. package/api/procedures/quitCustody.d.ts.map +1 -1
  238. package/api/procedures/quitCustody.js +2 -3
  239. package/api/procedures/quitCustody.js.map +1 -1
  240. package/api/procedures/quitSubsidy.d.ts +2 -2
  241. package/api/procedures/quitSubsidy.d.ts.map +1 -1
  242. package/api/procedures/quitSubsidy.js +2 -3
  243. package/api/procedures/quitSubsidy.js.map +1 -1
  244. package/api/procedures/reclaimDividendDistributionFunds.d.ts +2 -2
  245. package/api/procedures/reclaimDividendDistributionFunds.d.ts.map +1 -1
  246. package/api/procedures/reclaimDividendDistributionFunds.js +2 -3
  247. package/api/procedures/reclaimDividendDistributionFunds.js.map +1 -1
  248. package/api/procedures/redeemTokens.d.ts +2 -2
  249. package/api/procedures/redeemTokens.d.ts.map +1 -1
  250. package/api/procedures/redeemTokens.js +2 -3
  251. package/api/procedures/redeemTokens.js.map +1 -1
  252. package/api/procedures/registerIdentity.d.ts +2 -3
  253. package/api/procedures/registerIdentity.d.ts.map +1 -1
  254. package/api/procedures/registerIdentity.js +4 -3
  255. package/api/procedures/registerIdentity.js.map +1 -1
  256. package/api/procedures/removeAssetRequirement.d.ts +2 -2
  257. package/api/procedures/removeAssetRequirement.d.ts.map +1 -1
  258. package/api/procedures/removeAssetRequirement.js +3 -3
  259. package/api/procedures/removeAssetRequirement.js.map +1 -1
  260. package/api/procedures/removeAssetStat.d.ts +2 -2
  261. package/api/procedures/removeAssetStat.d.ts.map +1 -1
  262. package/api/procedures/removeAssetStat.js +5 -7
  263. package/api/procedures/removeAssetStat.js.map +1 -1
  264. package/api/procedures/removeCheckpointSchedule.d.ts +2 -2
  265. package/api/procedures/removeCheckpointSchedule.d.ts.map +1 -1
  266. package/api/procedures/removeCheckpointSchedule.js +2 -3
  267. package/api/procedures/removeCheckpointSchedule.js.map +1 -1
  268. package/api/procedures/removeCorporateAction.d.ts +2 -2
  269. package/api/procedures/removeCorporateAction.d.ts.map +1 -1
  270. package/api/procedures/removeCorporateAction.js +2 -3
  271. package/api/procedures/removeCorporateAction.js.map +1 -1
  272. package/api/procedures/removeCorporateActionsAgent.d.ts +2 -2
  273. package/api/procedures/removeCorporateActionsAgent.d.ts.map +1 -1
  274. package/api/procedures/removeCorporateActionsAgent.js +2 -3
  275. package/api/procedures/removeCorporateActionsAgent.js.map +1 -1
  276. package/api/procedures/removeExternalAgent.d.ts +2 -2
  277. package/api/procedures/removeExternalAgent.d.ts.map +1 -1
  278. package/api/procedures/removeExternalAgent.js +2 -3
  279. package/api/procedures/removeExternalAgent.js.map +1 -1
  280. package/api/procedures/removePrimaryIssuanceAgent.d.ts +2 -2
  281. package/api/procedures/removePrimaryIssuanceAgent.d.ts.map +1 -1
  282. package/api/procedures/removePrimaryIssuanceAgent.js +2 -3
  283. package/api/procedures/removePrimaryIssuanceAgent.js.map +1 -1
  284. package/api/procedures/removeSecondaryAccounts.d.ts +1 -2
  285. package/api/procedures/removeSecondaryAccounts.d.ts.map +1 -1
  286. package/api/procedures/removeSecondaryAccounts.js +2 -3
  287. package/api/procedures/removeSecondaryAccounts.js.map +1 -1
  288. package/api/procedures/renamePortfolio.d.ts +2 -2
  289. package/api/procedures/renamePortfolio.d.ts.map +1 -1
  290. package/api/procedures/renamePortfolio.js +3 -3
  291. package/api/procedures/renamePortfolio.js.map +1 -1
  292. package/api/procedures/rescheduleInstruction.d.ts +1 -2
  293. package/api/procedures/rescheduleInstruction.d.ts.map +1 -1
  294. package/api/procedures/rescheduleInstruction.js +3 -3
  295. package/api/procedures/rescheduleInstruction.js.map +1 -1
  296. package/api/procedures/reserveTicker.d.ts +3 -3
  297. package/api/procedures/reserveTicker.d.ts.map +1 -1
  298. package/api/procedures/reserveTicker.js +4 -3
  299. package/api/procedures/reserveTicker.js.map +1 -1
  300. package/api/procedures/setAssetDocuments.d.ts +2 -2
  301. package/api/procedures/setAssetDocuments.d.ts.map +1 -1
  302. package/api/procedures/setAssetDocuments.js +2 -1
  303. package/api/procedures/setAssetDocuments.js.map +1 -1
  304. package/api/procedures/setAssetRequirements.d.ts +2 -2
  305. package/api/procedures/setAssetRequirements.d.ts.map +1 -1
  306. package/api/procedures/setAssetRequirements.js +10 -9
  307. package/api/procedures/setAssetRequirements.js.map +1 -1
  308. package/api/procedures/setCustodian.d.ts +3 -3
  309. package/api/procedures/setCustodian.d.ts.map +1 -1
  310. package/api/procedures/setCustodian.js +6 -3
  311. package/api/procedures/setCustodian.js.map +1 -1
  312. package/api/procedures/setGroupPermissions.d.ts +2 -2
  313. package/api/procedures/setGroupPermissions.d.ts.map +1 -1
  314. package/api/procedures/setGroupPermissions.js +2 -3
  315. package/api/procedures/setGroupPermissions.js.map +1 -1
  316. package/api/procedures/setPermissionGroup.d.ts +2 -2
  317. package/api/procedures/setPermissionGroup.d.ts.map +1 -1
  318. package/api/procedures/setPermissionGroup.js +7 -6
  319. package/api/procedures/setPermissionGroup.js.map +1 -1
  320. package/api/procedures/setTransferRestrictions.d.ts +3 -8
  321. package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
  322. package/api/procedures/setTransferRestrictions.js +45 -118
  323. package/api/procedures/setTransferRestrictions.js.map +1 -1
  324. package/api/procedures/subsidizeAccount.d.ts +2 -3
  325. package/api/procedures/subsidizeAccount.d.ts.map +1 -1
  326. package/api/procedures/subsidizeAccount.js +4 -3
  327. package/api/procedures/subsidizeAccount.js.map +1 -1
  328. package/api/procedures/toggleFreezeOffering.d.ts +2 -2
  329. package/api/procedures/toggleFreezeOffering.d.ts.map +1 -1
  330. package/api/procedures/toggleFreezeOffering.js +18 -17
  331. package/api/procedures/toggleFreezeOffering.js.map +1 -1
  332. package/api/procedures/toggleFreezeSecondaryAccounts.d.ts +2 -2
  333. package/api/procedures/toggleFreezeSecondaryAccounts.d.ts.map +1 -1
  334. package/api/procedures/toggleFreezeSecondaryAccounts.js +9 -7
  335. package/api/procedures/toggleFreezeSecondaryAccounts.js.map +1 -1
  336. package/api/procedures/toggleFreezeTransfers.d.ts +2 -2
  337. package/api/procedures/toggleFreezeTransfers.d.ts.map +1 -1
  338. package/api/procedures/toggleFreezeTransfers.js +13 -12
  339. package/api/procedures/toggleFreezeTransfers.js.map +1 -1
  340. package/api/procedures/togglePauseRequirements.d.ts +2 -2
  341. package/api/procedures/togglePauseRequirements.d.ts.map +1 -1
  342. package/api/procedures/togglePauseRequirements.js +3 -3
  343. package/api/procedures/togglePauseRequirements.js.map +1 -1
  344. package/api/procedures/transferAssetOwnership.d.ts +3 -3
  345. package/api/procedures/transferAssetOwnership.d.ts.map +1 -1
  346. package/api/procedures/transferAssetOwnership.js +4 -3
  347. package/api/procedures/transferAssetOwnership.js.map +1 -1
  348. package/api/procedures/transferPolyx.d.ts +2 -2
  349. package/api/procedures/transferPolyx.d.ts.map +1 -1
  350. package/api/procedures/transferPolyx.js +8 -8
  351. package/api/procedures/transferPolyx.js.map +1 -1
  352. package/api/procedures/transferTickerOwnership.d.ts +3 -3
  353. package/api/procedures/transferTickerOwnership.d.ts.map +1 -1
  354. package/api/procedures/transferTickerOwnership.js +4 -3
  355. package/api/procedures/transferTickerOwnership.js.map +1 -1
  356. package/api/procedures/types.d.ts +33 -12
  357. package/api/procedures/types.d.ts.map +1 -1
  358. package/api/procedures/types.js +23 -1
  359. package/api/procedures/types.js.map +1 -1
  360. package/api/procedures/utils.d.ts +2 -1
  361. package/api/procedures/utils.d.ts.map +1 -1
  362. package/api/procedures/utils.js +8 -1
  363. package/api/procedures/utils.js.map +1 -1
  364. package/api/procedures/waivePermissions.d.ts +2 -2
  365. package/api/procedures/waivePermissions.d.ts.map +1 -1
  366. package/api/procedures/waivePermissions.js +2 -3
  367. package/api/procedures/waivePermissions.js.map +1 -1
  368. package/base/Context.d.ts +2 -15
  369. package/base/Context.d.ts.map +1 -1
  370. package/base/Context.js +3 -37
  371. package/base/Context.js.map +1 -1
  372. package/base/PolymeshError.js +1 -1
  373. package/base/PolymeshError.js.map +1 -1
  374. package/base/PolymeshTransaction.d.ts +19 -20
  375. package/base/PolymeshTransaction.d.ts.map +1 -1
  376. package/base/PolymeshTransaction.js +12 -19
  377. package/base/PolymeshTransaction.js.map +1 -1
  378. package/base/PolymeshTransactionBase.d.ts +35 -70
  379. package/base/PolymeshTransactionBase.d.ts.map +1 -1
  380. package/base/PolymeshTransactionBase.js +68 -237
  381. package/base/PolymeshTransactionBase.js.map +1 -1
  382. package/base/PolymeshTransactionBatch.d.ts +15 -43
  383. package/base/PolymeshTransactionBatch.d.ts.map +1 -1
  384. package/base/PolymeshTransactionBatch.js +18 -107
  385. package/base/PolymeshTransactionBatch.js.map +1 -1
  386. package/base/PostTransactionValue.d.ts +45 -0
  387. package/base/PostTransactionValue.d.ts.map +1 -0
  388. package/base/PostTransactionValue.js +108 -0
  389. package/base/PostTransactionValue.js.map +1 -0
  390. package/base/Procedure.d.ts +35 -10
  391. package/base/Procedure.d.ts.map +1 -1
  392. package/base/Procedure.js +92 -27
  393. package/base/Procedure.js.map +1 -1
  394. package/base/TransactionQueue.d.ts +142 -0
  395. package/base/TransactionQueue.d.ts.map +1 -0
  396. package/base/TransactionQueue.js +420 -0
  397. package/base/TransactionQueue.js.map +1 -0
  398. package/base/types.d.ts +4 -2
  399. package/base/types.d.ts.map +1 -1
  400. package/internal.d.ts +6 -1
  401. package/internal.d.ts.map +1 -1
  402. package/internal.js +15 -5
  403. package/internal.js.map +1 -1
  404. package/middleware/queriesV2.d.ts.map +1 -1
  405. package/middleware/queriesV2.js +11 -7
  406. package/middleware/queriesV2.js.map +1 -1
  407. package/middleware/types.d.ts +524 -484
  408. package/middleware/types.d.ts.map +1 -1
  409. package/middleware/types.js +499 -459
  410. package/middleware/types.js.map +1 -1
  411. package/middleware/typesV2.d.ts +20 -4
  412. package/middleware/typesV2.d.ts.map +1 -1
  413. package/middleware/typesV2.js +9 -2
  414. package/middleware/typesV2.js.map +1 -1
  415. package/npm-package/polymeshassociation-polymesh-sdk-16.0.0-beta.1.tgz +0 -0
  416. package/package.json +6 -6
  417. package/types/index.d.ts +66 -75
  418. package/types/index.d.ts.map +1 -1
  419. package/types/index.js +25 -8
  420. package/types/index.js.map +1 -1
  421. package/types/internal.d.ts +104 -73
  422. package/types/internal.d.ts.map +1 -1
  423. package/types/internal.js +8 -27
  424. package/types/internal.js.map +1 -1
  425. package/utils/conversion.d.ts +24 -8
  426. package/utils/conversion.d.ts.map +1 -1
  427. package/utils/conversion.js +99 -36
  428. package/utils/conversion.js.map +1 -1
  429. package/utils/internal.d.ts +14 -32
  430. package/utils/internal.d.ts.map +1 -1
  431. package/utils/internal.js +53 -121
  432. package/utils/internal.js.map +1 -1
  433. package/utils/typeguards.d.ts +2 -2
  434. package/utils/typeguards.d.ts.map +1 -1
  435. package/utils/typeguards.js.map +1 -1
  436. package/api/procedures/createTransactionBatch.d.ts +0 -25
  437. package/api/procedures/createTransactionBatch.d.ts.map +0 -1
  438. package/api/procedures/createTransactionBatch.js +0 -118
  439. package/api/procedures/createTransactionBatch.js.map +0 -1
  440. package/npm-package/polymeshassociation-polymesh-sdk-16.0.0-alpha.1.tgz +0 -0
@@ -1,20 +1,16 @@
1
1
  /// <reference types="node" />
2
2
  import { SubmittableExtrinsic } from '@polkadot/api/types';
3
- import { SpRuntimeDispatchError } from "../polkadot/types-lookup.ts";
3
+ import { DispatchError } from '@polkadot/types/interfaces';
4
4
  import { ISubmittableResult, Signer as PolkadotSigner } from '@polkadot/types/types';
5
5
  import BigNumber from 'bignumber.js';
6
6
  import { EventEmitter } from 'events';
7
7
  import { Context, Identity, PolymeshError } from "../internal";
8
- import { GenericPolymeshTransaction, PayingAccountFees, TransactionStatus, UnsubCallback } from "../types";
9
- import { BaseTransactionSpec, MaybeResolverFunction, TransactionSigningData } from "../types/internal";
8
+ import { Fees, PayingAccount, TransactionStatus } from "../types";
9
+ import { BaseTransactionSpec, PostTransactionValueArray } from "../types/internal";
10
10
  /**
11
11
  * Wrapper class for a Polymesh Transaction
12
12
  */
13
- export declare abstract class PolymeshTransactionBase<ReturnValue = void, TransformedReturnValue = ReturnValue> {
14
- /**
15
- * @hidden
16
- */
17
- static toTransactionSpec<R, T>(transaction: PolymeshTransactionBase<R, T>): BaseTransactionSpec<R, T>;
13
+ export declare abstract class PolymeshTransactionBase<Values extends unknown[] = unknown[]> {
18
14
  /**
19
15
  * current status of the transaction
20
16
  */
@@ -43,6 +39,10 @@ export declare abstract class PolymeshTransactionBase<ReturnValue = void, Transf
43
39
  * number of the block where this transaction resides (status: `Succeeded`, `Failed`)
44
40
  */
45
41
  blockNumber?: BigNumber;
42
+ /**
43
+ * whether this transaction failing makes the entire transaction queue fail or not
44
+ */
45
+ isCritical: boolean;
46
46
  /**
47
47
  * @hidden
48
48
  *
@@ -53,9 +53,9 @@ export declare abstract class PolymeshTransactionBase<ReturnValue = void, Transf
53
53
  /**
54
54
  * @hidden
55
55
  *
56
- * function that transforms the transaction's return value before returning it after it is run
56
+ * wrappers for values that will exist after this transaction has executed
57
57
  */
58
- protected resolver: MaybeResolverFunction<ReturnValue>;
58
+ protected postValues: PostTransactionValueArray<Values>;
59
59
  /**
60
60
  * @hidden
61
61
  *
@@ -77,27 +77,20 @@ export declare abstract class PolymeshTransactionBase<ReturnValue = void, Transf
77
77
  /**
78
78
  * @hidden
79
79
  *
80
- * function that transforms the return value to another type. Useful when using the same
81
- * Procedure for different endpoints which are supposed to return different values
80
+ * used by procedures to set the fee manually in case the protocol op can't be
81
+ * dynamically generated from the transaction name, or a specific procedure has
82
+ * special rules for calculating them
82
83
  */
83
- protected transformer?: (result: ReturnValue) => Promise<TransformedReturnValue> | TransformedReturnValue;
84
+ protected protocolFee?: BigNumber;
84
85
  protected context: Context;
85
86
  /**
86
87
  * @hidden
87
- * whether the queue has run or not (prevents re-running)
88
88
  */
89
- private hasRun;
89
+ constructor(transactionSpec: BaseTransactionSpec<Values>, context: Context);
90
90
  /**
91
- * @hidden
91
+ * Run the transaction and update its status
92
92
  */
93
- constructor(transactionSpec: BaseTransactionSpec<ReturnValue, TransformedReturnValue> & TransactionSigningData, context: Context);
94
- /**
95
- * Run the transaction, update its status and return a result if applicable.
96
- * Certain transactions create Entities on the blockchain, and those Entities are returned
97
- * for convenience. For example, when running a transaction that creates an Asset, the Asset itself
98
- * is returned
99
- */
100
- run(): Promise<TransformedReturnValue>;
93
+ run(): Promise<void>;
101
94
  /**
102
95
  * @hidden
103
96
  *
@@ -112,34 +105,25 @@ export declare abstract class PolymeshTransactionBase<ReturnValue = void, Transf
112
105
  *
113
106
  * @returns unsubscribe function
114
107
  */
115
- onStatusChange(listener: (transaction: GenericPolymeshTransaction<ReturnValue, TransformedReturnValue>) => void): UnsubCallback;
116
- /**
117
- * Retrieve a breakdown of the fees required to run this transaction, as well as the Account responsible for paying them
118
- *
119
- * @note these values might be inaccurate if the transaction is run at a later time. This can be due to a governance vote or other
120
- * chain related factors (like modifications to a specific subsidizer relationship or a chain upgrade)
121
- */
122
- getTotalFees(): Promise<PayingAccountFees>;
108
+ onStatusChange(listener: (transaction: this) => void): () => void;
123
109
  /**
124
- * Subscribe to the results of this transaction being processed by the indexing service (and as such, available to the middleware)
110
+ * Retrieve the Account that would pay fees for the transaction if it was run at this moment, as well as the total amount that can be
111
+ * charged to it (allowance). A null allowance means that there is no limit to that amount
125
112
  *
126
- * @param listener - callback function that will be called whenever the middleware is updated with the latest data.
127
- * If there is an error (timeout or middleware offline) it will be passed to this callback
113
+ * A null return value signifies that the caller Account would pay the fees
128
114
  *
129
- * @note this event will be fired even if the queue fails
130
- * @returns unsubscribe function
131
- * @throws if the middleware wasn't enabled when instantiating the SDK client
115
+ * @note this value might change if, before running the transaction, the caller Account enters (or leaves)
116
+ * a subsidizer relationship
132
117
  */
133
- onProcessedByMiddleware(listener: (err?: PolymeshError) => void): UnsubCallback;
118
+ getPayingAccount(): Promise<PayingAccount | null>;
134
119
  /**
135
- * Poll the middleware every 2 seconds to see if it has already processed the
136
- * block that reflects the changes brought on by this transaction being run. If so,
137
- * emit the corresponding event. After 5 retries (or if the middleware can't be reached),
138
- * the event is emitted with an error
120
+ * Get all (protocol and gas) fees associated with this transaction. Returns null
121
+ * if the transaction is not ready yet (this can happen if it depends on the execution of a
122
+ * previous transaction in the queue)
139
123
  *
140
- * @note uses the middleware
124
+ * @note this value might change if the transaction is run at a later time. This can be due to a governance vote
141
125
  */
142
- private emitWhenMiddlewareIsSynced;
126
+ getFees(): Promise<Fees | null>;
143
127
  /**
144
128
  * @hidden
145
129
  */
@@ -149,7 +133,7 @@ export declare abstract class PolymeshTransactionBase<ReturnValue = void, Transf
149
133
  * AND the caller is being subsidized by a third party, the transaction can't be executed and trying
150
134
  * to do so will result in an error
151
135
  *
152
- * @note this depends on the type of transaction itself (e.g. `staking.bond` can't be subsidized, but `asset.createAsset` can)
136
+ * @note this depends on the type of transaction itself (i.e. `staking.bond` can't be subsidized, but `asset.createAsset` can)
153
137
  */
154
138
  abstract supportsSubsidy(): boolean;
155
139
  /**
@@ -165,38 +149,19 @@ export declare abstract class PolymeshTransactionBase<ReturnValue = void, Transf
165
149
  * and is always paid by the caller
166
150
  */
167
151
  protected ignoresSubsidy(): boolean;
168
- /**
169
- * Return this transaction's protocol fees. These are extra fees charged for
170
- * specific operations on the chain. Not to be confused with network fees (which
171
- * depend on the complexity of the operation), protocol fees are set by governance and/or
172
- * chain upgrades
173
- */
174
- abstract getProtocolFees(): Promise<BigNumber>;
175
- /**
176
- * @hidden
177
- */
178
- protected handleExtrinsicFailure(_resolve: (value: ISubmittableResult | PromiseLike<ISubmittableResult>) => void, reject: (reason?: unknown) => void, error: SpRuntimeDispatchError, data?: Record<string, unknown>): void;
179
152
  /**
180
153
  * @hidden
154
+ *
155
+ * Fetch and calculate this transaction's protocol fees
181
156
  */
182
- protected handleExtrinsicSuccess(resolve: (value: ISubmittableResult | PromiseLike<ISubmittableResult>) => void, _reject: (reason?: unknown) => void, receipt: ISubmittableResult): void;
157
+ protected abstract getProtocolFees(): Promise<BigNumber>;
183
158
  /**
184
159
  * @hidden
185
- *
186
- * Check if balances and allowances (both third party and signing Account)
187
- * are sufficient to cover this transaction's fees
188
160
  */
189
- private assertFeesCovered;
161
+ protected handleExtrinsicFailure(_resolve: (value: ISubmittableResult | PromiseLike<ISubmittableResult>) => void, reject: (reason?: unknown) => void, error: DispatchError, data?: Record<string, unknown>): void;
190
162
  /**
191
163
  * @hidden
192
- *
193
- * Retrieve the Account that would pay fees for the transaction if it was run at this moment, as well as the total amount that can be
194
- * charged to it (allowance) in case of a subsidy
195
- *
196
- * @note the paying Account might change if, before running the transaction, the caller Account enters (or leaves)
197
- * a subsidizer relationship. A governance vote or chain upgrade could also cause the value to change between the time
198
- * this method is called and the time the transaction is run
199
164
  */
200
- private getPayingAccount;
165
+ protected handleExtrinsicSuccess(resolve: (value: ISubmittableResult | PromiseLike<ISubmittableResult>) => void, _reject: (reason?: unknown) => void, receipt: ISubmittableResult): void;
201
166
  }
202
167
  //# sourceMappingURL=PolymeshTransactionBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PolymeshTransactionBase.d.ts","sourceRoot":"","sources":["../../src/base/PolymeshTransactionBase.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,oCAA+B;AAChE,OAAO,EAAE,kBAAkB,EAAiB,MAAM,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,oBAAmB;AAG9D,OAAO,EAEL,0BAA0B,EAE1B,iBAAiB,EAEjB,iBAAiB,EACjB,aAAa,EACd,iBAAgB;AACjB,OAAO,EACL,mBAAmB,EAEnB,qBAAqB,EACrB,sBAAsB,EACvB,0BAAyB;AAa1B;;GAEG;AACH,8BAAsB,uBAAuB,CAC3C,WAAW,GAAG,IAAI,EAClB,sBAAsB,GAAG,WAAW;IAEpC;;OAEG;WACW,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAClC,WAA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OAAO,CAAC,GAC7B,IAAI;IAqBP;;OAEG;IACH,SAAS,CAAC,sBAAsB,CAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,EAC9E,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,EACnC,OAAO,EAAE,kBAAkB,GAC1B,IAAI;CAGR"}
@@ -14,22 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.PolymeshTransactionBase = void 0;
16
16
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
- const bluebird_1 = __importDefault(require("bluebird"));
18
17
  const events_1 = require("events");
19
- const lodash_1 = require("lodash");
20
18
  const internal_1 = require("../internal");
21
- const queries_1 = require("../middleware/queries");
22
19
  const types_1 = require("../types");
23
- const internal_2 = require("../types/internal");
24
20
  const conversion_1 = require("../utils/conversion");
25
- const internal_3 = require("../utils/internal");
21
+ const internal_2 = require("../utils/internal");
26
22
  /**
27
23
  * @hidden
28
24
  */
29
25
  var Event;
30
26
  (function (Event) {
31
27
  Event["StatusChange"] = "StatusChange";
32
- Event["ProcessedByMiddleware"] = "ProcessedByMiddleware";
33
28
  })(Event || (Event = {}));
34
29
  /**
35
30
  * Wrapper class for a Polymesh Transaction
@@ -46,61 +41,31 @@ class PolymeshTransactionBase {
46
41
  /**
47
42
  * @hidden
48
43
  *
49
- * internal event emitter to handle status changes
44
+ * wrappers for values that will exist after this transaction has executed
50
45
  */
46
+ this.postValues = [];
47
+ const { postTransactionValues, signingAddress, signer, isCritical, fee, paidForBy } = transactionSpec;
48
+ if (postTransactionValues) {
49
+ this.postValues = postTransactionValues;
50
+ }
51
51
  this.emitter = new events_1.EventEmitter();
52
- /**
53
- * @hidden
54
- * whether the queue has run or not (prevents re-running)
55
- */
56
- this.hasRun = false;
57
- const { resolver, transformer, signingAddress, signer, paidForBy } = transactionSpec;
58
52
  this.signingAddress = signingAddress;
59
53
  this.signer = signer;
54
+ this.isCritical = isCritical;
55
+ this.protocolFee = fee;
60
56
  this.context = context;
61
57
  this.paidForBy = paidForBy;
62
- this.transformer = transformer;
63
- this.resolver = resolver;
64
58
  }
65
59
  /**
66
- * @hidden
67
- */
68
- static toTransactionSpec(transaction) {
69
- const { resolver, transformer, paidForBy } = transaction;
70
- return {
71
- resolver,
72
- transformer,
73
- paidForBy,
74
- };
75
- }
76
- /**
77
- * Run the transaction, update its status and return a result if applicable.
78
- * Certain transactions create Entities on the blockchain, and those Entities are returned
79
- * for convenience. For example, when running a transaction that creates an Asset, the Asset itself
80
- * is returned
60
+ * Run the transaction and update its status
81
61
  */
82
62
  run() {
83
63
  return __awaiter(this, void 0, void 0, function* () {
84
- if (this.hasRun) {
85
- throw new internal_1.PolymeshError({
86
- code: types_1.ErrorCode.General,
87
- message: 'Cannot re-run a Transaction',
88
- });
89
- }
90
64
  try {
91
- yield this.assertFeesCovered();
92
65
  const receipt = yield this.internalRun();
93
66
  this.receipt = receipt;
94
- const { resolver, transformer = (val) => __awaiter(this, void 0, void 0, function* () { return val; }), } = this;
95
- let value;
96
- if ((0, internal_2.isResolverFunction)(resolver)) {
97
- value = yield resolver(receipt);
98
- }
99
- else {
100
- value = resolver;
101
- }
67
+ yield Promise.all(this.postValues.map(postValue => postValue.run(receipt)));
102
68
  this.updateStatus(types_1.TransactionStatus.Succeeded);
103
- return transformer(value);
104
69
  }
105
70
  catch (err) {
106
71
  const error = err;
@@ -123,16 +88,6 @@ class PolymeshTransactionBase {
123
88
  }
124
89
  throw error;
125
90
  }
126
- finally {
127
- this.hasRun = true;
128
- /*
129
- * We do not await this promise because it is supposed to run in the background, and
130
- * any errors encountered are emitted. If the user isn't listening, they shouldn't
131
- * care about middleware (or other) errors anyway
132
- */
133
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
134
- this.emitWhenMiddlewareIsSynced();
135
- }
136
91
  });
137
92
  }
138
93
  /**
@@ -143,13 +98,14 @@ class PolymeshTransactionBase {
143
98
  */
144
99
  internalRun() {
145
100
  return __awaiter(this, void 0, void 0, function* () {
146
- const { signingAddress, signer, context } = this;
147
- const nonce = context.getNonce().toNumber();
101
+ const { signingAddress, signer } = this;
148
102
  this.updateStatus(types_1.TransactionStatus.Unapproved);
149
103
  return new Promise((resolve, reject) => {
150
104
  const txWithArgs = this.composeTx();
151
105
  let settingBlockData = Promise.resolve();
152
- const gettingUnsub = txWithArgs.signAndSend(signingAddress, { nonce, signer }, receipt => {
106
+ // nonce: -1 takes pending transactions into consideration.
107
+ // More information can be found at: https://polkadot.js.org/docs/api/cookbook/tx/#how-do-i-take-the-pending-tx-pool-into-account-in-my-nonce
108
+ const gettingUnsub = txWithArgs.signAndSend(signingAddress, { nonce: -1, signer }, receipt => {
153
109
  const { status } = receipt;
154
110
  let isLastCallback = false;
155
111
  let unsubscribing = Promise.resolve();
@@ -163,7 +119,7 @@ class PolymeshTransactionBase {
163
119
  * is emitted, and at the same time. We do not resolve or reject the containing promise until this
164
120
  * one resolves
165
121
  */
166
- settingBlockData = (0, internal_3.defusePromise)(this.context.polymeshApi.rpc.chain.getBlock(blockHash).then(({ block }) => {
122
+ settingBlockData = (0, internal_2.defusePromise)(this.context.polymeshApi.rpc.chain.getBlock(blockHash).then(({ block }) => {
167
123
  this.blockHash = (0, conversion_1.hashToString)(blockHash);
168
124
  this.blockNumber = (0, conversion_1.u32ToBigNumber)(block.header.number.unwrap());
169
125
  // we know that the index has to be set by the time the transaction is included in a block
@@ -171,7 +127,7 @@ class PolymeshTransactionBase {
171
127
  this.txIndex = new bignumber_js_1.default(receipt.txIndex);
172
128
  }));
173
129
  // if the extrinsic failed due to an on-chain error, we should handle it in a special way
174
- [extrinsicFailedEvent] = (0, internal_3.filterEventRecords)(receipt, 'system', 'ExtrinsicFailed', true);
130
+ extrinsicFailedEvent = receipt.findRecord('system', 'ExtrinsicFailed');
175
131
  // extrinsic failed so we can unsubscribe
176
132
  isLastCallback = !!extrinsicFailedEvent;
177
133
  }
@@ -190,7 +146,7 @@ class PolymeshTransactionBase {
190
146
  */
191
147
  let finishing = Promise.resolve();
192
148
  if (extrinsicFailedEvent) {
193
- const { data } = extrinsicFailedEvent;
149
+ const { event: { data }, } = extrinsicFailedEvent;
194
150
  finishing = Promise.all([settingBlockData, unsubscribing]).then(() => {
195
151
  this.handleExtrinsicFailure(resolve, reject, data[0]);
196
152
  });
@@ -236,139 +192,96 @@ class PolymeshTransactionBase {
236
192
  * @returns unsubscribe function
237
193
  */
238
194
  onStatusChange(listener) {
239
- const { emitter } = this;
240
- emitter.on(Event.StatusChange, listener);
195
+ this.emitter.on(Event.StatusChange, listener);
241
196
  return () => {
242
- emitter.removeListener(Event.StatusChange, listener);
197
+ this.emitter.removeListener(Event.StatusChange, listener);
243
198
  };
244
199
  }
245
200
  /**
246
- * Retrieve a breakdown of the fees required to run this transaction, as well as the Account responsible for paying them
201
+ * Retrieve the Account that would pay fees for the transaction if it was run at this moment, as well as the total amount that can be
202
+ * charged to it (allowance). A null allowance means that there is no limit to that amount
203
+ *
204
+ * A null return value signifies that the caller Account would pay the fees
247
205
  *
248
- * @note these values might be inaccurate if the transaction is run at a later time. This can be due to a governance vote or other
249
- * chain related factors (like modifications to a specific subsidizer relationship or a chain upgrade)
206
+ * @note this value might change if, before running the transaction, the caller Account enters (or leaves)
207
+ * a subsidizer relationship
250
208
  */
251
- getTotalFees() {
209
+ getPayingAccount() {
252
210
  return __awaiter(this, void 0, void 0, function* () {
253
- const { signingAddress } = this;
254
- const composedTx = this.composeTx();
255
- const paymentInfoPromise = composedTx.paymentInfo(signingAddress);
256
- const protocol = yield this.getProtocolFees();
257
- const [payingAccount, { partialFee }] = yield Promise.all([
258
- this.getPayingAccount(),
259
- paymentInfoPromise,
260
- ]);
261
- const { free: balance } = yield payingAccount.account.getBalance();
262
- const gas = (0, conversion_1.balanceToBigNumber)(partialFee);
211
+ const { paidForBy, context } = this;
212
+ if (this.ignoresSubsidy()) {
213
+ return null;
214
+ }
215
+ if (paidForBy) {
216
+ const { account: primaryAccount } = yield paidForBy.getPrimaryAccount();
217
+ return {
218
+ type: types_1.PayingAccountType.Other,
219
+ account: primaryAccount,
220
+ allowance: null,
221
+ };
222
+ }
223
+ const subsidyWithAllowance = yield context.accountSubsidy();
224
+ if (!subsidyWithAllowance) {
225
+ return null;
226
+ }
227
+ const { subsidy: { subsidizer: account }, allowance, } = subsidyWithAllowance;
263
228
  return {
264
- fees: {
265
- protocol,
266
- gas,
267
- total: protocol.plus(gas),
268
- },
269
- payingAccountData: Object.assign(Object.assign({}, payingAccount), { balance }),
229
+ type: types_1.PayingAccountType.Subsidy,
230
+ account,
231
+ allowance,
270
232
  };
271
233
  });
272
234
  }
273
235
  /**
274
- * Subscribe to the results of this transaction being processed by the indexing service (and as such, available to the middleware)
275
- *
276
- * @param listener - callback function that will be called whenever the middleware is updated with the latest data.
277
- * If there is an error (timeout or middleware offline) it will be passed to this callback
278
- *
279
- * @note this event will be fired even if the queue fails
280
- * @returns unsubscribe function
281
- * @throws if the middleware wasn't enabled when instantiating the SDK client
282
- */
283
- onProcessedByMiddleware(listener) {
284
- const { context, emitter } = this;
285
- if (!context.isMiddlewareEnabled()) {
286
- throw new internal_1.PolymeshError({
287
- code: types_1.ErrorCode.General,
288
- message: 'Cannot subscribe without an enabled middleware connection',
289
- });
290
- }
291
- emitter.on(Event.ProcessedByMiddleware, listener);
292
- return () => {
293
- emitter.removeListener(Event.ProcessedByMiddleware, listener);
294
- };
295
- }
296
- /**
297
- * Poll the middleware every 2 seconds to see if it has already processed the
298
- * block that reflects the changes brought on by this transaction being run. If so,
299
- * emit the corresponding event. After 5 retries (or if the middleware can't be reached),
300
- * the event is emitted with an error
236
+ * Get all (protocol and gas) fees associated with this transaction. Returns null
237
+ * if the transaction is not ready yet (this can happen if it depends on the execution of a
238
+ * previous transaction in the queue)
301
239
  *
302
- * @note uses the middleware
240
+ * @note this value might change if the transaction is run at a later time. This can be due to a governance vote
303
241
  */
304
- emitWhenMiddlewareIsSynced() {
242
+ getFees() {
305
243
  return __awaiter(this, void 0, void 0, function* () {
306
- const { context, emitter } = this;
244
+ const { signingAddress } = this;
245
+ let { protocolFee: protocol } = this;
246
+ let composedTx;
307
247
  try {
308
- if (!context.isMiddlewareEnabled()) {
309
- return;
310
- }
311
- const blockNumber = yield context.getLatestBlock();
312
- let done = false;
313
- yield bluebird_1.default.each((0, lodash_1.range)(6), (i) => __awaiter(this, void 0, void 0, function* () {
314
- if (done) {
315
- return;
316
- }
317
- try {
318
- const { data: { latestBlock: { id: processedBlock }, }, } = yield context.queryMiddleware((0, queries_1.latestProcessedBlock)());
319
- if (blockNumber.lte(processedBlock)) {
320
- done = true;
321
- emitter.emit(Event.ProcessedByMiddleware);
322
- return;
323
- }
324
- }
325
- catch (err) {
326
- /*
327
- * query errors are swallowed because we wish to query again if we haven't reached the
328
- * maximum amount of retries
329
- */
330
- }
331
- if (i === 5) {
332
- emitter.emit(Event.ProcessedByMiddleware, new internal_1.PolymeshError({
333
- code: types_1.ErrorCode.MiddlewareError,
334
- message: `Middleware has not synced after ${i} attempts`,
335
- }));
336
- }
337
- return (0, internal_3.delay)(2000);
338
- }));
248
+ composedTx = this.composeTx();
339
249
  }
340
250
  catch (err) {
341
- /* istanbul ignore next: extreme edge case */
342
- emitter.emit(Event.ProcessedByMiddleware, new internal_1.PolymeshError({
343
- code: types_1.ErrorCode.UnexpectedError,
344
- message: err.message || 'Unexpected error',
345
- }));
251
+ return null;
346
252
  }
253
+ const paymentInfoPromise = composedTx.paymentInfo(signingAddress);
254
+ if (!protocol) {
255
+ protocol = yield this.getProtocolFees();
256
+ }
257
+ const { partialFee } = yield paymentInfoPromise;
258
+ return {
259
+ protocol,
260
+ gas: (0, conversion_1.balanceToBigNumber)(partialFee),
261
+ };
347
262
  });
348
263
  }
349
264
  /**
350
265
  * @hidden
351
266
  */
352
267
  updateStatus(status) {
353
- const { emitter } = this;
354
268
  this.status = status;
355
269
  /* eslint-disable default-case */
356
270
  switch (status) {
357
271
  case types_1.TransactionStatus.Unapproved:
358
272
  case types_1.TransactionStatus.Running:
359
273
  case types_1.TransactionStatus.Succeeded: {
360
- emitter.emit(Event.StatusChange, this);
274
+ this.emitter.emit(Event.StatusChange, this);
361
275
  return;
362
276
  }
363
277
  case types_1.TransactionStatus.Rejected:
364
278
  case types_1.TransactionStatus.Aborted:
365
279
  case types_1.TransactionStatus.Failed: {
366
- emitter.emit(Event.StatusChange, this, this.error);
280
+ this.emitter.emit(Event.StatusChange, this, this.error);
367
281
  }
368
282
  }
369
283
  /* eslint-enable default-case */
370
284
  }
371
- /* istanbul ignore next: there is no way of reaching this path currently */
372
285
  /**
373
286
  * @hidden
374
287
  *
@@ -411,88 +324,6 @@ class PolymeshTransactionBase {
411
324
  handleExtrinsicSuccess(resolve, _reject, receipt) {
412
325
  resolve(receipt);
413
326
  }
414
- /**
415
- * @hidden
416
- *
417
- * Check if balances and allowances (both third party and signing Account)
418
- * are sufficient to cover this transaction's fees
419
- */
420
- assertFeesCovered() {
421
- return __awaiter(this, void 0, void 0, function* () {
422
- const { fees: { total }, payingAccountData, } = yield this.getTotalFees();
423
- const { type, balance } = payingAccountData;
424
- if (type === types_1.PayingAccountType.Subsidy) {
425
- const { allowance } = payingAccountData;
426
- if (!this.supportsSubsidy()) {
427
- throw new internal_1.PolymeshError({
428
- code: types_1.ErrorCode.UnmetPrerequisite,
429
- message: 'This transaction cannot be run by a subsidized Account',
430
- });
431
- }
432
- if (allowance.lt(total)) {
433
- throw new internal_1.PolymeshError({
434
- code: types_1.ErrorCode.UnmetPrerequisite,
435
- message: "Insufficient subsidy allowance to pay this transaction's fees",
436
- data: {
437
- allowance,
438
- fees: total,
439
- },
440
- });
441
- }
442
- }
443
- const accountDescriptions = {
444
- [types_1.PayingAccountType.Caller]: 'caller',
445
- [types_1.PayingAccountType.Other]: 'paying third party',
446
- [types_1.PayingAccountType.Subsidy]: 'subsidizer',
447
- };
448
- if (balance.lt(total)) {
449
- throw new internal_1.PolymeshError({
450
- code: types_1.ErrorCode.InsufficientBalance,
451
- message: `The ${accountDescriptions[type]} Account does not have enough POLYX balance to pay this transaction's fees`,
452
- data: {
453
- balance,
454
- fees: total,
455
- },
456
- });
457
- }
458
- });
459
- }
460
- /**
461
- * @hidden
462
- *
463
- * Retrieve the Account that would pay fees for the transaction if it was run at this moment, as well as the total amount that can be
464
- * charged to it (allowance) in case of a subsidy
465
- *
466
- * @note the paying Account might change if, before running the transaction, the caller Account enters (or leaves)
467
- * a subsidizer relationship. A governance vote or chain upgrade could also cause the value to change between the time
468
- * this method is called and the time the transaction is run
469
- */
470
- getPayingAccount() {
471
- return __awaiter(this, void 0, void 0, function* () {
472
- const { paidForBy, context } = this;
473
- if (paidForBy) {
474
- const { account: primaryAccount } = yield paidForBy.getPrimaryAccount();
475
- return {
476
- type: types_1.PayingAccountType.Other,
477
- account: primaryAccount,
478
- };
479
- }
480
- const subsidyWithAllowance = yield context.accountSubsidy();
481
- if (!subsidyWithAllowance || this.ignoresSubsidy()) {
482
- const caller = context.getSigningAccount();
483
- return {
484
- account: caller,
485
- type: types_1.PayingAccountType.Caller,
486
- };
487
- }
488
- const { subsidy: { subsidizer: account }, allowance, } = subsidyWithAllowance;
489
- return {
490
- type: types_1.PayingAccountType.Subsidy,
491
- account,
492
- allowance,
493
- };
494
- });
495
- }
496
327
  }
497
328
  exports.PolymeshTransactionBase = PolymeshTransactionBase;
498
329
  //# sourceMappingURL=PolymeshTransactionBase.js.map