@polymeshassociation/polymesh-sdk 14.0.0-beta.11 → 15.0.0-alpha.11

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 (277) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/{AccountManagement.d.ts → api/client/AccountManagement.d.ts} +2 -2
  3. package/api/client/AccountManagement.d.ts.map +1 -0
  4. package/{AccountManagement.js → api/client/AccountManagement.js} +3 -3
  5. package/api/client/AccountManagement.js.map +1 -0
  6. package/{Assets.d.ts → api/client/Assets.d.ts} +13 -2
  7. package/api/client/Assets.d.ts.map +1 -0
  8. package/{Assets.js → api/client/Assets.js} +18 -4
  9. package/api/client/Assets.js.map +1 -0
  10. package/{Claims.d.ts → api/client/Claims.d.ts} +2 -2
  11. package/api/client/Claims.d.ts.map +1 -0
  12. package/{Claims.js → api/client/Claims.js} +7 -7
  13. package/api/client/Claims.js.map +1 -0
  14. package/{Identities.d.ts → api/client/Identities.d.ts} +2 -2
  15. package/api/client/Identities.d.ts.map +1 -0
  16. package/{Identities.js → api/client/Identities.js} +2 -2
  17. package/api/client/Identities.js.map +1 -0
  18. package/{Network.d.ts → api/client/Network.d.ts} +3 -3
  19. package/api/client/Network.d.ts.map +1 -0
  20. package/{Network.js → api/client/Network.js} +5 -5
  21. package/api/client/Network.js.map +1 -0
  22. package/{Polymesh.d.ts → api/client/Polymesh.d.ts} +6 -6
  23. package/api/client/Polymesh.d.ts.map +1 -0
  24. package/{Polymesh.js → api/client/Polymesh.js} +9 -17
  25. package/api/client/Polymesh.js.map +1 -0
  26. package/{Settlements.d.ts → api/client/Settlements.d.ts} +6 -6
  27. package/api/client/Settlements.d.ts.map +1 -0
  28. package/{Settlements.js → api/client/Settlements.js} +7 -7
  29. package/api/client/Settlements.js.map +1 -0
  30. package/api/entities/Account.d.ts +3 -1
  31. package/api/entities/Account.d.ts.map +1 -1
  32. package/api/entities/Account.js +19 -5
  33. package/api/entities/Account.js.map +1 -1
  34. package/api/entities/Asset/Checkpoints/index.d.ts.map +1 -1
  35. package/api/entities/Asset/Checkpoints/index.js.map +1 -1
  36. package/api/entities/Asset/Checkpoints/types.d.ts +1 -1
  37. package/api/entities/Asset/Checkpoints/types.d.ts.map +1 -1
  38. package/api/entities/Asset/Compliance/Requirements.d.ts.map +1 -1
  39. package/api/entities/Asset/Compliance/Requirements.js.map +1 -1
  40. package/api/entities/Asset/Compliance/TrustedClaimIssuers.d.ts.map +1 -1
  41. package/api/entities/Asset/Compliance/TrustedClaimIssuers.js.map +1 -1
  42. package/api/entities/Asset/CorporateActions/index.js +1 -1
  43. package/api/entities/Asset/Settlements.d.ts.map +1 -1
  44. package/api/entities/Asset/Settlements.js.map +1 -1
  45. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.d.ts.map +1 -1
  46. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js +10 -10
  47. package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js.map +1 -1
  48. package/api/entities/Asset/index.d.ts.map +1 -1
  49. package/api/entities/Asset/index.js +7 -9
  50. package/api/entities/Asset/index.js.map +1 -1
  51. package/api/entities/Checkpoint.d.ts.map +1 -1
  52. package/api/entities/Checkpoint.js.map +1 -1
  53. package/api/entities/CorporateActionBase/index.d.ts.map +1 -1
  54. package/api/entities/CorporateActionBase/index.js +1 -1
  55. package/api/entities/CorporateActionBase/index.js.map +1 -1
  56. package/api/entities/DividendDistribution/index.d.ts.map +1 -1
  57. package/api/entities/DividendDistribution/index.js.map +1 -1
  58. package/api/entities/Identity/AssetPermissions.js +2 -2
  59. package/api/entities/Identity/index.d.ts +3 -0
  60. package/api/entities/Identity/index.d.ts.map +1 -1
  61. package/api/entities/Identity/index.js +39 -14
  62. package/api/entities/Identity/index.js.map +1 -1
  63. package/api/entities/Instruction/index.js +1 -1
  64. package/api/entities/Instruction/index.js.map +1 -1
  65. package/api/entities/NumberedPortfolio.d.ts.map +1 -1
  66. package/api/entities/NumberedPortfolio.js +1 -1
  67. package/api/entities/NumberedPortfolio.js.map +1 -1
  68. package/api/entities/Offering/index.d.ts.map +1 -1
  69. package/api/entities/Offering/index.js.map +1 -1
  70. package/api/entities/TickerReservation/index.js +1 -1
  71. package/api/entities/TickerReservation/index.js.map +1 -1
  72. package/api/entities/Venue/index.js +2 -2
  73. package/api/entities/Venue/index.js.map +1 -1
  74. package/api/entities/common/namespaces/Authorizations.d.ts +2 -2
  75. package/api/entities/common/namespaces/Authorizations.d.ts.map +1 -1
  76. package/api/entities/common/namespaces/Authorizations.js +1 -1
  77. package/api/entities/common/namespaces/Authorizations.js.map +1 -1
  78. package/api/procedures/addAssetRequirement.d.ts.map +1 -1
  79. package/api/procedures/addAssetRequirement.js +1 -1
  80. package/api/procedures/addAssetRequirement.js.map +1 -1
  81. package/api/procedures/addInstruction.d.ts.map +1 -1
  82. package/api/procedures/addInstruction.js +9 -10
  83. package/api/procedures/addInstruction.js.map +1 -1
  84. package/api/procedures/addInvestorUniquenessClaim.js +1 -1
  85. package/api/procedures/addInvestorUniquenessClaim.js.map +1 -1
  86. package/api/procedures/addTransferRestriction.d.ts +13 -3
  87. package/api/procedures/addTransferRestriction.d.ts.map +1 -1
  88. package/api/procedures/addTransferRestriction.js +98 -30
  89. package/api/procedures/addTransferRestriction.js.map +1 -1
  90. package/api/procedures/claimClassicTicker.js +1 -1
  91. package/api/procedures/claimClassicTicker.js.map +1 -1
  92. package/api/procedures/configureDividendDistribution.js +1 -1
  93. package/api/procedures/configureDividendDistribution.js.map +1 -1
  94. package/api/procedures/createAsset.d.ts +3 -8
  95. package/api/procedures/createAsset.d.ts.map +1 -1
  96. package/api/procedures/createAsset.js +114 -54
  97. package/api/procedures/createAsset.js.map +1 -1
  98. package/api/procedures/createGroup.d.ts +1 -6
  99. package/api/procedures/createGroup.d.ts.map +1 -1
  100. package/api/procedures/createGroup.js +4 -28
  101. package/api/procedures/createGroup.js.map +1 -1
  102. package/api/procedures/createPortfolio.js +1 -1
  103. package/api/procedures/createPortfolio.js.map +1 -1
  104. package/api/procedures/createVenue.js +1 -1
  105. package/api/procedures/createVenue.js.map +1 -1
  106. package/api/procedures/initiateCorporateAction.d.ts +5 -5
  107. package/api/procedures/initiateCorporateAction.d.ts.map +1 -1
  108. package/api/procedures/initiateCorporateAction.js +1 -1
  109. package/api/procedures/initiateCorporateAction.js.map +1 -1
  110. package/api/procedures/inviteExternalAgent.d.ts +4 -1
  111. package/api/procedures/inviteExternalAgent.d.ts.map +1 -1
  112. package/api/procedures/inviteExternalAgent.js +33 -13
  113. package/api/procedures/inviteExternalAgent.js.map +1 -1
  114. package/api/procedures/launchOffering.js +1 -1
  115. package/api/procedures/launchOffering.js.map +1 -1
  116. package/api/procedures/leaveIdentity.d.ts.map +1 -1
  117. package/api/procedures/leaveIdentity.js +3 -4
  118. package/api/procedures/leaveIdentity.js.map +1 -1
  119. package/api/procedures/linkCaDocs.d.ts.map +1 -1
  120. package/api/procedures/linkCaDocs.js.map +1 -1
  121. package/api/procedures/modifyAsset.d.ts.map +1 -1
  122. package/api/procedures/modifyAsset.js +4 -2
  123. package/api/procedures/modifyAsset.js.map +1 -1
  124. package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts.map +1 -1
  125. package/api/procedures/modifyAssetTrustedClaimIssuers.js.map +1 -1
  126. package/api/procedures/modifyCaDefaultConfig.d.ts.map +1 -1
  127. package/api/procedures/modifyCaDefaultConfig.js +8 -7
  128. package/api/procedures/modifyCaDefaultConfig.js.map +1 -1
  129. package/api/procedures/modifyClaims.d.ts.map +1 -1
  130. package/api/procedures/modifyClaims.js.map +1 -1
  131. package/api/procedures/modifyInstructionAffirmation.d.ts.map +1 -1
  132. package/api/procedures/modifyInstructionAffirmation.js.map +1 -1
  133. package/api/procedures/modifyOfferingTimes.d.ts.map +1 -1
  134. package/api/procedures/modifyOfferingTimes.js.map +1 -1
  135. package/api/procedures/modifyVenue.js +1 -1
  136. package/api/procedures/modifyVenue.js.map +1 -1
  137. package/api/procedures/removeCorporateAction.d.ts.map +1 -1
  138. package/api/procedures/removeCorporateAction.js +1 -1
  139. package/api/procedures/removeCorporateAction.js.map +1 -1
  140. package/api/procedures/removeSecondaryAccounts.js +1 -1
  141. package/api/procedures/removeSecondaryAccounts.js.map +1 -1
  142. package/api/procedures/renamePortfolio.d.ts.map +1 -1
  143. package/api/procedures/renamePortfolio.js +1 -1
  144. package/api/procedures/renamePortfolio.js.map +1 -1
  145. package/api/procedures/setPermissionGroup.d.ts +8 -5
  146. package/api/procedures/setPermissionGroup.d.ts.map +1 -1
  147. package/api/procedures/setPermissionGroup.js +42 -23
  148. package/api/procedures/setPermissionGroup.js.map +1 -1
  149. package/api/procedures/setTransferRestrictions.d.ts +6 -7
  150. package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
  151. package/api/procedures/setTransferRestrictions.js +133 -122
  152. package/api/procedures/setTransferRestrictions.js.map +1 -1
  153. package/api/procedures/utils.d.ts +20 -2
  154. package/api/procedures/utils.d.ts.map +1 -1
  155. package/api/procedures/utils.js +59 -12
  156. package/api/procedures/utils.js.map +1 -1
  157. package/base/Context.d.ts +3 -8
  158. package/base/Context.d.ts.map +1 -1
  159. package/base/Context.js +40 -58
  160. package/base/Context.js.map +1 -1
  161. package/base/PolymeshTransactionBase.d.ts +4 -0
  162. package/base/PolymeshTransactionBase.d.ts.map +1 -1
  163. package/base/PolymeshTransactionBase.js +7 -0
  164. package/base/PolymeshTransactionBase.js.map +1 -1
  165. package/generated/types.d.ts +512 -0
  166. package/generated/types.d.ts.map +1 -1
  167. package/generated/types.js +557 -1
  168. package/generated/types.js.map +1 -1
  169. package/index.d.ts +1 -1
  170. package/index.d.ts.map +1 -1
  171. package/index.js +1 -1
  172. package/index.js.map +1 -1
  173. package/internal.d.ts +1 -1
  174. package/internal.d.ts.map +1 -1
  175. package/internal.js.map +1 -1
  176. package/middleware/types.d.ts +1 -0
  177. package/middleware/types.d.ts.map +1 -1
  178. package/middleware/types.js +1 -0
  179. package/middleware/types.js.map +1 -1
  180. package/npm-package/polymeshassociation-polymesh-sdk-15.0.0-alpha.11.tgz +0 -0
  181. package/package.json +71 -13
  182. package/polkadot/asset/definitions.js +12 -12
  183. package/polkadot/asset/definitions.js.map +1 -1
  184. package/polkadot/augment-api-consts.d.ts +127 -43
  185. package/polkadot/augment-api-consts.d.ts.map +1 -1
  186. package/polkadot/augment-api-errors.d.ts +286 -16
  187. package/polkadot/augment-api-errors.d.ts.map +1 -1
  188. package/polkadot/augment-api-events.d.ts +1102 -465
  189. package/polkadot/augment-api-events.d.ts.map +1 -1
  190. package/polkadot/augment-api-query.d.ts +746 -545
  191. package/polkadot/augment-api-query.d.ts.map +1 -1
  192. package/polkadot/augment-api-rpc.d.ts +50 -17
  193. package/polkadot/augment-api-rpc.d.ts.map +1 -1
  194. package/polkadot/augment-api-tx.d.ts +1445 -1003
  195. package/polkadot/augment-api-tx.d.ts.map +1 -1
  196. package/polkadot/augment-api.d.ts +0 -1
  197. package/polkadot/augment-api.d.ts.map +1 -1
  198. package/polkadot/augment-api.js +0 -1
  199. package/polkadot/augment-api.js.map +1 -1
  200. package/polkadot/augment-types.d.ts +213 -2220
  201. package/polkadot/augment-types.d.ts.map +1 -1
  202. package/polkadot/compliance/definitions.js +2 -2
  203. package/polkadot/compliance/definitions.js.map +1 -1
  204. package/polkadot/identity/definitions.js +4 -4
  205. package/polkadot/identity/definitions.js.map +1 -1
  206. package/polkadot/lookup.d.ts +4439 -0
  207. package/polkadot/lookup.d.ts.map +1 -0
  208. package/polkadot/lookup.js +5125 -0
  209. package/polkadot/lookup.js.map +1 -0
  210. package/polkadot/polymesh/definitions.d.ts +106 -36
  211. package/polkadot/polymesh/definitions.d.ts.map +1 -1
  212. package/polkadot/polymesh/definitions.js +111 -41
  213. package/polkadot/polymesh/definitions.js.map +1 -1
  214. package/polkadot/polymesh/types.d.ts +216 -61
  215. package/polkadot/polymesh/types.d.ts.map +1 -1
  216. package/polkadot/registry.d.ts +385 -0
  217. package/polkadot/registry.d.ts.map +1 -0
  218. package/polkadot/registry.js +5 -0
  219. package/polkadot/registry.js.map +1 -0
  220. package/polkadot/schema.d.ts +106 -36
  221. package/polkadot/schema.d.ts.map +1 -1
  222. package/polkadot/schema.js +129 -59
  223. package/polkadot/schema.js.map +1 -1
  224. package/polkadot/types-lookup.d.ts +5578 -0
  225. package/polkadot/types-lookup.d.ts.map +1 -0
  226. package/polkadot/types-lookup.js +4 -0
  227. package/polkadot/types-lookup.js.map +1 -0
  228. package/polkadot/types.d.ts +0 -464
  229. package/polkadot/types.d.ts.map +1 -1
  230. package/polkadot/types.js +0 -505
  231. package/polkadot/types.js.map +1 -1
  232. package/types/index.d.ts +14 -5
  233. package/types/index.d.ts.map +1 -1
  234. package/types/index.js +3 -1
  235. package/types/index.js.map +1 -1
  236. package/types/internal.d.ts +10 -2
  237. package/types/internal.d.ts.map +1 -1
  238. package/types/internal.js +6 -1
  239. package/types/internal.js.map +1 -1
  240. package/types/utils/index.d.ts +11 -0
  241. package/types/utils/index.d.ts.map +1 -1
  242. package/types/utils/index.js +2 -0
  243. package/types/utils/index.js.map +1 -1
  244. package/utils/constants.d.ts +13 -2
  245. package/utils/constants.d.ts.map +1 -1
  246. package/utils/constants.js +14 -3
  247. package/utils/constants.js.map +1 -1
  248. package/utils/conversion.d.ts +96 -78
  249. package/utils/conversion.d.ts.map +1 -1
  250. package/utils/conversion.js +521 -464
  251. package/utils/conversion.js.map +1 -1
  252. package/utils/index.d.ts +1 -1
  253. package/utils/index.d.ts.map +1 -1
  254. package/utils/index.js +2 -1
  255. package/utils/index.js.map +1 -1
  256. package/utils/internal.d.ts +4 -4
  257. package/utils/internal.d.ts.map +1 -1
  258. package/utils/internal.js +90 -15
  259. package/utils/internal.js.map +1 -1
  260. package/utils/typeguards.d.ts.map +1 -1
  261. package/utils/typeguards.js +1 -0
  262. package/utils/typeguards.js.map +1 -1
  263. package/AccountManagement.d.ts.map +0 -1
  264. package/AccountManagement.js.map +0 -1
  265. package/Assets.d.ts.map +0 -1
  266. package/Assets.js.map +0 -1
  267. package/Claims.d.ts.map +0 -1
  268. package/Claims.js.map +0 -1
  269. package/Identities.d.ts.map +0 -1
  270. package/Identities.js.map +0 -1
  271. package/Network.d.ts.map +0 -1
  272. package/Network.js.map +0 -1
  273. package/Polymesh.d.ts.map +0 -1
  274. package/Polymesh.js.map +0 -1
  275. package/Settlements.d.ts.map +0 -1
  276. package/Settlements.js.map +0 -1
  277. package/npm-package/polymeshassociation-polymesh-sdk-14.0.0-beta.11.tgz +0 -0
@@ -17,19 +17,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.authorizationToAuthorizationData = exports.agentGroupToPermissionGroupIdentifier = exports.permissionGroupIdentifierToAgentGroup = exports.u8ToBigNumber = exports.u32ToBigNumber = exports.bigNumberToU32 = exports.meshPermissionsToPermissions = exports.extrinsicPermissionsToTransactionPermissions = exports.permissionsToMeshPermissions = exports.transactionPermissionsToExtrinsicPermissions = exports.transactionPermissionsToTxGroups = exports.txGroupToTxTags = exports.textToString = exports.stringToText = exports.portfolioIdToMeshPortfolioId = exports.portfolioLikeToPortfolio = exports.portfolioIdToPortfolio = exports.portfolioLikeToPortfolioId = exports.portfolioToPortfolioId = exports.meshPortfolioIdToPortfolio = exports.permillToBigNumber = exports.percentageToPermill = exports.bigNumberToU64 = exports.u64ToBigNumber = exports.signerToString = exports.signerValueToSigner = exports.signerToSignerValue = exports.signatoryToSignerValue = exports.signerValueToSignatory = exports.signatoryToAccount = exports.stringToEcdsaSignature = exports.identityIdToString = exports.stringToIdentityId = exports.stringToBlockHash = exports.stringToHash = exports.hashToString = exports.accountIdToString = exports.stringToAccountId = exports.momentToDate = exports.dateToMoment = exports.stringToInvestorZKProofData = exports.tickerToString = exports.stringToTicker = exports.bytesToString = exports.stringToBytes = exports.boolToBoolean = exports.booleanToBool = exports.assetNameToString = exports.stringToAssetName = exports.tickerToDid = void 0;
21
- exports.extrinsicIdentifierToTxTag = exports.txTagToExtrinsicIdentifier = exports.txTagToProtocolOp = exports.complianceRequirementToRequirement = exports.complianceRequirementResultToRequirementCompliance = exports.requirementToComplianceRequirement = exports.trustedClaimIssuerToTrustedIssuer = exports.trustedIssuerToTrustedClaimIssuer = exports.meshClaimTypeToClaimType = exports.stringToTargetIdentity = exports.meshClaimToClaim = exports.middlewareEventToEventIdentifier = exports.scopeToMiddlewareScope = exports.middlewareScopeToScope = exports.claimToMeshClaim = exports.scopeIdToString = exports.stringToScopeId = exports.cddIdToString = exports.stringToCddId = exports.meshScopeToScope = exports.scopeToMeshScope = exports.canTransferResultToTransferStatus = exports.cddStatusToBoolean = exports.documentToAssetDocument = exports.assetDocumentToDocument = exports.documentHashToString = exports.stringToDocumentHash = exports.documentUriToString = exports.stringToDocumentUri = exports.documentTypeToString = exports.stringToDocumentType = exports.documentNameToString = exports.stringToDocumentName = exports.fundingRoundNameToString = exports.stringToFundingRoundName = exports.assetIdentifierToSecurityIdentifier = exports.securityIdentifierToAssetIdentifier = exports.isLeiValid = exports.isCusipValid = exports.isIsinValid = exports.posRatioToBigNumber = exports.assetTypeToKnownOrId = exports.internalAssetTypeToAssetType = exports.u8ToTransferStatus = exports.stringToMemo = exports.authorizationDataToAuthorization = exports.agentGroupToPermissionGroup = exports.balanceToBigNumber = exports.bigNumberToBalance = exports.authorizationTypeToMeshAuthorizationType = void 0;
22
- exports.corporateActionIdentifierToCaId = exports.distributionToDividendDistributionParams = exports.targetsToTargetIdentities = exports.targetIdentitiesToCorporateActionTargets = exports.scopeClaimProofToMeshScopeClaimProof = exports.checkpointToRecordDateSpec = exports.stringToScalar = exports.corporateActionKindToCaKind = exports.stringToRistrettoPoint = exports.meshCorporateActionToCorporateActionParams = exports.stringToSignature = exports.storedScheduleToCheckpointScheduleParams = exports.scheduleSpecToMeshScheduleSpec = exports.meshCalendarPeriodToCalendarPeriod = exports.calendarPeriodToMeshCalendarPeriod = exports.fundraiserToOfferingDetails = exports.fundraiserTierToTier = exports.middlewarePortfolioToPortfolio = exports.permissionsLikeToPermissions = exports.offeringTierToPriceTier = exports.granularCanTransferResultToTransferBreakdown = exports.transferManagerToTransferRestriction = exports.transferRestrictionToTransferManager = exports.claimTypeToMeshClaimType = exports.portfolioMovementToMovePortfolioItem = exports.toIdentityWithClaimsArray = exports.endConditionToSettlementType = exports.meshAffirmationStatusToAffirmationStatus = exports.meshInstructionStatusToInstructionStatus = exports.venueDetailsToString = exports.stringToVenueDetails = exports.venueTypeToMeshVenueType = exports.meshVenueTypeToVenueType = exports.secondaryAccountToMeshSecondaryKey = exports.transactionToTxTag = exports.transactionHexToTxTag = exports.addressToKey = exports.keyToAddress = exports.moduleAddressToString = exports.assetComplianceResultToCompliance = void 0;
20
+ exports.permissionGroupIdentifierToAgentGroup = exports.u8ToBigNumber = exports.u16ToBigNumber = exports.u32ToBigNumber = exports.bigNumberToU32 = exports.meshPermissionsToPermissions = exports.extrinsicPermissionsToTransactionPermissions = exports.permissionsToMeshPermissions = exports.transactionPermissionsToExtrinsicPermissions = exports.transactionPermissionsToTxGroups = exports.txGroupToTxTags = exports.textToString = exports.stringToText = exports.portfolioIdToMeshPortfolioId = exports.portfolioLikeToPortfolio = exports.portfolioIdToPortfolio = exports.portfolioLikeToPortfolioId = exports.portfolioToPortfolioId = exports.meshPortfolioIdToPortfolio = exports.permillToBigNumber = exports.percentageToPermill = exports.bigNumberToU128 = exports.bigNumberToU64 = exports.u128ToBigNumber = exports.u64ToBigNumber = exports.signerToString = exports.signerValueToSigner = exports.signerToSignerValue = exports.signatoryToSignerValue = exports.signerValueToSignatory = exports.accountIdToAccount = exports.stringToEcdsaSignature = exports.identityIdToString = exports.stringToIdentityId = exports.stringToBlockHash = exports.stringToHash = exports.hashToString = exports.accountIdToString = exports.stringToAccountId = exports.momentToDate = exports.dateToMoment = exports.stringToInvestorZKProofData = exports.tickerToString = exports.stringToTickerKey = exports.stringToTicker = exports.bytesToString = exports.stringToBytes = exports.boolToBoolean = exports.booleanToBool = exports.tickerToDid = void 0;
21
+ exports.transactionHexToTxTag = exports.addressToKey = exports.keyToAddress = exports.moduleAddressToString = exports.assetComplianceResultToCompliance = exports.extrinsicIdentifierToTxTag = exports.txTagToExtrinsicIdentifier = exports.txTagToProtocolOp = exports.complianceRequirementToRequirement = exports.complianceRequirementResultToRequirementCompliance = exports.requirementToComplianceRequirement = exports.trustedClaimIssuerToTrustedIssuer = exports.trustedIssuerToTrustedClaimIssuer = exports.meshClaimTypeToClaimType = exports.stringToTargetIdentity = exports.meshClaimToClaim = exports.middlewareEventToEventIdentifier = exports.scopeToMiddlewareScope = exports.middlewareScopeToScope = exports.claimToMeshClaim = exports.scopeIdToString = exports.stringToScopeId = exports.cddIdToString = exports.stringToCddId = exports.meshScopeToScope = exports.scopeToMeshScope = exports.canTransferResultToTransferStatus = exports.cddStatusToBoolean = exports.documentToAssetDocument = exports.assetDocumentToDocument = exports.documentHashToString = exports.stringToDocumentHash = exports.assetIdentifierToSecurityIdentifier = exports.securityIdentifierToAssetIdentifier = exports.isFigiValid = exports.isLeiValid = exports.isCusipValid = exports.isIsinValid = exports.posRatioToBigNumber = exports.assetTypeToKnownOrId = exports.internalAssetTypeToAssetType = exports.u8ToTransferStatus = exports.stringToMemo = exports.authorizationDataToAuthorization = exports.agentGroupToPermissionGroup = exports.balanceToBigNumber = exports.bigNumberToBalance = exports.authorizationTypeToMeshAuthorizationType = exports.authorizationToAuthorizationData = exports.agentGroupToPermissionGroupIdentifier = void 0;
22
+ exports.toExemptKey = exports.complianceConditionsToBtreeSet = exports.createStat2ndKey = exports.statisticsOpTypeToStatOpType = exports.meshStatToStatisticsOpType = exports.statUpdatesToBtreeStatUpdate = exports.statUpdate = exports.statisticsOpTypeToStatType = exports.corporateActionIdentifierToCaId = exports.distributionToDividendDistributionParams = exports.targetsToTargetIdentities = exports.targetIdentitiesToCorporateActionTargets = exports.scopeClaimProofToConfidentialIdentityClaimProof = exports.checkpointToRecordDateSpec = exports.stringToScalar = exports.corporateActionKindToCaKind = exports.stringToRistrettoPoint = exports.meshCorporateActionToCorporateActionParams = exports.stringToSignature = exports.storedScheduleToCheckpointScheduleParams = exports.scheduleSpecToMeshScheduleSpec = exports.meshCalendarPeriodToCalendarPeriod = exports.calendarPeriodToMeshCalendarPeriod = exports.fundraiserToOfferingDetails = exports.fundraiserTierToTier = exports.middlewarePortfolioToPortfolio = exports.permissionsLikeToPermissions = exports.offeringTierToPriceTier = exports.granularCanTransferResultToTransferBreakdown = exports.transferConditionToTransferRestriction = exports.scopeIdsToBtreeSetIdentityId = exports.transferRestrictionToPolymeshTransferCondition = exports.claimTypeToMeshClaimType = exports.portfolioMovementToMovePortfolioItem = exports.toIdentityWithClaimsArray = exports.endConditionToSettlementType = exports.meshAffirmationStatusToAffirmationStatus = exports.meshInstructionStatusToInstructionStatus = exports.venueTypeToMeshVenueType = exports.meshVenueTypeToVenueType = exports.secondaryAccountToMeshSecondaryKey = exports.transactionToTxTag = void 0;
23
23
  const util_1 = require("@polkadot/util");
24
24
  const util_crypto_1 = require("@polkadot/util-crypto");
25
25
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
26
26
  const iso_7064_1 = require("iso-7064");
27
27
  const lodash_1 = require("lodash");
28
- const types_1 = require("../polkadot/types");
29
28
  const utils_1 = require("../generated/utils");
30
29
  const internal_1 = require("../internal");
31
- const types_2 = require("../middleware/types");
32
- const types_3 = require("../types");
30
+ const types_1 = require("../middleware/types");
31
+ const types_2 = require("../types");
33
32
  const internal_2 = require("../types/internal");
34
33
  const utils_2 = require("../types/utils");
35
34
  const constants_1 = require("./constants");
@@ -43,20 +42,6 @@ function tickerToDid(ticker) {
43
42
  return (0, util_crypto_1.blake2AsHex)((0, util_1.u8aConcat)((0, util_1.stringToU8a)('SECURITY_TOKEN:'), (0, util_1.u8aFixLength)((0, util_1.stringToU8a)(ticker), 96, true)));
44
43
  }
45
44
  exports.tickerToDid = tickerToDid;
46
- /**
47
- * @hidden
48
- */
49
- function stringToAssetName(name, context) {
50
- return context.createType('AssetName', name);
51
- }
52
- exports.stringToAssetName = stringToAssetName;
53
- /**
54
- * @hidden
55
- */
56
- function assetNameToString(name) {
57
- return name.toString();
58
- }
59
- exports.assetNameToString = assetNameToString;
60
45
  /**
61
46
  * @hidden
62
47
  */
@@ -90,9 +75,16 @@ exports.bytesToString = bytesToString;
90
75
  */
91
76
  function stringToTicker(ticker, context) {
92
77
  (0, internal_3.assertTickerValid)(ticker);
93
- return context.createType('Ticker', (0, internal_3.padString)(ticker, constants_1.MAX_TICKER_LENGTH));
78
+ return context.createType('PolymeshPrimitivesTicker', (0, internal_3.padString)(ticker, constants_1.MAX_TICKER_LENGTH));
94
79
  }
95
80
  exports.stringToTicker = stringToTicker;
81
+ /**
82
+ * @hidden
83
+ */
84
+ function stringToTickerKey(ticker, context) {
85
+ return { Ticker: stringToTicker(ticker, context) };
86
+ }
87
+ exports.stringToTickerKey = stringToTickerKey;
96
88
  /**
97
89
  * @hidden
98
90
  */
@@ -113,7 +105,7 @@ exports.stringToInvestorZKProofData = stringToInvestorZKProofData;
113
105
  * @hidden
114
106
  */
115
107
  function dateToMoment(date, context) {
116
- return context.createType('Moment', date.getTime());
108
+ return context.createType('u64', date.getTime());
117
109
  }
118
110
  exports.dateToMoment = dateToMoment;
119
111
  /**
@@ -163,7 +155,7 @@ exports.stringToBlockHash = stringToBlockHash;
163
155
  * @hidden
164
156
  */
165
157
  function stringToIdentityId(identityId, context) {
166
- return context.createType('IdentityId', identityId);
158
+ return context.createType('PolymeshPrimitivesIdentityId', identityId);
167
159
  }
168
160
  exports.stringToIdentityId = stringToIdentityId;
169
161
  /**
@@ -183,16 +175,10 @@ exports.stringToEcdsaSignature = stringToEcdsaSignature;
183
175
  /**
184
176
  * @hidden
185
177
  */
186
- function signatoryToAccount(signatory, context) {
187
- if (signatory.isAccount) {
188
- return new internal_1.Account({ address: accountIdToString(signatory.asAccount) }, context);
189
- }
190
- throw new internal_1.PolymeshError({
191
- code: types_3.ErrorCode.UnexpectedError,
192
- message: 'Received an Identity where an Account was expected. Please report this issue to the Polymath team',
193
- });
178
+ function accountIdToAccount(accountId, context) {
179
+ return new internal_1.Account({ address: accountId.toString() }, context);
194
180
  }
195
- exports.signatoryToAccount = signatoryToAccount;
181
+ exports.accountIdToAccount = accountIdToAccount;
196
182
  /**
197
183
  * @hidden
198
184
  */
@@ -216,9 +202,9 @@ function createSignerValue(type, value) {
216
202
  */
217
203
  function signatoryToSignerValue(signatory) {
218
204
  if (signatory.isAccount) {
219
- return createSignerValue(types_3.SignerType.Account, accountIdToString(signatory.asAccount));
205
+ return createSignerValue(types_2.SignerType.Account, accountIdToString(signatory.asAccount));
220
206
  }
221
- return createSignerValue(types_3.SignerType.Identity, identityIdToString(signatory.asIdentity));
207
+ return createSignerValue(types_2.SignerType.Identity, identityIdToString(signatory.asIdentity));
222
208
  }
223
209
  exports.signatoryToSignerValue = signatoryToSignerValue;
224
210
  /**
@@ -226,9 +212,9 @@ exports.signatoryToSignerValue = signatoryToSignerValue;
226
212
  */
227
213
  function signerToSignerValue(signer) {
228
214
  if (signer instanceof internal_1.Account) {
229
- return createSignerValue(types_3.SignerType.Account, signer.address);
215
+ return createSignerValue(types_2.SignerType.Account, signer.address);
230
216
  }
231
- return createSignerValue(types_3.SignerType.Identity, signer.did);
217
+ return createSignerValue(types_2.SignerType.Identity, signer.did);
232
218
  }
233
219
  exports.signerToSignerValue = signerToSignerValue;
234
220
  /**
@@ -236,7 +222,7 @@ exports.signerToSignerValue = signerToSignerValue;
236
222
  */
237
223
  function signerValueToSigner(signerValue, context) {
238
224
  const { type, value } = signerValue;
239
- if (type === types_3.SignerType.Account) {
225
+ if (type === types_2.SignerType.Account) {
240
226
  return new internal_1.Account({ address: value }, context);
241
227
  }
242
228
  return new internal_1.Identity({ did: value }, context);
@@ -259,6 +245,13 @@ function u64ToBigNumber(value) {
259
245
  return new bignumber_js_1.default(value.toString());
260
246
  }
261
247
  exports.u64ToBigNumber = u64ToBigNumber;
248
+ /**
249
+ * @hidden
250
+ */
251
+ function u128ToBigNumber(value) {
252
+ return new bignumber_js_1.default(value.toString());
253
+ }
254
+ exports.u128ToBigNumber = u128ToBigNumber;
262
255
  /**
263
256
  * @hidden
264
257
  */
@@ -268,6 +261,15 @@ function bigNumberToU64(value, context) {
268
261
  return context.createType('u64', value.toString());
269
262
  }
270
263
  exports.bigNumberToU64 = bigNumberToU64;
264
+ /**
265
+ * @hidden
266
+ */
267
+ function bigNumberToU128(value, context) {
268
+ (0, internal_3.assertIsInteger)(value);
269
+ (0, internal_3.assertIsPositive)(value);
270
+ return context.createType('u128', value.toString());
271
+ }
272
+ exports.bigNumberToU128 = bigNumberToU128;
271
273
  /**
272
274
  * @hidden
273
275
  */
@@ -275,7 +277,7 @@ function percentageToPermill(value, context) {
275
277
  (0, internal_3.assertIsPositive)(value);
276
278
  if (value.gt(100)) {
277
279
  throw new internal_1.PolymeshError({
278
- code: types_3.ErrorCode.ValidationError,
280
+ code: types_2.ErrorCode.ValidationError,
279
281
  message: "Percentage shouldn't exceed 100",
280
282
  });
281
283
  }
@@ -364,7 +366,6 @@ function portfolioIdToMeshPortfolioId(portfolioId, context) {
364
366
  const { did, number } = portfolioId;
365
367
  return context.createType('PortfolioId', {
366
368
  did: stringToIdentityId(did, context),
367
- // eslint-disable-next-line @typescript-eslint/naming-convention
368
369
  kind: number ? { User: bigNumberToU64(number, context) } : 'Default',
369
370
  });
370
371
  }
@@ -388,85 +389,85 @@ exports.textToString = textToString;
388
389
  */
389
390
  function txGroupToTxTags(group) {
390
391
  switch (group) {
391
- case types_3.TxGroup.PortfolioManagement: {
392
+ case types_2.TxGroup.PortfolioManagement: {
392
393
  return [
393
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
394
- types_1.TxTags.portfolio.MovePortfolioFunds,
395
- types_1.TxTags.settlement.AddInstruction,
396
- types_1.TxTags.settlement.AddAndAffirmInstruction,
397
- types_1.TxTags.settlement.AffirmInstruction,
398
- types_1.TxTags.settlement.RejectInstruction,
399
- types_1.TxTags.settlement.CreateVenue,
394
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
395
+ types_2.TxTags.portfolio.MovePortfolioFunds,
396
+ types_2.TxTags.settlement.AddInstruction,
397
+ types_2.TxTags.settlement.AddAndAffirmInstruction,
398
+ types_2.TxTags.settlement.AffirmInstruction,
399
+ types_2.TxTags.settlement.RejectInstruction,
400
+ types_2.TxTags.settlement.CreateVenue,
400
401
  ];
401
402
  }
402
- case types_3.TxGroup.AssetManagement: {
403
+ case types_2.TxGroup.AssetManagement: {
403
404
  return [
404
- types_1.TxTags.asset.MakeDivisible,
405
- types_1.TxTags.asset.RenameAsset,
406
- types_1.TxTags.asset.SetFundingRound,
407
- types_1.TxTags.asset.AddDocuments,
408
- types_1.TxTags.asset.RemoveDocuments,
405
+ types_2.TxTags.asset.MakeDivisible,
406
+ types_2.TxTags.asset.RenameAsset,
407
+ types_2.TxTags.asset.SetFundingRound,
408
+ types_2.TxTags.asset.AddDocuments,
409
+ types_2.TxTags.asset.RemoveDocuments,
409
410
  ];
410
411
  }
411
- case types_3.TxGroup.AdvancedAssetManagement: {
412
+ case types_2.TxGroup.AdvancedAssetManagement: {
412
413
  return [
413
- types_1.TxTags.asset.Freeze,
414
- types_1.TxTags.asset.Unfreeze,
415
- types_1.TxTags.identity.AddAuthorization,
416
- types_1.TxTags.identity.RemoveAuthorization,
414
+ types_2.TxTags.asset.Freeze,
415
+ types_2.TxTags.asset.Unfreeze,
416
+ types_2.TxTags.identity.AddAuthorization,
417
+ types_2.TxTags.identity.RemoveAuthorization,
417
418
  ];
418
419
  }
419
- case types_3.TxGroup.Distribution: {
420
+ case types_2.TxGroup.Distribution: {
420
421
  return [
421
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
422
- types_1.TxTags.settlement.CreateVenue,
423
- types_1.TxTags.settlement.AddInstruction,
424
- types_1.TxTags.settlement.AddAndAffirmInstruction,
422
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
423
+ types_2.TxTags.settlement.CreateVenue,
424
+ types_2.TxTags.settlement.AddInstruction,
425
+ types_2.TxTags.settlement.AddAndAffirmInstruction,
425
426
  ];
426
427
  }
427
- case types_3.TxGroup.Issuance: {
428
- return [types_1.TxTags.asset.Issue];
428
+ case types_2.TxGroup.Issuance: {
429
+ return [types_2.TxTags.asset.Issue];
429
430
  }
430
- case types_3.TxGroup.TrustedClaimIssuersManagement: {
431
+ case types_2.TxGroup.TrustedClaimIssuersManagement: {
431
432
  return [
432
- types_1.TxTags.complianceManager.AddDefaultTrustedClaimIssuer,
433
- types_1.TxTags.complianceManager.RemoveDefaultTrustedClaimIssuer,
433
+ types_2.TxTags.complianceManager.AddDefaultTrustedClaimIssuer,
434
+ types_2.TxTags.complianceManager.RemoveDefaultTrustedClaimIssuer,
434
435
  ];
435
436
  }
436
- case types_3.TxGroup.ClaimsManagement: {
437
- return [types_1.TxTags.identity.AddClaim, types_1.TxTags.identity.RevokeClaim];
437
+ case types_2.TxGroup.ClaimsManagement: {
438
+ return [types_2.TxTags.identity.AddClaim, types_2.TxTags.identity.RevokeClaim];
438
439
  }
439
- case types_3.TxGroup.ComplianceRequirementsManagement: {
440
+ case types_2.TxGroup.ComplianceRequirementsManagement: {
440
441
  return [
441
- types_1.TxTags.complianceManager.AddComplianceRequirement,
442
- types_1.TxTags.complianceManager.RemoveComplianceRequirement,
443
- types_1.TxTags.complianceManager.PauseAssetCompliance,
444
- types_1.TxTags.complianceManager.ResumeAssetCompliance,
445
- types_1.TxTags.complianceManager.ResetAssetCompliance,
442
+ types_2.TxTags.complianceManager.AddComplianceRequirement,
443
+ types_2.TxTags.complianceManager.RemoveComplianceRequirement,
444
+ types_2.TxTags.complianceManager.PauseAssetCompliance,
445
+ types_2.TxTags.complianceManager.ResumeAssetCompliance,
446
+ types_2.TxTags.complianceManager.ResetAssetCompliance,
446
447
  ];
447
448
  }
448
- case types_3.TxGroup.CorporateActionsManagement: {
449
+ case types_2.TxGroup.CorporateActionsManagement: {
449
450
  return [
450
- types_1.TxTags.checkpoint.CreateSchedule,
451
- types_1.TxTags.checkpoint.RemoveSchedule,
452
- types_1.TxTags.checkpoint.CreateCheckpoint,
453
- types_1.TxTags.corporateAction.InitiateCorporateAction,
454
- types_1.TxTags.capitalDistribution.Distribute,
455
- types_1.TxTags.capitalDistribution.Claim,
456
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
451
+ types_2.TxTags.checkpoint.CreateSchedule,
452
+ types_2.TxTags.checkpoint.RemoveSchedule,
453
+ types_2.TxTags.checkpoint.CreateCheckpoint,
454
+ types_2.TxTags.corporateAction.InitiateCorporateAction,
455
+ types_2.TxTags.capitalDistribution.Distribute,
456
+ types_2.TxTags.capitalDistribution.Claim,
457
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
457
458
  ];
458
459
  }
459
- case types_3.TxGroup.StoManagement: {
460
+ case types_2.TxGroup.StoManagement: {
460
461
  return [
461
- types_1.TxTags.sto.CreateFundraiser,
462
- types_1.TxTags.sto.FreezeFundraiser,
463
- types_1.TxTags.sto.Invest,
464
- types_1.TxTags.sto.ModifyFundraiserWindow,
465
- types_1.TxTags.sto.Stop,
466
- types_1.TxTags.sto.UnfreezeFundraiser,
467
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
468
- types_1.TxTags.asset.Issue,
469
- types_1.TxTags.settlement.CreateVenue,
462
+ types_2.TxTags.sto.CreateFundraiser,
463
+ types_2.TxTags.sto.FreezeFundraiser,
464
+ types_2.TxTags.sto.Invest,
465
+ types_2.TxTags.sto.ModifyFundraiserWindow,
466
+ types_2.TxTags.sto.Stop,
467
+ types_2.TxTags.sto.UnfreezeFundraiser,
468
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
469
+ types_2.TxTags.asset.Issue,
470
+ types_2.TxTags.settlement.CreateVenue,
470
471
  ];
471
472
  }
472
473
  }
@@ -485,7 +486,7 @@ function transactionPermissionsToTxGroups(permissions) {
485
486
  const { values: transactionValues, type, exceptions = [] } = permissions;
486
487
  let includedTags;
487
488
  let excludedTags;
488
- if (type === types_3.PermissionType.Include) {
489
+ if (type === types_2.PermissionType.Include) {
489
490
  includedTags = transactionValues;
490
491
  excludedTags = exceptions;
491
492
  }
@@ -493,7 +494,7 @@ function transactionPermissionsToTxGroups(permissions) {
493
494
  includedTags = exceptions;
494
495
  excludedTags = transactionValues;
495
496
  }
496
- return (0, lodash_1.values)(types_3.TxGroup)
497
+ return (0, lodash_1.values)(types_2.TxGroup)
497
498
  .sort()
498
499
  .filter(group => {
499
500
  const tagsInGroup = txGroupToTxTags(group);
@@ -529,7 +530,7 @@ function initExtrinsicDict(txValues, message) {
529
530
  let pallet = extrinsicDict[palletName];
530
531
  if (pallet === null) {
531
532
  throw new internal_1.PolymeshError({
532
- code: types_3.ErrorCode.ValidationError,
533
+ code: types_2.ErrorCode.ValidationError,
533
534
  message,
534
535
  data: {
535
536
  module: palletName,
@@ -561,7 +562,7 @@ function buildPalletPermissions(transactions) {
561
562
  const pallet = extrinsicDict[palletName];
562
563
  if (pallet === undefined) {
563
564
  throw new internal_1.PolymeshError({
564
- code: types_3.ErrorCode.ValidationError,
565
+ code: types_2.ErrorCode.ValidationError,
565
566
  message: 'Attempting to add a transaction permission exception without its corresponding module being included/excluded',
566
567
  });
567
568
  }
@@ -573,7 +574,7 @@ function buildPalletPermissions(transactions) {
573
574
  }
574
575
  else {
575
576
  throw new internal_1.PolymeshError({
576
- code: types_3.ErrorCode.ValidationError,
577
+ code: types_2.ErrorCode.ValidationError,
577
578
  message: 'Cannot simultaneously include and exclude transactions belonging to the same module',
578
579
  });
579
580
  }
@@ -603,7 +604,7 @@ function buildPalletPermissions(transactions) {
603
604
  /* eslint-enable @typescript-eslint/naming-convention */
604
605
  };
605
606
  });
606
- if (type === types_3.PermissionType.Include) {
607
+ if (type === types_2.PermissionType.Include) {
607
608
  extrinsic = {
608
609
  These: pallets,
609
610
  };
@@ -619,7 +620,7 @@ function buildPalletPermissions(transactions) {
619
620
  * @hidden
620
621
  */
621
622
  function transactionPermissionsToExtrinsicPermissions(transactionPermissions, context) {
622
- return context.createType('ExtrinsicPermissions', transactionPermissions ? buildPalletPermissions(transactionPermissions) : 'Whole');
623
+ return context.createType('PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions', transactionPermissions ? buildPalletPermissions(transactionPermissions) : 'Whole');
623
624
  }
624
625
  exports.transactionPermissionsToExtrinsicPermissions = transactionPermissionsToExtrinsicPermissions;
625
626
  /**
@@ -633,7 +634,7 @@ function permissionsToMeshPermissions(permissions, context) {
633
634
  const { values: assetValues, type } = assets;
634
635
  assetValues.sort(({ ticker: tickerA }, { ticker: tickerB }) => tickerA.localeCompare(tickerB));
635
636
  const tickers = assetValues.map(({ ticker }) => stringToTicker(ticker, context));
636
- if (type === types_3.PermissionType.Include) {
637
+ if (type === types_2.PermissionType.Include) {
637
638
  asset = {
638
639
  These: tickers,
639
640
  };
@@ -648,7 +649,7 @@ function permissionsToMeshPermissions(permissions, context) {
648
649
  if (portfolios) {
649
650
  const { values: portfolioValues, type } = portfolios;
650
651
  const portfolioIds = portfolioValues.map(pValue => portfolioIdToMeshPortfolioId(portfolioToPortfolioId(pValue), context));
651
- if (type === types_3.PermissionType.Include) {
652
+ if (type === types_2.PermissionType.Include) {
652
653
  portfolio = {
653
654
  These: portfolioIds,
654
655
  };
@@ -674,27 +675,35 @@ function extrinsicPermissionsToTransactionPermissions(permissions) {
674
675
  let extrinsicType;
675
676
  let pallets;
676
677
  if (permissions.isThese) {
677
- extrinsicType = types_3.PermissionType.Include;
678
+ extrinsicType = types_2.PermissionType.Include;
678
679
  pallets = permissions.asThese;
679
680
  }
680
681
  else if (permissions.isExcept) {
681
- extrinsicType = types_3.PermissionType.Exclude;
682
+ extrinsicType = types_2.PermissionType.Exclude;
682
683
  pallets = permissions.asExcept;
683
684
  }
684
685
  let txValues = [];
685
686
  let exceptions = [];
686
- const formatTxTag = (dispatchable, moduleName) => `${moduleName}.${(0, lodash_1.camelCase)(textToString(dispatchable))}`;
687
+ const formatTxTag = (dispatchable, moduleName) => {
688
+ return `${moduleName}.${(0, lodash_1.camelCase)(dispatchable)}`;
689
+ };
687
690
  if (pallets) {
688
- pallets.forEach(({ pallet_name: palletName, dispatchable_names: dispatchableNames }) => {
689
- const moduleName = (0, util_1.stringLowerFirst)(textToString(palletName));
691
+ pallets.forEach(({ palletName, dispatchableNames }) => {
692
+ const moduleName = (0, util_1.stringLowerFirst)(bytesToString(palletName));
690
693
  if (dispatchableNames.isExcept) {
691
694
  const dispatchables = dispatchableNames.asExcept;
692
- exceptions = [...exceptions, ...dispatchables.map(name => formatTxTag(name, moduleName))];
695
+ exceptions = [
696
+ ...exceptions,
697
+ ...dispatchables.map(name => formatTxTag(bytesToString(name), moduleName)),
698
+ ];
693
699
  txValues = [...txValues, moduleName];
694
700
  }
695
701
  else if (dispatchableNames.isThese) {
696
702
  const dispatchables = dispatchableNames.asThese;
697
- txValues = [...txValues, ...dispatchables.map(name => formatTxTag(name, moduleName))];
703
+ txValues = [
704
+ ...txValues,
705
+ ...dispatchables.map(name => formatTxTag(bytesToString(name), moduleName)),
706
+ ];
698
707
  }
699
708
  else {
700
709
  txValues = [...txValues, moduleName];
@@ -721,11 +730,11 @@ function meshPermissionsToPermissions(permissions, context) {
721
730
  let assetsType;
722
731
  let assetsPermissions;
723
732
  if (asset.isThese) {
724
- assetsType = types_3.PermissionType.Include;
733
+ assetsType = types_2.PermissionType.Include;
725
734
  assetsPermissions = asset.asThese;
726
735
  }
727
736
  else if (asset.isExcept) {
728
- assetsType = types_3.PermissionType.Exclude;
737
+ assetsType = types_2.PermissionType.Exclude;
729
738
  assetsPermissions = asset.asExcept;
730
739
  }
731
740
  if (assetsPermissions) {
@@ -739,11 +748,11 @@ function meshPermissionsToPermissions(permissions, context) {
739
748
  let portfoliosType;
740
749
  let portfolioIds;
741
750
  if (portfolio.isThese) {
742
- portfoliosType = types_3.PermissionType.Include;
751
+ portfoliosType = types_2.PermissionType.Include;
743
752
  portfolioIds = portfolio.asThese;
744
753
  }
745
754
  else if (portfolio.isExcept) {
746
- portfoliosType = types_3.PermissionType.Exclude;
755
+ portfoliosType = types_2.PermissionType.Exclude;
747
756
  portfolioIds = portfolio.asExcept;
748
757
  }
749
758
  if (portfolioIds) {
@@ -777,6 +786,13 @@ function u32ToBigNumber(value) {
777
786
  return new bignumber_js_1.default(value.toString());
778
787
  }
779
788
  exports.u32ToBigNumber = u32ToBigNumber;
789
+ /**
790
+ * @hidden
791
+ */
792
+ function u16ToBigNumber(value) {
793
+ return new bignumber_js_1.default(value.toString());
794
+ }
795
+ exports.u16ToBigNumber = u16ToBigNumber;
780
796
  /**
781
797
  * @hidden
782
798
  */
@@ -798,16 +814,16 @@ exports.permissionGroupIdentifierToAgentGroup = permissionGroupIdentifierToAgent
798
814
  */
799
815
  function agentGroupToPermissionGroupIdentifier(agentGroup) {
800
816
  if (agentGroup.isFull) {
801
- return types_3.PermissionGroupType.Full;
817
+ return types_2.PermissionGroupType.Full;
802
818
  }
803
819
  else if (agentGroup.isExceptMeta) {
804
- return types_3.PermissionGroupType.ExceptMeta;
820
+ return types_2.PermissionGroupType.ExceptMeta;
805
821
  }
806
- else if (agentGroup.isPolymeshV1Caa) {
807
- return types_3.PermissionGroupType.PolymeshV1Caa;
822
+ else if (agentGroup.isPolymeshV1CAA) {
823
+ return types_2.PermissionGroupType.PolymeshV1Caa;
808
824
  }
809
- else if (agentGroup.isPolymeshV1Pia) {
810
- return types_3.PermissionGroupType.PolymeshV1Pia;
825
+ else if (agentGroup.isPolymeshV1PIA) {
826
+ return types_2.PermissionGroupType.PolymeshV1Pia;
811
827
  }
812
828
  else {
813
829
  return { custom: u32ToBigNumber(agentGroup.asCustom) };
@@ -820,23 +836,23 @@ exports.agentGroupToPermissionGroupIdentifier = agentGroupToPermissionGroupIdent
820
836
  function authorizationToAuthorizationData(auth, context) {
821
837
  let value;
822
838
  const { type } = auth;
823
- if (type === types_3.AuthorizationType.RotatePrimaryKey) {
839
+ if (type === types_2.AuthorizationType.RotatePrimaryKey) {
824
840
  value = null;
825
841
  }
826
- else if (type === types_3.AuthorizationType.JoinIdentity) {
842
+ else if (type === types_2.AuthorizationType.JoinIdentity) {
827
843
  value = permissionsToMeshPermissions(auth.value, context);
828
844
  }
829
- else if (type === types_3.AuthorizationType.PortfolioCustody) {
845
+ else if (type === types_2.AuthorizationType.PortfolioCustody) {
830
846
  value = portfolioIdToMeshPortfolioId(portfolioToPortfolioId(auth.value), context);
831
847
  }
832
- else if (auth.type === types_3.AuthorizationType.TransferAssetOwnership ||
833
- auth.type === types_3.AuthorizationType.TransferTicker) {
848
+ else if (auth.type === types_2.AuthorizationType.TransferAssetOwnership ||
849
+ auth.type === types_2.AuthorizationType.TransferTicker) {
834
850
  value = stringToTicker(auth.value, context);
835
851
  }
836
- else if (type === types_3.AuthorizationType.RotatePrimaryKeyToSecondary) {
852
+ else if (type === types_2.AuthorizationType.RotatePrimaryKeyToSecondary) {
837
853
  value = permissionsToMeshPermissions(auth.value, context);
838
854
  }
839
- else if (type === types_3.AuthorizationType.BecomeAgent) {
855
+ else if (type === types_2.AuthorizationType.BecomeAgent) {
840
856
  const ticker = stringToTicker(auth.value.asset.ticker, context);
841
857
  if (auth.value instanceof internal_1.CustomPermissionGroup) {
842
858
  const { id } = auth.value;
@@ -850,7 +866,7 @@ function authorizationToAuthorizationData(auth, context) {
850
866
  else {
851
867
  value = auth.value;
852
868
  }
853
- return context.createType('AuthorizationData', {
869
+ return context.createType('PolymeshPrimitivesAuthorizationAuthorizationData', {
854
870
  [type]: value,
855
871
  });
856
872
  }
@@ -869,7 +885,7 @@ function bigNumberToBalance(value, context, divisible = true) {
869
885
  (0, internal_3.assertIsPositive)(value);
870
886
  if (value.isGreaterThan(constants_1.MAX_BALANCE)) {
871
887
  throw new internal_1.PolymeshError({
872
- code: types_3.ErrorCode.ValidationError,
888
+ code: types_2.ErrorCode.ValidationError,
873
889
  message: 'The value exceeds the maximum possible balance',
874
890
  data: {
875
891
  currentValue: value,
@@ -880,7 +896,7 @@ function bigNumberToBalance(value, context, divisible = true) {
880
896
  if (divisible) {
881
897
  if (value.decimalPlaces() > constants_1.MAX_DECIMALS) {
882
898
  throw new internal_1.PolymeshError({
883
- code: types_3.ErrorCode.ValidationError,
899
+ code: types_2.ErrorCode.ValidationError,
884
900
  message: 'The value has more decimal places than allowed',
885
901
  data: {
886
902
  currentValue: value,
@@ -892,7 +908,7 @@ function bigNumberToBalance(value, context, divisible = true) {
892
908
  else {
893
909
  if (value.decimalPlaces()) {
894
910
  throw new internal_1.PolymeshError({
895
- code: types_3.ErrorCode.ValidationError,
911
+ code: types_2.ErrorCode.ValidationError,
896
912
  message: 'The value has decimals but the Asset is indivisible',
897
913
  });
898
914
  }
@@ -913,10 +929,10 @@ exports.balanceToBigNumber = balanceToBigNumber;
913
929
  function agentGroupToPermissionGroup(agentGroup, ticker, context) {
914
930
  const permissionGroupIdentifier = agentGroupToPermissionGroupIdentifier(agentGroup);
915
931
  switch (permissionGroupIdentifier) {
916
- case types_3.PermissionGroupType.ExceptMeta:
917
- case types_3.PermissionGroupType.Full:
918
- case types_3.PermissionGroupType.PolymeshV1Caa:
919
- case types_3.PermissionGroupType.PolymeshV1Pia: {
932
+ case types_2.PermissionGroupType.ExceptMeta:
933
+ case types_2.PermissionGroupType.Full:
934
+ case types_2.PermissionGroupType.PolymeshV1Caa:
935
+ case types_2.PermissionGroupType.PolymeshV1Pia: {
920
936
  return new internal_1.KnownPermissionGroup({ type: permissionGroupIdentifier, ticker }, context);
921
937
  }
922
938
  default: {
@@ -932,49 +948,49 @@ exports.agentGroupToPermissionGroup = agentGroupToPermissionGroup;
932
948
  function authorizationDataToAuthorization(auth, context) {
933
949
  if (auth.isAttestPrimaryKeyRotation) {
934
950
  return {
935
- type: types_3.AuthorizationType.AttestPrimaryKeyRotation,
951
+ type: types_2.AuthorizationType.AttestPrimaryKeyRotation,
936
952
  value: identityIdToString(auth.asAttestPrimaryKeyRotation),
937
953
  };
938
954
  }
939
955
  if (auth.isRotatePrimaryKey) {
940
956
  return {
941
- type: types_3.AuthorizationType.RotatePrimaryKey,
957
+ type: types_2.AuthorizationType.RotatePrimaryKey,
942
958
  };
943
959
  }
944
960
  if (auth.isTransferTicker) {
945
961
  return {
946
- type: types_3.AuthorizationType.TransferTicker,
962
+ type: types_2.AuthorizationType.TransferTicker,
947
963
  value: tickerToString(auth.asTransferTicker),
948
964
  };
949
965
  }
950
966
  if (auth.isAddMultiSigSigner) {
951
967
  return {
952
- type: types_3.AuthorizationType.AddMultiSigSigner,
968
+ type: types_2.AuthorizationType.AddMultiSigSigner,
953
969
  value: accountIdToString(auth.asAddMultiSigSigner),
954
970
  };
955
971
  }
956
972
  if (auth.isTransferAssetOwnership) {
957
973
  return {
958
- type: types_3.AuthorizationType.TransferAssetOwnership,
974
+ type: types_2.AuthorizationType.TransferAssetOwnership,
959
975
  value: tickerToString(auth.asTransferAssetOwnership),
960
976
  };
961
977
  }
962
978
  if (auth.isPortfolioCustody) {
963
979
  return {
964
- type: types_3.AuthorizationType.PortfolioCustody,
980
+ type: types_2.AuthorizationType.PortfolioCustody,
965
981
  value: meshPortfolioIdToPortfolio(auth.asPortfolioCustody, context),
966
982
  };
967
983
  }
968
984
  if (auth.isJoinIdentity) {
969
985
  return {
970
- type: types_3.AuthorizationType.JoinIdentity,
986
+ type: types_2.AuthorizationType.JoinIdentity,
971
987
  value: meshPermissionsToPermissions(auth.asJoinIdentity, context),
972
988
  };
973
989
  }
974
990
  if (auth.isAddRelayerPayingKey) {
975
991
  const [userKey, payingKey, polyxLimit] = auth.asAddRelayerPayingKey;
976
992
  return {
977
- type: types_3.AuthorizationType.AddRelayerPayingKey,
993
+ type: types_2.AuthorizationType.AddRelayerPayingKey,
978
994
  value: {
979
995
  beneficiary: new internal_1.Account({ address: accountIdToString(userKey) }, context),
980
996
  subsidizer: new internal_1.Account({ address: accountIdToString(payingKey) }, context),
@@ -985,18 +1001,18 @@ function authorizationDataToAuthorization(auth, context) {
985
1001
  if (auth.isBecomeAgent) {
986
1002
  const [ticker, agentGroup] = auth.asBecomeAgent;
987
1003
  return {
988
- type: types_3.AuthorizationType.BecomeAgent,
1004
+ type: types_2.AuthorizationType.BecomeAgent,
989
1005
  value: agentGroupToPermissionGroup(agentGroup, tickerToString(ticker), context),
990
1006
  };
991
1007
  }
992
1008
  if (auth.isRotatePrimaryKeyToSecondary) {
993
1009
  return {
994
- type: types_3.AuthorizationType.RotatePrimaryKeyToSecondary,
1010
+ type: types_2.AuthorizationType.RotatePrimaryKeyToSecondary,
995
1011
  value: meshPermissionsToPermissions(auth.asRotatePrimaryKeyToSecondary, context),
996
1012
  };
997
1013
  }
998
1014
  throw new internal_1.PolymeshError({
999
- code: types_3.ErrorCode.UnexpectedError,
1015
+ code: types_2.ErrorCode.UnexpectedError,
1000
1016
  message: 'Unsupported Authorization Type. Please contact the Polymath team',
1001
1017
  data: {
1002
1018
  auth: JSON.stringify(auth, null, 2),
@@ -1010,7 +1026,7 @@ exports.authorizationDataToAuthorization = authorizationDataToAuthorization;
1010
1026
  function stringToMemo(value, context) {
1011
1027
  if (value.length > constants_1.MAX_MEMO_LENGTH) {
1012
1028
  throw new internal_1.PolymeshError({
1013
- code: types_3.ErrorCode.ValidationError,
1029
+ code: types_2.ErrorCode.ValidationError,
1014
1030
  message: 'Max memo length exceeded',
1015
1031
  data: {
1016
1032
  maxLength: constants_1.MAX_MEMO_LENGTH,
@@ -1027,71 +1043,71 @@ function u8ToTransferStatus(status) {
1027
1043
  const code = status.toNumber();
1028
1044
  switch (code) {
1029
1045
  case 81: {
1030
- return types_3.TransferStatus.Success;
1046
+ return types_2.TransferStatus.Success;
1031
1047
  }
1032
1048
  case 82: {
1033
- return types_3.TransferStatus.InsufficientBalance;
1049
+ return types_2.TransferStatus.InsufficientBalance;
1034
1050
  }
1035
1051
  case 83: {
1036
- return types_3.TransferStatus.InsufficientAllowance;
1052
+ return types_2.TransferStatus.InsufficientAllowance;
1037
1053
  }
1038
1054
  case 84: {
1039
- return types_3.TransferStatus.TransfersHalted;
1055
+ return types_2.TransferStatus.TransfersHalted;
1040
1056
  }
1041
1057
  case 85: {
1042
- return types_3.TransferStatus.FundsLocked;
1058
+ return types_2.TransferStatus.FundsLocked;
1043
1059
  }
1044
1060
  case 86: {
1045
- return types_3.TransferStatus.InvalidSenderAddress;
1061
+ return types_2.TransferStatus.InvalidSenderAddress;
1046
1062
  }
1047
1063
  case 87: {
1048
- return types_3.TransferStatus.InvalidReceiverAddress;
1064
+ return types_2.TransferStatus.InvalidReceiverAddress;
1049
1065
  }
1050
1066
  case 88: {
1051
- return types_3.TransferStatus.InvalidOperator;
1067
+ return types_2.TransferStatus.InvalidOperator;
1052
1068
  }
1053
1069
  case 160: {
1054
- return types_3.TransferStatus.InvalidSenderIdentity;
1070
+ return types_2.TransferStatus.InvalidSenderIdentity;
1055
1071
  }
1056
1072
  case 161: {
1057
- return types_3.TransferStatus.InvalidReceiverIdentity;
1073
+ return types_2.TransferStatus.InvalidReceiverIdentity;
1058
1074
  }
1059
1075
  case 162: {
1060
- return types_3.TransferStatus.ComplianceFailure;
1076
+ return types_2.TransferStatus.ComplianceFailure;
1061
1077
  }
1062
1078
  case 163: {
1063
- return types_3.TransferStatus.SmartExtensionFailure;
1079
+ return types_2.TransferStatus.SmartExtensionFailure;
1064
1080
  }
1065
1081
  case 164: {
1066
- return types_3.TransferStatus.InvalidGranularity;
1082
+ return types_2.TransferStatus.InvalidGranularity;
1067
1083
  }
1068
1084
  case 165: {
1069
- return types_3.TransferStatus.VolumeLimitReached;
1085
+ return types_2.TransferStatus.VolumeLimitReached;
1070
1086
  }
1071
1087
  case 166: {
1072
- return types_3.TransferStatus.BlockedTransaction;
1088
+ return types_2.TransferStatus.BlockedTransaction;
1073
1089
  }
1074
1090
  case 168: {
1075
- return types_3.TransferStatus.FundsLimitReached;
1091
+ return types_2.TransferStatus.FundsLimitReached;
1076
1092
  }
1077
1093
  case 169: {
1078
- return types_3.TransferStatus.PortfolioFailure;
1094
+ return types_2.TransferStatus.PortfolioFailure;
1079
1095
  }
1080
1096
  case 170: {
1081
- return types_3.TransferStatus.CustodianError;
1097
+ return types_2.TransferStatus.CustodianError;
1082
1098
  }
1083
1099
  case 171: {
1084
- return types_3.TransferStatus.ScopeClaimMissing;
1100
+ return types_2.TransferStatus.ScopeClaimMissing;
1085
1101
  }
1086
1102
  case 172: {
1087
- return types_3.TransferStatus.TransferRestrictionFailure;
1103
+ return types_2.TransferStatus.TransferRestrictionFailure;
1088
1104
  }
1089
1105
  case 80: {
1090
- return types_3.TransferStatus.Failure;
1106
+ return types_2.TransferStatus.Failure;
1091
1107
  }
1092
1108
  default: {
1093
1109
  throw new internal_1.PolymeshError({
1094
- code: types_3.ErrorCode.UnexpectedError,
1110
+ code: types_2.ErrorCode.UnexpectedError,
1095
1111
  message: `Unsupported status code "${status.toString()}". Please report this issue to the Polymath team`,
1096
1112
  });
1097
1113
  }
@@ -1110,34 +1126,34 @@ exports.internalAssetTypeToAssetType = internalAssetTypeToAssetType;
1110
1126
  */
1111
1127
  function assetTypeToKnownOrId(assetType) {
1112
1128
  if (assetType.isEquityCommon) {
1113
- return types_3.KnownAssetType.EquityCommon;
1129
+ return types_2.KnownAssetType.EquityCommon;
1114
1130
  }
1115
1131
  if (assetType.isEquityPreferred) {
1116
- return types_3.KnownAssetType.EquityPreferred;
1132
+ return types_2.KnownAssetType.EquityPreferred;
1117
1133
  }
1118
1134
  if (assetType.isCommodity) {
1119
- return types_3.KnownAssetType.Commodity;
1135
+ return types_2.KnownAssetType.Commodity;
1120
1136
  }
1121
1137
  if (assetType.isFixedIncome) {
1122
- return types_3.KnownAssetType.FixedIncome;
1138
+ return types_2.KnownAssetType.FixedIncome;
1123
1139
  }
1124
1140
  if (assetType.isReit) {
1125
- return types_3.KnownAssetType.Reit;
1141
+ return types_2.KnownAssetType.Reit;
1126
1142
  }
1127
1143
  if (assetType.isFund) {
1128
- return types_3.KnownAssetType.Fund;
1144
+ return types_2.KnownAssetType.Fund;
1129
1145
  }
1130
1146
  if (assetType.isRevenueShareAgreement) {
1131
- return types_3.KnownAssetType.RevenueShareAgreement;
1147
+ return types_2.KnownAssetType.RevenueShareAgreement;
1132
1148
  }
1133
1149
  if (assetType.isStructuredProduct) {
1134
- return types_3.KnownAssetType.StructuredProduct;
1150
+ return types_2.KnownAssetType.StructuredProduct;
1135
1151
  }
1136
1152
  if (assetType.isDerivative) {
1137
- return types_3.KnownAssetType.Derivative;
1153
+ return types_2.KnownAssetType.Derivative;
1138
1154
  }
1139
1155
  if (assetType.isStableCoin) {
1140
- return types_3.KnownAssetType.StableCoin;
1156
+ return types_2.KnownAssetType.StableCoin;
1141
1157
  }
1142
1158
  return u32ToBigNumber(assetType.asCustom);
1143
1159
  }
@@ -1186,14 +1202,8 @@ function isIsinValid(isin) {
1186
1202
  exports.isIsinValid = isIsinValid;
1187
1203
  /**
1188
1204
  * @hidden
1189
- *
1190
- * @note CINS and CUSIP use the same validation
1191
1205
  */
1192
- function isCusipValid(cusip) {
1193
- cusip = cusip.toUpperCase();
1194
- if (!/^[0-9A-Z@#*]{9}$/.test(cusip)) {
1195
- return false;
1196
- }
1206
+ function validateCusipChecksum(cusip) {
1197
1207
  let sum = 0;
1198
1208
  // cSpell: disable-next-line
1199
1209
  const cusipChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#'.split('');
@@ -1216,6 +1226,18 @@ function isCusipValid(cusip) {
1216
1226
  });
1217
1227
  return (10 - (sum % 10)) % 10 === Number(cusip[cusip.length - 1]);
1218
1228
  }
1229
+ /**
1230
+ * @hidden
1231
+ *
1232
+ * @note CINS and CUSIP use the same validation
1233
+ */
1234
+ function isCusipValid(cusip) {
1235
+ cusip = cusip.toUpperCase();
1236
+ if (!/^[0-9A-Z@#*]{9}$/.test(cusip)) {
1237
+ return false;
1238
+ }
1239
+ return validateCusipChecksum(cusip);
1240
+ }
1219
1241
  exports.isCusipValid = isCusipValid;
1220
1242
  /**
1221
1243
  * @hidden
@@ -1228,6 +1250,25 @@ function isLeiValid(lei) {
1228
1250
  return (0, iso_7064_1.computeWithoutCheck)(lei) === 1;
1229
1251
  }
1230
1252
  exports.isLeiValid = isLeiValid;
1253
+ /**
1254
+ * Check if given string is a valid FIGI identifier
1255
+ *
1256
+ * A FIGI consists of three parts:
1257
+ * - a two-character prefix which is a combination of upper case consonants with the following exceptions: BS, BM, GG, GB, GH, KY, VG
1258
+ * - a 'G' as the third character;
1259
+ * - an eight-character combination of upper case consonants and the numerals 0 – 9
1260
+ * - a single check digit
1261
+ * @hidden
1262
+ */
1263
+ function isFigiValid(figi) {
1264
+ figi = figi.toUpperCase();
1265
+ if (['BS', 'BM', 'GG', 'GB', 'GH', 'KY', 'VG'].includes(figi.substring(0, 2)) ||
1266
+ !/^[B-DF-HJ-NP-TV-Z]{2}G[B-DF-HJ-NP-TV-Z0-9]{8}\d$/.test(figi)) {
1267
+ return false;
1268
+ }
1269
+ return validateCusipChecksum(figi);
1270
+ }
1271
+ exports.isFigiValid = isFigiValid;
1231
1272
  /**
1232
1273
  * @hidden
1233
1274
  */
@@ -1235,18 +1276,24 @@ function securityIdentifierToAssetIdentifier(identifier, context) {
1235
1276
  const { type, value } = identifier;
1236
1277
  let error = false;
1237
1278
  switch (type) {
1238
- case types_3.SecurityIdentifierType.Isin: {
1279
+ case types_2.SecurityIdentifierType.Isin: {
1239
1280
  if (!isIsinValid(value)) {
1240
1281
  error = true;
1241
1282
  }
1242
1283
  break;
1243
1284
  }
1244
- case types_3.SecurityIdentifierType.Lei: {
1285
+ case types_2.SecurityIdentifierType.Lei: {
1245
1286
  if (!isLeiValid(value)) {
1246
1287
  error = true;
1247
1288
  }
1248
1289
  break;
1249
1290
  }
1291
+ case types_2.SecurityIdentifierType.Figi: {
1292
+ if (!isFigiValid(value)) {
1293
+ error = true;
1294
+ }
1295
+ break;
1296
+ }
1250
1297
  // CINS and CUSIP use the same validation
1251
1298
  default: {
1252
1299
  if (!isCusipValid(value)) {
@@ -1256,11 +1303,11 @@ function securityIdentifierToAssetIdentifier(identifier, context) {
1256
1303
  }
1257
1304
  if (error) {
1258
1305
  throw new internal_1.PolymeshError({
1259
- code: types_3.ErrorCode.ValidationError,
1306
+ code: types_2.ErrorCode.ValidationError,
1260
1307
  message: `Invalid security identifier ${value} of type ${type}`,
1261
1308
  });
1262
1309
  }
1263
- return context.createType('AssetIdentifier', { [type]: value });
1310
+ return context.createType('PolymeshPrimitivesAssetIdentifier', { [type]: value });
1264
1311
  }
1265
1312
  exports.securityIdentifierToAssetIdentifier = securityIdentifierToAssetIdentifier;
1266
1313
  /**
@@ -1269,94 +1316,44 @@ exports.securityIdentifierToAssetIdentifier = securityIdentifierToAssetIdentifie
1269
1316
  function assetIdentifierToSecurityIdentifier(identifier) {
1270
1317
  if (identifier.isCusip) {
1271
1318
  return {
1272
- type: types_3.SecurityIdentifierType.Cusip,
1319
+ type: types_2.SecurityIdentifierType.Cusip,
1273
1320
  value: (0, util_1.u8aToString)(identifier.asCusip),
1274
1321
  };
1275
1322
  }
1276
1323
  if (identifier.isIsin) {
1277
1324
  return {
1278
- type: types_3.SecurityIdentifierType.Isin,
1325
+ type: types_2.SecurityIdentifierType.Isin,
1279
1326
  value: (0, util_1.u8aToString)(identifier.asIsin),
1280
1327
  };
1281
1328
  }
1282
1329
  if (identifier.isCins) {
1283
1330
  return {
1284
- type: types_3.SecurityIdentifierType.Cins,
1331
+ type: types_2.SecurityIdentifierType.Cins,
1285
1332
  value: (0, util_1.u8aToString)(identifier.asCins),
1286
1333
  };
1287
1334
  }
1335
+ if (identifier.isFigi) {
1336
+ return {
1337
+ type: types_2.SecurityIdentifierType.Figi,
1338
+ value: (0, util_1.u8aToString)(identifier.asFigi),
1339
+ };
1340
+ }
1288
1341
  return {
1289
- type: types_3.SecurityIdentifierType.Lei,
1342
+ type: types_2.SecurityIdentifierType.Lei,
1290
1343
  value: (0, util_1.u8aToString)(identifier.asLei),
1291
1344
  };
1292
1345
  }
1293
1346
  exports.assetIdentifierToSecurityIdentifier = assetIdentifierToSecurityIdentifier;
1294
- /**
1295
- * @hidden
1296
- */
1297
- function stringToFundingRoundName(roundName, context) {
1298
- return context.createType('FundingRoundName', roundName);
1299
- }
1300
- exports.stringToFundingRoundName = stringToFundingRoundName;
1301
- /**
1302
- * @hidden
1303
- */
1304
- function fundingRoundNameToString(roundName) {
1305
- return roundName.toString();
1306
- }
1307
- exports.fundingRoundNameToString = fundingRoundNameToString;
1308
- /**
1309
- * @hidden
1310
- */
1311
- function stringToDocumentName(docName, context) {
1312
- return context.createType('DocumentName', docName);
1313
- }
1314
- exports.stringToDocumentName = stringToDocumentName;
1315
- /**
1316
- * @hidden
1317
- */
1318
- function documentNameToString(docName) {
1319
- return docName.toString();
1320
- }
1321
- exports.documentNameToString = documentNameToString;
1322
- /**
1323
- * @hidden
1324
- */
1325
- function stringToDocumentType(docType, context) {
1326
- return context.createType('DocumentType', docType);
1327
- }
1328
- exports.stringToDocumentType = stringToDocumentType;
1329
- /**
1330
- * @hidden
1331
- */
1332
- function documentTypeToString(docType) {
1333
- return docType.toString();
1334
- }
1335
- exports.documentTypeToString = documentTypeToString;
1336
- /**
1337
- * @hidden
1338
- */
1339
- function stringToDocumentUri(docUri, context) {
1340
- return context.createType('DocumentUri', docUri);
1341
- }
1342
- exports.stringToDocumentUri = stringToDocumentUri;
1343
- /**
1344
- * @hidden
1345
- */
1346
- function documentUriToString(docUri) {
1347
- return docUri.toString();
1348
- }
1349
- exports.documentUriToString = documentUriToString;
1350
1347
  /**
1351
1348
  * @hidden
1352
1349
  */
1353
1350
  function stringToDocumentHash(docHash, context) {
1354
1351
  if (docHash === undefined) {
1355
- return context.createType('DocumentHash', 'None');
1352
+ return context.createType('PolymeshPrimitivesDocumentHash', 'None');
1356
1353
  }
1357
1354
  if (!(0, util_1.isHex)(docHash, -1, true)) {
1358
1355
  throw new internal_1.PolymeshError({
1359
- code: types_3.ErrorCode.ValidationError,
1356
+ code: types_2.ErrorCode.ValidationError,
1360
1357
  message: 'Document hash must be a hexadecimal string prefixed by 0x',
1361
1358
  });
1362
1359
  }
@@ -1369,7 +1366,7 @@ function stringToDocumentHash(docHash, context) {
1369
1366
  const type = hashTypes.find(({ maxLength: max }) => length <= max);
1370
1367
  if (!type) {
1371
1368
  throw new internal_1.PolymeshError({
1372
- code: types_3.ErrorCode.ValidationError,
1369
+ code: types_2.ErrorCode.ValidationError,
1373
1370
  message: 'Document hash exceeds max length',
1374
1371
  });
1375
1372
  }
@@ -1414,27 +1411,25 @@ exports.documentHashToString = documentHashToString;
1414
1411
  * @hidden
1415
1412
  */
1416
1413
  function assetDocumentToDocument({ uri, contentHash, name, filedAt, type }, context) {
1417
- return context.createType('Document', {
1418
- uri: stringToDocumentUri(uri, context),
1419
- name: stringToDocumentName(name, context),
1420
- /* eslint-disable @typescript-eslint/naming-convention */
1421
- content_hash: stringToDocumentHash(contentHash, context),
1422
- doc_type: (0, internal_3.optionize)(stringToDocumentType)(type, context),
1423
- filing_date: (0, internal_3.optionize)(dateToMoment)(filedAt, context),
1424
- /* eslint-enable @typescript-eslint/naming-convention */
1414
+ return context.createType('PolymeshPrimitivesDocument', {
1415
+ uri: stringToBytes(uri, context),
1416
+ name: stringToBytes(name, context),
1417
+ contentHash: stringToDocumentHash(contentHash, context),
1418
+ docType: (0, internal_3.optionize)(stringToBytes)(type, context),
1419
+ filingDate: (0, internal_3.optionize)(dateToMoment)(filedAt, context),
1425
1420
  });
1426
1421
  }
1427
1422
  exports.assetDocumentToDocument = assetDocumentToDocument;
1428
1423
  /**
1429
1424
  * @hidden
1430
1425
  */
1431
- function documentToAssetDocument({ uri, content_hash: hash, name, doc_type: docType, filing_date: filingDate, }) {
1426
+ function documentToAssetDocument({ uri, contentHash: hash, name, docType, filingDate, }) {
1432
1427
  const filedAt = filingDate.unwrapOr(undefined);
1433
1428
  const type = docType.unwrapOr(undefined);
1434
1429
  const contentHash = documentHashToString(hash);
1435
1430
  let doc = {
1436
- uri: documentUriToString(uri),
1437
- name: documentNameToString(name),
1431
+ uri: bytesToString(uri),
1432
+ name: bytesToString(name),
1438
1433
  };
1439
1434
  if (contentHash) {
1440
1435
  doc = Object.assign(Object.assign({}, doc), { contentHash });
@@ -1443,7 +1438,7 @@ function documentToAssetDocument({ uri, content_hash: hash, name, doc_type: docT
1443
1438
  doc = Object.assign(Object.assign({}, doc), { filedAt: momentToDate(filedAt) });
1444
1439
  }
1445
1440
  if (type) {
1446
- doc = Object.assign(Object.assign({}, doc), { type: documentTypeToString(type) });
1441
+ doc = Object.assign(Object.assign({}, doc), { type: bytesToString(type) });
1447
1442
  }
1448
1443
  return doc;
1449
1444
  }
@@ -1464,7 +1459,7 @@ exports.cddStatusToBoolean = cddStatusToBoolean;
1464
1459
  function canTransferResultToTransferStatus(canTransferResult) {
1465
1460
  if (canTransferResult.isErr) {
1466
1461
  throw new internal_1.PolymeshError({
1467
- code: types_3.ErrorCode.UnexpectedError,
1462
+ code: types_2.ErrorCode.UnexpectedError,
1468
1463
  message: `Error while checking transfer validity: ${bytesToString(canTransferResult.asErr)}`,
1469
1464
  });
1470
1465
  }
@@ -1478,10 +1473,10 @@ function scopeToMeshScope(scope, context) {
1478
1473
  const { type, value } = scope;
1479
1474
  let scopeValue;
1480
1475
  switch (type) {
1481
- case types_3.ScopeType.Ticker:
1476
+ case types_2.ScopeType.Ticker:
1482
1477
  scopeValue = stringToTicker(value, context);
1483
1478
  break;
1484
- case types_3.ScopeType.Identity:
1479
+ case types_2.ScopeType.Identity:
1485
1480
  scopeValue = stringToIdentityId(value, context);
1486
1481
  break;
1487
1482
  default:
@@ -1499,18 +1494,18 @@ exports.scopeToMeshScope = scopeToMeshScope;
1499
1494
  function meshScopeToScope(scope) {
1500
1495
  if (scope.isTicker) {
1501
1496
  return {
1502
- type: types_3.ScopeType.Ticker,
1497
+ type: types_2.ScopeType.Ticker,
1503
1498
  value: tickerToString(scope.asTicker),
1504
1499
  };
1505
1500
  }
1506
1501
  if (scope.isIdentity) {
1507
1502
  return {
1508
- type: types_3.ScopeType.Identity,
1503
+ type: types_2.ScopeType.Identity,
1509
1504
  value: identityIdToString(scope.asIdentity),
1510
1505
  };
1511
1506
  }
1512
1507
  return {
1513
- type: types_3.ScopeType.Custom,
1508
+ type: types_2.ScopeType.Custom,
1514
1509
  value: (0, util_1.u8aToString)(scope.asCustom),
1515
1510
  };
1516
1511
  }
@@ -1549,25 +1544,29 @@ exports.scopeIdToString = scopeIdToString;
1549
1544
  function claimToMeshClaim(claim, context) {
1550
1545
  let value;
1551
1546
  switch (claim.type) {
1552
- case types_3.ClaimType.NoData: {
1547
+ case types_2.ClaimType.NoData: {
1548
+ value = null;
1549
+ break;
1550
+ }
1551
+ case types_2.ClaimType.NoType: {
1553
1552
  value = null;
1554
1553
  break;
1555
1554
  }
1556
- case types_3.ClaimType.CustomerDueDiligence: {
1555
+ case types_2.ClaimType.CustomerDueDiligence: {
1557
1556
  value = stringToCddId(claim.id, context);
1558
1557
  break;
1559
1558
  }
1560
- case types_3.ClaimType.Jurisdiction: {
1559
+ case types_2.ClaimType.Jurisdiction: {
1561
1560
  const { code, scope } = claim;
1562
1561
  value = (0, utils_2.tuple)(code, scopeToMeshScope(scope, context));
1563
1562
  break;
1564
1563
  }
1565
- case types_3.ClaimType.InvestorUniqueness: {
1564
+ case types_2.ClaimType.InvestorUniqueness: {
1566
1565
  const { scope, cddId, scopeId } = claim;
1567
1566
  value = (0, utils_2.tuple)(scopeToMeshScope(scope, context), stringToScopeId(scopeId, context), stringToCddId(cddId, context));
1568
1567
  break;
1569
1568
  }
1570
- case types_3.ClaimType.InvestorUniquenessV2: {
1569
+ case types_2.ClaimType.InvestorUniquenessV2: {
1571
1570
  value = stringToCddId(claim.cddId, context);
1572
1571
  break;
1573
1572
  }
@@ -1584,12 +1583,12 @@ exports.claimToMeshClaim = claimToMeshClaim;
1584
1583
  function middlewareScopeToScope(scope) {
1585
1584
  const { type, value } = scope;
1586
1585
  switch (type) {
1587
- case types_2.ClaimScopeTypeEnum.Ticker:
1586
+ case types_1.ClaimScopeTypeEnum.Ticker:
1588
1587
  // eslint-disable-next-line no-control-regex
1589
- return { type: types_3.ScopeType.Ticker, value: (0, internal_3.removePadding)(value) };
1590
- case types_2.ClaimScopeTypeEnum.Identity:
1591
- case types_2.ClaimScopeTypeEnum.Custom:
1592
- return { type: types_3.ScopeType[scope.type], value };
1588
+ return { type: types_2.ScopeType.Ticker, value: (0, internal_3.removePadding)(value) };
1589
+ case types_1.ClaimScopeTypeEnum.Identity:
1590
+ case types_1.ClaimScopeTypeEnum.Custom:
1591
+ return { type: types_2.ScopeType[scope.type], value };
1593
1592
  }
1594
1593
  }
1595
1594
  exports.middlewareScopeToScope = middlewareScopeToScope;
@@ -1599,11 +1598,11 @@ exports.middlewareScopeToScope = middlewareScopeToScope;
1599
1598
  function scopeToMiddlewareScope(scope) {
1600
1599
  const { type, value } = scope;
1601
1600
  switch (type) {
1602
- case types_3.ScopeType.Ticker:
1603
- return { type: types_2.ClaimScopeTypeEnum.Ticker, value: (0, lodash_1.padEnd)(value, 12, '\0') };
1604
- case types_3.ScopeType.Identity:
1605
- case types_3.ScopeType.Custom:
1606
- return { type: types_2.ClaimScopeTypeEnum[scope.type], value };
1601
+ case types_2.ScopeType.Ticker:
1602
+ return { type: types_1.ClaimScopeTypeEnum.Ticker, value: (0, lodash_1.padEnd)(value, 12, '\0') };
1603
+ case types_2.ScopeType.Identity:
1604
+ case types_2.ScopeType.Custom:
1605
+ return { type: types_1.ClaimScopeTypeEnum[scope.type], value };
1607
1606
  }
1608
1607
  }
1609
1608
  exports.scopeToMiddlewareScope = scopeToMiddlewareScope;
@@ -1629,62 +1628,62 @@ function meshClaimToClaim(claim) {
1629
1628
  if (claim.isJurisdiction) {
1630
1629
  const [code, scope] = claim.asJurisdiction;
1631
1630
  return {
1632
- type: types_3.ClaimType.Jurisdiction,
1631
+ type: types_2.ClaimType.Jurisdiction,
1633
1632
  code: (0, utils_1.meshCountryCodeToCountryCode)(code),
1634
1633
  scope: meshScopeToScope(scope),
1635
1634
  };
1636
1635
  }
1637
1636
  if (claim.isNoData) {
1638
1637
  return {
1639
- type: types_3.ClaimType.NoData,
1638
+ type: types_2.ClaimType.NoData,
1640
1639
  };
1641
1640
  }
1642
1641
  if (claim.isAccredited) {
1643
1642
  return {
1644
- type: types_3.ClaimType.Accredited,
1643
+ type: types_2.ClaimType.Accredited,
1645
1644
  scope: meshScopeToScope(claim.asAccredited),
1646
1645
  };
1647
1646
  }
1648
1647
  if (claim.isAffiliate) {
1649
1648
  return {
1650
- type: types_3.ClaimType.Affiliate,
1649
+ type: types_2.ClaimType.Affiliate,
1651
1650
  scope: meshScopeToScope(claim.asAffiliate),
1652
1651
  };
1653
1652
  }
1654
1653
  if (claim.isBuyLockup) {
1655
1654
  return {
1656
- type: types_3.ClaimType.BuyLockup,
1655
+ type: types_2.ClaimType.BuyLockup,
1657
1656
  scope: meshScopeToScope(claim.asBuyLockup),
1658
1657
  };
1659
1658
  }
1660
1659
  if (claim.isSellLockup) {
1661
1660
  return {
1662
- type: types_3.ClaimType.SellLockup,
1661
+ type: types_2.ClaimType.SellLockup,
1663
1662
  scope: meshScopeToScope(claim.asSellLockup),
1664
1663
  };
1665
1664
  }
1666
1665
  if (claim.isCustomerDueDiligence) {
1667
1666
  return {
1668
- type: types_3.ClaimType.CustomerDueDiligence,
1667
+ type: types_2.ClaimType.CustomerDueDiligence,
1669
1668
  id: cddIdToString(claim.asCustomerDueDiligence),
1670
1669
  };
1671
1670
  }
1672
1671
  if (claim.isKnowYourCustomer) {
1673
1672
  return {
1674
- type: types_3.ClaimType.KnowYourCustomer,
1673
+ type: types_2.ClaimType.KnowYourCustomer,
1675
1674
  scope: meshScopeToScope(claim.asKnowYourCustomer),
1676
1675
  };
1677
1676
  }
1678
1677
  if (claim.isExempted) {
1679
1678
  return {
1680
- type: types_3.ClaimType.Exempted,
1679
+ type: types_2.ClaimType.Exempted,
1681
1680
  scope: meshScopeToScope(claim.asExempted),
1682
1681
  };
1683
1682
  }
1684
1683
  if (claim.isInvestorUniqueness) {
1685
1684
  const [scope, scopeId, cddId] = claim.asInvestorUniqueness;
1686
1685
  return {
1687
- type: types_3.ClaimType.InvestorUniqueness,
1686
+ type: types_2.ClaimType.InvestorUniqueness,
1688
1687
  scope: meshScopeToScope(scope),
1689
1688
  scopeId: scopeIdToString(scopeId),
1690
1689
  cddId: cddIdToString(cddId),
@@ -1692,12 +1691,12 @@ function meshClaimToClaim(claim) {
1692
1691
  }
1693
1692
  if (claim.isInvestorUniquenessV2) {
1694
1693
  return {
1695
- type: types_3.ClaimType.InvestorUniquenessV2,
1694
+ type: types_2.ClaimType.InvestorUniquenessV2,
1696
1695
  cddId: cddIdToString(claim.asInvestorUniquenessV2),
1697
1696
  };
1698
1697
  }
1699
1698
  return {
1700
- type: types_3.ClaimType.Blocked,
1699
+ type: types_2.ClaimType.Blocked,
1701
1700
  scope: meshScopeToScope(claim.asBlocked),
1702
1701
  };
1703
1702
  }
@@ -1716,40 +1715,40 @@ exports.stringToTargetIdentity = stringToTargetIdentity;
1716
1715
  */
1717
1716
  function meshClaimTypeToClaimType(claimType) {
1718
1717
  if (claimType.isJurisdiction) {
1719
- return types_3.ClaimType.Jurisdiction;
1720
- }
1721
- if (claimType.isNoData) {
1722
- return types_3.ClaimType.NoData;
1718
+ return types_2.ClaimType.Jurisdiction;
1723
1719
  }
1724
1720
  if (claimType.isAccredited) {
1725
- return types_3.ClaimType.Accredited;
1721
+ return types_2.ClaimType.Accredited;
1726
1722
  }
1727
1723
  if (claimType.isAffiliate) {
1728
- return types_3.ClaimType.Affiliate;
1724
+ return types_2.ClaimType.Affiliate;
1729
1725
  }
1730
1726
  if (claimType.isBuyLockup) {
1731
- return types_3.ClaimType.BuyLockup;
1727
+ return types_2.ClaimType.BuyLockup;
1732
1728
  }
1733
1729
  if (claimType.isSellLockup) {
1734
- return types_3.ClaimType.SellLockup;
1730
+ return types_2.ClaimType.SellLockup;
1735
1731
  }
1736
1732
  if (claimType.isCustomerDueDiligence) {
1737
- return types_3.ClaimType.CustomerDueDiligence;
1733
+ return types_2.ClaimType.CustomerDueDiligence;
1738
1734
  }
1739
1735
  if (claimType.isKnowYourCustomer) {
1740
- return types_3.ClaimType.KnowYourCustomer;
1736
+ return types_2.ClaimType.KnowYourCustomer;
1741
1737
  }
1742
1738
  if (claimType.isExempted) {
1743
- return types_3.ClaimType.Exempted;
1739
+ return types_2.ClaimType.Exempted;
1740
+ }
1741
+ if (claimType.isNoType) {
1742
+ return types_2.ClaimType.NoType;
1744
1743
  }
1745
- return types_3.ClaimType.Blocked;
1744
+ return types_2.ClaimType.Blocked;
1746
1745
  }
1747
1746
  exports.meshClaimTypeToClaimType = meshClaimTypeToClaimType;
1748
1747
  /**
1749
1748
  * @hidden
1750
1749
  */
1751
1750
  function trustedIssuerToTrustedClaimIssuer(trustedIssuer, context) {
1752
- const { issuer, trusted_for: claimTypes } = trustedIssuer;
1751
+ const { issuer, trustedFor: claimTypes } = trustedIssuer;
1753
1752
  const identity = new internal_1.Identity({ did: identityIdToString(issuer) }, context);
1754
1753
  let trustedFor = null;
1755
1754
  if (claimTypes.isSpecific) {
@@ -1772,13 +1771,11 @@ function trustedClaimIssuerToTrustedIssuer(issuer, context) {
1772
1771
  trustedFor = 'Any';
1773
1772
  }
1774
1773
  else {
1775
- // eslint-disable-next-line @typescript-eslint/naming-convention
1776
1774
  trustedFor = { Specific: claimTypes };
1777
1775
  }
1778
- return context.createType('TrustedIssuer', {
1776
+ return context.createType('PolymeshPrimitivesConditionTrustedIssuer', {
1779
1777
  issuer: stringToIdentityId(did, context),
1780
- // eslint-disable-next-line @typescript-eslint/naming-convention
1781
- trusted_for: trustedFor,
1778
+ trustedFor,
1782
1779
  });
1783
1780
  }
1784
1781
  exports.trustedClaimIssuerToTrustedIssuer = trustedClaimIssuerToTrustedIssuer;
@@ -1805,30 +1802,27 @@ function requirementToComplianceRequirement(requirement, context) {
1805
1802
  }
1806
1803
  else {
1807
1804
  // IsExternalAgent does not exist as a condition type in Polymesh, it's SDK sugar
1808
- type = types_3.ConditionType.IsIdentity;
1805
+ type = types_2.ConditionType.IsIdentity;
1809
1806
  conditionContent = stringToTargetIdentity(null, context);
1810
1807
  }
1811
1808
  const { target, trustedClaimIssuers = [] } = condition;
1812
- const meshCondition = context.createType('Condition', {
1813
- // eslint-disable-next-line @typescript-eslint/naming-convention
1814
- condition_type: {
1809
+ const meshCondition = context.createType('PolymeshPrimitivesCondition', {
1810
+ conditionType: {
1815
1811
  [type]: conditionContent,
1816
1812
  },
1817
1813
  issuers: trustedClaimIssuers.map(issuer => trustedClaimIssuerToTrustedIssuer(issuer, context)),
1818
1814
  });
1819
- if ([types_3.ConditionTarget.Both, types_3.ConditionTarget.Receiver].includes(target)) {
1815
+ if ([types_2.ConditionTarget.Both, types_2.ConditionTarget.Receiver].includes(target)) {
1820
1816
  receiverConditions.push(meshCondition);
1821
1817
  }
1822
- if ([types_3.ConditionTarget.Both, types_3.ConditionTarget.Sender].includes(target)) {
1818
+ if ([types_2.ConditionTarget.Both, types_2.ConditionTarget.Sender].includes(target)) {
1823
1819
  senderConditions.push(meshCondition);
1824
1820
  }
1825
1821
  });
1826
- return context.createType('ComplianceRequirement', {
1827
- /* eslint-disable @typescript-eslint/naming-convention */
1828
- sender_conditions: senderConditions,
1829
- receiver_conditions: receiverConditions,
1822
+ return context.createType('PolymeshPrimitivesComplianceManagerComplianceRequirement', {
1823
+ senderConditions,
1824
+ receiverConditions,
1830
1825
  id: bigNumberToU32(requirement.id, context),
1831
- /* eslint-enable @typescript-eslint/naming-convention */
1832
1826
  });
1833
1827
  }
1834
1828
  exports.requirementToComplianceRequirement = requirementToComplianceRequirement;
@@ -1838,19 +1832,19 @@ exports.requirementToComplianceRequirement = requirementToComplianceRequirement;
1838
1832
  function meshConditionTypeToCondition(meshConditionType, context) {
1839
1833
  if (meshConditionType.isIsPresent) {
1840
1834
  return {
1841
- type: types_3.ConditionType.IsPresent,
1835
+ type: types_2.ConditionType.IsPresent,
1842
1836
  claim: meshClaimToClaim(meshConditionType.asIsPresent),
1843
1837
  };
1844
1838
  }
1845
1839
  if (meshConditionType.isIsAbsent) {
1846
1840
  return {
1847
- type: types_3.ConditionType.IsAbsent,
1841
+ type: types_2.ConditionType.IsAbsent,
1848
1842
  claim: meshClaimToClaim(meshConditionType.asIsAbsent),
1849
1843
  };
1850
1844
  }
1851
1845
  if (meshConditionType.isIsAnyOf) {
1852
1846
  return {
1853
- type: types_3.ConditionType.IsAnyOf,
1847
+ type: types_2.ConditionType.IsAnyOf,
1854
1848
  claims: meshConditionType.asIsAnyOf.map(claim => meshClaimToClaim(claim)),
1855
1849
  };
1856
1850
  }
@@ -1858,28 +1852,29 @@ function meshConditionTypeToCondition(meshConditionType, context) {
1858
1852
  const target = meshConditionType.asIsIdentity;
1859
1853
  if (target.isExternalAgent) {
1860
1854
  return {
1861
- type: types_3.ConditionType.IsExternalAgent,
1855
+ type: types_2.ConditionType.IsExternalAgent,
1862
1856
  };
1863
1857
  }
1864
1858
  return {
1865
- type: types_3.ConditionType.IsIdentity,
1859
+ type: types_2.ConditionType.IsIdentity,
1866
1860
  identity: new internal_1.Identity({ did: identityIdToString(target.asSpecific) }, context),
1867
1861
  };
1868
1862
  }
1869
1863
  return {
1870
- type: types_3.ConditionType.IsNoneOf,
1864
+ type: types_2.ConditionType.IsNoneOf,
1871
1865
  claims: meshConditionType.asIsNoneOf.map(claim => meshClaimToClaim(claim)),
1872
1866
  };
1873
1867
  }
1874
1868
  /**
1875
1869
  * @hidden
1870
+ * @note - the data for this method comes from an RPC call, which hasn't been updated to the camelCase types
1876
1871
  */
1877
1872
  function complianceRequirementResultToRequirementCompliance(complianceRequirement, context) {
1878
1873
  const conditions = [];
1879
1874
  const conditionCompliancesAreEqual = ({ condition: aCondition, complies: aComplies }, { condition: bCondition, complies: bComplies }) => (0, internal_3.conditionsAreEqual)(aCondition, bCondition) && aComplies === bComplies;
1880
- complianceRequirement.sender_conditions.forEach(({ condition: { condition_type: conditionType, issuers }, result }) => {
1875
+ complianceRequirement.senderConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
1881
1876
  const newCondition = {
1882
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
1877
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
1883
1878
  complies: boolToBoolean(result),
1884
1879
  };
1885
1880
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
@@ -1887,14 +1882,14 @@ function complianceRequirementResultToRequirementCompliance(complianceRequiremen
1887
1882
  conditions.push(newCondition);
1888
1883
  }
1889
1884
  });
1890
- complianceRequirement.receiver_conditions.forEach(({ condition: { condition_type: conditionType, issuers }, result }) => {
1885
+ complianceRequirement.receiverConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
1891
1886
  const newCondition = {
1892
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
1887
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
1893
1888
  complies: boolToBoolean(result),
1894
1889
  };
1895
1890
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
1896
- if (existingCondition && existingCondition.condition.target === types_3.ConditionTarget.Sender) {
1897
- existingCondition.condition.target = types_3.ConditionTarget.Both;
1891
+ if (existingCondition && existingCondition.condition.target === types_2.ConditionTarget.Sender) {
1892
+ existingCondition.condition.target = types_2.ConditionTarget.Both;
1898
1893
  }
1899
1894
  else {
1900
1895
  conditions.push(newCondition);
@@ -1912,8 +1907,8 @@ exports.complianceRequirementResultToRequirementCompliance = complianceRequireme
1912
1907
  */
1913
1908
  function complianceRequirementToRequirement(complianceRequirement, context) {
1914
1909
  const conditions = [];
1915
- complianceRequirement.sender_conditions.forEach(({ condition_type: conditionType, issuers }) => {
1916
- const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Sender });
1910
+ complianceRequirement.senderConditions.forEach(({ conditionType, issuers }) => {
1911
+ const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Sender });
1917
1912
  if (issuers.length) {
1918
1913
  newCondition.trustedClaimIssuers = issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context));
1919
1914
  }
@@ -1922,14 +1917,14 @@ function complianceRequirementToRequirement(complianceRequirement, context) {
1922
1917
  conditions.push(newCondition);
1923
1918
  }
1924
1919
  });
1925
- complianceRequirement.receiver_conditions.forEach(({ condition_type: conditionType, issuers }) => {
1926
- const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Receiver });
1920
+ complianceRequirement.receiverConditions.forEach(({ conditionType, issuers }) => {
1921
+ const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Receiver });
1927
1922
  if (issuers.length) {
1928
1923
  newCondition.trustedClaimIssuers = issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context));
1929
1924
  }
1930
1925
  const existingCondition = conditions.find(condition => (0, internal_3.conditionsAreEqual)(condition, newCondition));
1931
- if (existingCondition && existingCondition.target === types_3.ConditionTarget.Sender) {
1932
- existingCondition.target = types_3.ConditionTarget.Both;
1926
+ if (existingCondition && existingCondition.target === types_2.ConditionTarget.Sender) {
1927
+ existingCondition.target = types_2.ConditionTarget.Both;
1933
1928
  }
1934
1929
  else {
1935
1930
  conditions.push(newCondition);
@@ -1946,25 +1941,25 @@ exports.complianceRequirementToRequirement = complianceRequirementToRequirement;
1946
1941
  */
1947
1942
  function txTagToProtocolOp(tag, context) {
1948
1943
  const protocolOpTags = [
1949
- types_1.TxTags.asset.RegisterTicker,
1950
- types_1.TxTags.asset.Issue,
1951
- types_1.TxTags.asset.AddDocuments,
1952
- types_1.TxTags.asset.CreateAsset,
1953
- types_1.TxTags.capitalDistribution.Distribute,
1954
- types_1.TxTags.checkpoint.CreateSchedule,
1955
- types_1.TxTags.complianceManager.AddComplianceRequirement,
1956
- types_1.TxTags.identity.CddRegisterDid,
1957
- types_1.TxTags.identity.AddClaim,
1958
- types_1.TxTags.identity.AddSecondaryKeysWithAuthorization,
1959
- types_1.TxTags.pips.Propose,
1960
- types_1.TxTags.corporateBallot.AttachBallot,
1961
- types_1.TxTags.capitalDistribution.Distribute,
1944
+ types_2.TxTags.asset.RegisterTicker,
1945
+ types_2.TxTags.asset.Issue,
1946
+ types_2.TxTags.asset.AddDocuments,
1947
+ types_2.TxTags.asset.CreateAsset,
1948
+ types_2.TxTags.capitalDistribution.Distribute,
1949
+ types_2.TxTags.checkpoint.CreateSchedule,
1950
+ types_2.TxTags.complianceManager.AddComplianceRequirement,
1951
+ types_2.TxTags.identity.CddRegisterDid,
1952
+ types_2.TxTags.identity.AddClaim,
1953
+ types_2.TxTags.identity.AddSecondaryKeysWithAuthorization,
1954
+ types_2.TxTags.pips.Propose,
1955
+ types_2.TxTags.corporateBallot.AttachBallot,
1956
+ types_2.TxTags.capitalDistribution.Distribute,
1962
1957
  ];
1963
1958
  const [moduleName, extrinsicName] = tag.split('.');
1964
1959
  const value = `${(0, util_1.stringUpperFirst)(moduleName)}${(0, util_1.stringUpperFirst)(extrinsicName)}`;
1965
1960
  if (!(0, lodash_1.includes)(protocolOpTags, tag)) {
1966
1961
  throw new internal_1.PolymeshError({
1967
- code: types_3.ErrorCode.ValidationError,
1962
+ code: types_2.ErrorCode.ValidationError,
1968
1963
  message: `${value} does not match any ProtocolOp`,
1969
1964
  });
1970
1965
  }
@@ -1988,7 +1983,7 @@ exports.txTagToExtrinsicIdentifier = txTagToExtrinsicIdentifier;
1988
1983
  function extrinsicIdentifierToTxTag(extrinsicIdentifier) {
1989
1984
  const { moduleId, callId } = extrinsicIdentifier;
1990
1985
  let moduleName;
1991
- for (const txTagItem in types_1.TxTags) {
1986
+ for (const txTagItem in types_2.TxTags) {
1992
1987
  if (txTagItem.toLowerCase() === moduleId) {
1993
1988
  moduleName = txTagItem;
1994
1989
  }
@@ -2033,7 +2028,7 @@ exports.addressToKey = addressToKey;
2033
2028
  * @hidden
2034
2029
  */
2035
2030
  function transactionHexToTxTag(bytes, context) {
2036
- const { section, method } = context.createType('Proposal', bytes);
2031
+ const { section, method } = context.createType('Call', bytes);
2037
2032
  return extrinsicIdentifierToTxTag({
2038
2033
  moduleId: section.toLowerCase(),
2039
2034
  callId: method,
@@ -2063,15 +2058,15 @@ exports.secondaryAccountToMeshSecondaryKey = secondaryAccountToMeshSecondaryKey;
2063
2058
  */
2064
2059
  function meshVenueTypeToVenueType(type) {
2065
2060
  if (type.isOther) {
2066
- return types_3.VenueType.Other;
2061
+ return types_2.VenueType.Other;
2067
2062
  }
2068
2063
  if (type.isDistribution) {
2069
- return types_3.VenueType.Distribution;
2064
+ return types_2.VenueType.Distribution;
2070
2065
  }
2071
2066
  if (type.isSto) {
2072
- return types_3.VenueType.Sto;
2067
+ return types_2.VenueType.Sto;
2073
2068
  }
2074
- return types_3.VenueType.Exchange;
2069
+ return types_2.VenueType.Exchange;
2075
2070
  }
2076
2071
  exports.meshVenueTypeToVenueType = meshVenueTypeToVenueType;
2077
2072
  /**
@@ -2081,20 +2076,6 @@ function venueTypeToMeshVenueType(type, context) {
2081
2076
  return context.createType('VenueType', type);
2082
2077
  }
2083
2078
  exports.venueTypeToMeshVenueType = venueTypeToMeshVenueType;
2084
- /**
2085
- * @hidden
2086
- */
2087
- function stringToVenueDetails(details, context) {
2088
- return context.createType('VenueDetails', details);
2089
- }
2090
- exports.stringToVenueDetails = stringToVenueDetails;
2091
- /**
2092
- * @hidden
2093
- */
2094
- function venueDetailsToString(details) {
2095
- return details.toString();
2096
- }
2097
- exports.venueDetailsToString = venueDetailsToString;
2098
2079
  /**
2099
2080
  * @hidden
2100
2081
  */
@@ -2113,12 +2094,12 @@ exports.meshInstructionStatusToInstructionStatus = meshInstructionStatusToInstru
2113
2094
  */
2114
2095
  function meshAffirmationStatusToAffirmationStatus(status) {
2115
2096
  if (status.isUnknown) {
2116
- return types_3.AffirmationStatus.Unknown;
2097
+ return types_2.AffirmationStatus.Unknown;
2117
2098
  }
2118
2099
  if (status.isPending) {
2119
- return types_3.AffirmationStatus.Pending;
2100
+ return types_2.AffirmationStatus.Pending;
2120
2101
  }
2121
- return types_3.AffirmationStatus.Affirmed;
2102
+ return types_2.AffirmationStatus.Affirmed;
2122
2103
  }
2123
2104
  exports.meshAffirmationStatusToAffirmationStatus = meshAffirmationStatusToAffirmationStatus;
2124
2105
  /**
@@ -2126,12 +2107,12 @@ exports.meshAffirmationStatusToAffirmationStatus = meshAffirmationStatusToAffirm
2126
2107
  */
2127
2108
  function endConditionToSettlementType(endCondition, context) {
2128
2109
  let value;
2129
- if (endCondition.type === types_3.InstructionType.SettleOnAffirmation) {
2130
- value = types_3.InstructionType.SettleOnAffirmation;
2110
+ if (endCondition.type === types_2.InstructionType.SettleOnAffirmation) {
2111
+ value = types_2.InstructionType.SettleOnAffirmation;
2131
2112
  }
2132
2113
  else {
2133
2114
  value = {
2134
- [types_3.InstructionType.SettleOnBlock]: bigNumberToU32(endCondition.value, context),
2115
+ [types_2.InstructionType.SettleOnBlock]: bigNumberToU32(endCondition.value, context),
2135
2116
  };
2136
2117
  }
2137
2118
  return context.createType('SettlementType', value);
@@ -2169,87 +2150,106 @@ exports.portfolioMovementToMovePortfolioItem = portfolioMovementToMovePortfolioI
2169
2150
  * @hidden
2170
2151
  */
2171
2152
  function claimTypeToMeshClaimType(claimType, context) {
2172
- return context.createType('ClaimType', claimType);
2153
+ // NoData is the legacy name for NoType. Functionally they are the same, but createType only knows about one
2154
+ const data = claimType === types_2.ClaimType.NoData ? types_2.ClaimType.NoType : claimType;
2155
+ return context.createType('PolymeshPrimitivesIdentityClaimClaimType', data);
2173
2156
  }
2174
2157
  exports.claimTypeToMeshClaimType = claimTypeToMeshClaimType;
2175
2158
  /**
2176
2159
  * @hidden
2177
2160
  */
2178
- function transferRestrictionToTransferManager(restriction, context) {
2161
+ function transferRestrictionToPolymeshTransferCondition(restriction, context) {
2179
2162
  const { type, value } = restriction;
2180
- let tmType;
2181
- let tmValue;
2182
- if (type === types_3.TransferRestrictionType.Count) {
2183
- tmType = 'CountTransferManager';
2184
- tmValue = bigNumberToU64(value, context);
2163
+ let restrictionType;
2164
+ let restrictionValue;
2165
+ if (type === types_2.TransferRestrictionType.Count) {
2166
+ restrictionType = 'MaxInvestorCount';
2167
+ restrictionValue = bigNumberToU64(value, context);
2185
2168
  }
2186
2169
  else {
2187
- tmType = 'PercentageTransferManager';
2188
- tmValue = percentageToPermill(value, context);
2170
+ restrictionType = 'MaxInvestorOwnership';
2171
+ restrictionValue = percentageToPermill(value, context);
2189
2172
  }
2190
- return context.createType('TransferManager', {
2191
- [tmType]: tmValue,
2173
+ return context.createType('PolymeshPrimitivesTransferComplianceTransferCondition', {
2174
+ [restrictionType]: restrictionValue,
2192
2175
  });
2193
2176
  }
2194
- exports.transferRestrictionToTransferManager = transferRestrictionToTransferManager;
2177
+ exports.transferRestrictionToPolymeshTransferCondition = transferRestrictionToPolymeshTransferCondition;
2178
+ /**
2179
+ * @hidden
2180
+ */
2181
+ function scopeIdsToBtreeSetIdentityId(scopeIds, context) {
2182
+ // The chain expects inputs to be sorted. Copy to avoid mutating input
2183
+ const sortedScopes = [...scopeIds].sort();
2184
+ return context.createType('BTreeSetIdentityId', sortedScopes);
2185
+ }
2186
+ exports.scopeIdsToBtreeSetIdentityId = scopeIdsToBtreeSetIdentityId;
2195
2187
  /**
2196
2188
  * @hidden
2197
2189
  */
2198
- function transferManagerToTransferRestriction(transferManager) {
2199
- if (transferManager.isCountTransferManager) {
2190
+ function transferConditionToTransferRestriction(transferCondition) {
2191
+ if (transferCondition.isMaxInvestorCount) {
2200
2192
  return {
2201
- type: types_3.TransferRestrictionType.Count,
2202
- value: u64ToBigNumber(transferManager.asCountTransferManager),
2193
+ type: types_2.TransferRestrictionType.Count,
2194
+ value: u64ToBigNumber(transferCondition.asMaxInvestorCount),
2203
2195
  };
2204
2196
  }
2205
- else {
2197
+ else if (transferCondition.isMaxInvestorOwnership) {
2206
2198
  return {
2207
- type: types_3.TransferRestrictionType.Percentage,
2208
- value: permillToBigNumber(transferManager.asPercentageTransferManager),
2199
+ type: types_2.TransferRestrictionType.Percentage,
2200
+ value: permillToBigNumber(transferCondition.asMaxInvestorOwnership),
2209
2201
  };
2210
2202
  }
2203
+ else {
2204
+ throw new internal_1.PolymeshError({
2205
+ code: types_2.ErrorCode.FatalError,
2206
+ message: 'Unexpected transfer condition type',
2207
+ });
2208
+ }
2211
2209
  }
2212
- exports.transferManagerToTransferRestriction = transferManagerToTransferRestriction;
2210
+ exports.transferConditionToTransferRestriction = transferConditionToTransferRestriction;
2213
2211
  /**
2214
2212
  * @hidden
2215
2213
  */
2216
2214
  function granularCanTransferResultToTransferBreakdown(result, context) {
2217
- const { invalid_granularity: invalidGranularity, self_transfer: selfTransfer, invalid_receiver_cdd: invalidReceiverCdd, invalid_sender_cdd: invalidSenderCdd, missing_scope_claim: missingScopeClaim, sender_insufficient_balance: insufficientBalance, asset_frozen: assetFrozen, portfolio_validity_result: { sender_portfolio_does_not_exist: senderPortfolioNotExists, receiver_portfolio_does_not_exist: receiverPortfolioNotExists, sender_insufficient_balance: senderInsufficientBalance, }, statistics_result: transferRestrictionResults, compliance_result: complianceResult, result: finalResult, } = result;
2215
+ const { invalid_granularity: invalidGranularity, self_transfer: selfTransfer, invalid_receiver_cdd: invalidReceiverCdd, invalid_sender_cdd: invalidSenderCdd, missing_scope_claim: missingScopeClaim, sender_insufficient_balance: insufficientBalance, asset_frozen: assetFrozen, portfolio_validity_result: { sender_portfolio_does_not_exist: senderPortfolioNotExists, receiver_portfolio_does_not_exist: receiverPortfolioNotExists, sender_insufficient_balance: senderInsufficientBalance, }, transfer_condition_result: transferConditionResult, compliance_result: complianceResult, result: finalResult, } = result;
2218
2216
  const general = [];
2219
2217
  if (boolToBoolean(invalidGranularity)) {
2220
- general.push(types_3.TransferError.InvalidGranularity);
2218
+ general.push(types_2.TransferError.InvalidGranularity);
2221
2219
  }
2222
2220
  if (boolToBoolean(selfTransfer)) {
2223
- general.push(types_3.TransferError.SelfTransfer);
2221
+ general.push(types_2.TransferError.SelfTransfer);
2224
2222
  }
2225
2223
  if (boolToBoolean(invalidReceiverCdd)) {
2226
- general.push(types_3.TransferError.InvalidReceiverCdd);
2224
+ general.push(types_2.TransferError.InvalidReceiverCdd);
2227
2225
  }
2228
2226
  if (boolToBoolean(invalidSenderCdd)) {
2229
- general.push(types_3.TransferError.InvalidSenderCdd);
2227
+ general.push(types_2.TransferError.InvalidSenderCdd);
2230
2228
  }
2231
2229
  if (boolToBoolean(missingScopeClaim)) {
2232
- general.push(types_3.TransferError.ScopeClaimMissing);
2230
+ general.push(types_2.TransferError.ScopeClaimMissing);
2233
2231
  }
2234
2232
  if (boolToBoolean(insufficientBalance)) {
2235
- general.push(types_3.TransferError.InsufficientBalance);
2233
+ general.push(types_2.TransferError.InsufficientBalance);
2236
2234
  }
2237
2235
  if (boolToBoolean(assetFrozen)) {
2238
- general.push(types_3.TransferError.TransfersFrozen);
2236
+ general.push(types_2.TransferError.TransfersFrozen);
2239
2237
  }
2240
2238
  if (boolToBoolean(senderPortfolioNotExists)) {
2241
- general.push(types_3.TransferError.InvalidSenderPortfolio);
2239
+ general.push(types_2.TransferError.InvalidSenderPortfolio);
2242
2240
  }
2243
2241
  if (boolToBoolean(receiverPortfolioNotExists)) {
2244
- general.push(types_3.TransferError.InvalidReceiverPortfolio);
2242
+ general.push(types_2.TransferError.InvalidReceiverPortfolio);
2245
2243
  }
2246
2244
  if (boolToBoolean(senderInsufficientBalance)) {
2247
- general.push(types_3.TransferError.InsufficientPortfolioBalance);
2245
+ general.push(types_2.TransferError.InsufficientPortfolioBalance);
2248
2246
  }
2249
- const restrictions = transferRestrictionResults.map(({ tm, result: tmResult }) => ({
2250
- restriction: transferManagerToTransferRestriction(tm),
2251
- result: boolToBoolean(tmResult),
2252
- }));
2247
+ const restrictions = transferConditionResult.map(({ condition, result: tmResult }) => {
2248
+ return {
2249
+ restriction: transferConditionToTransferRestriction(condition),
2250
+ result: boolToBoolean(tmResult),
2251
+ };
2252
+ });
2253
2253
  return {
2254
2254
  general,
2255
2255
  compliance: assetComplianceResultToCompliance(complianceResult, context),
@@ -2275,16 +2275,16 @@ exports.offeringTierToPriceTier = offeringTierToPriceTier;
2275
2275
  function permissionsLikeToPermissions(permissionsLike, context) {
2276
2276
  let assetPermissions = {
2277
2277
  values: [],
2278
- type: types_3.PermissionType.Include,
2278
+ type: types_2.PermissionType.Include,
2279
2279
  };
2280
2280
  let transactionPermissions = {
2281
2281
  values: [],
2282
- type: types_3.PermissionType.Include,
2282
+ type: types_2.PermissionType.Include,
2283
2283
  };
2284
2284
  let transactionGroupPermissions = [];
2285
2285
  let portfolioPermissions = {
2286
2286
  values: [],
2287
- type: types_3.PermissionType.Include,
2287
+ type: types_2.PermissionType.Include,
2288
2288
  };
2289
2289
  let transactions;
2290
2290
  let transactionGroups;
@@ -2350,7 +2350,7 @@ exports.fundraiserTierToTier = fundraiserTierToTier;
2350
2350
  * @hidden
2351
2351
  */
2352
2352
  function fundraiserToOfferingDetails(fundraiser, name, context) {
2353
- const { creator, offering_portfolio: offeringPortfolio, raising_portfolio: raisingPortfolio, raising_asset: raisingAsset, tiers: rawTiers, venue_id: venueId, start: rawStart, end: rawEnd, status: rawStatus, minimum_investment: rawMinInvestment, } = fundraiser;
2353
+ const { creator, offeringPortfolio, raisingPortfolio, raisingAsset, tiers: rawTiers, venueId, start: rawStart, end: rawEnd, status: rawStatus, minimumInvestment: rawMinInvestment, } = fundraiser;
2354
2354
  const tiers = [];
2355
2355
  let totalRemaining = new bignumber_js_1.default(0);
2356
2356
  let totalAmount = new bignumber_js_1.default(0);
@@ -2369,33 +2369,33 @@ function fundraiserToOfferingDetails(fundraiser, name, context) {
2369
2369
  const isStarted = now > start;
2370
2370
  const isExpired = end && now > end;
2371
2371
  const minInvestment = balanceToBigNumber(rawMinInvestment);
2372
- let timing = types_3.OfferingTimingStatus.NotStarted;
2373
- let balance = types_3.OfferingBalanceStatus.Available;
2374
- let sale = types_3.OfferingSaleStatus.Live;
2372
+ let timing = types_2.OfferingTimingStatus.NotStarted;
2373
+ let balance = types_2.OfferingBalanceStatus.Available;
2374
+ let sale = types_2.OfferingSaleStatus.Live;
2375
2375
  if (isExpired) {
2376
- timing = types_3.OfferingTimingStatus.Expired;
2376
+ timing = types_2.OfferingTimingStatus.Expired;
2377
2377
  }
2378
2378
  else if (isStarted) {
2379
- timing = types_3.OfferingTimingStatus.Started;
2379
+ timing = types_2.OfferingTimingStatus.Started;
2380
2380
  }
2381
2381
  if (totalRemainingValue.isZero()) {
2382
- balance = types_3.OfferingBalanceStatus.SoldOut;
2382
+ balance = types_2.OfferingBalanceStatus.SoldOut;
2383
2383
  }
2384
2384
  else if (totalRemainingValue.lt(minInvestment)) {
2385
- balance = types_3.OfferingBalanceStatus.Residual;
2385
+ balance = types_2.OfferingBalanceStatus.Residual;
2386
2386
  }
2387
2387
  if (rawStatus.isClosedEarly) {
2388
- sale = types_3.OfferingSaleStatus.ClosedEarly;
2388
+ sale = types_2.OfferingSaleStatus.ClosedEarly;
2389
2389
  }
2390
2390
  else if (rawStatus.isClosed) {
2391
- sale = types_3.OfferingSaleStatus.Closed;
2391
+ sale = types_2.OfferingSaleStatus.Closed;
2392
2392
  }
2393
2393
  else if (rawStatus.isFrozen) {
2394
- sale = types_3.OfferingSaleStatus.Frozen;
2394
+ sale = types_2.OfferingSaleStatus.Frozen;
2395
2395
  }
2396
2396
  return {
2397
2397
  creator: new internal_1.Identity({ did: identityIdToString(creator) }, context),
2398
- name: textToString(name),
2398
+ name: bytesToString(name),
2399
2399
  offeringPortfolio: meshPortfolioIdToPortfolio(offeringPortfolio, context),
2400
2400
  raisingPortfolio: meshPortfolioIdToPortfolio(raisingPortfolio, context),
2401
2401
  raisingCurrency: tickerToString(raisingAsset),
@@ -2421,7 +2421,7 @@ function calendarPeriodToMeshCalendarPeriod(period, context) {
2421
2421
  const { unit, amount } = period;
2422
2422
  if (amount.isNegative()) {
2423
2423
  throw new internal_1.PolymeshError({
2424
- code: types_3.ErrorCode.ValidationError,
2424
+ code: types_2.ErrorCode.ValidationError,
2425
2425
  message: 'Calendar period cannot have a negative amount',
2426
2426
  });
2427
2427
  }
@@ -2438,25 +2438,25 @@ function meshCalendarPeriodToCalendarPeriod(period) {
2438
2438
  const { unit: rawUnit, amount } = period;
2439
2439
  let unit;
2440
2440
  if (rawUnit.isSecond) {
2441
- unit = types_3.CalendarUnit.Second;
2441
+ unit = types_2.CalendarUnit.Second;
2442
2442
  }
2443
2443
  else if (rawUnit.isMinute) {
2444
- unit = types_3.CalendarUnit.Minute;
2444
+ unit = types_2.CalendarUnit.Minute;
2445
2445
  }
2446
2446
  else if (rawUnit.isHour) {
2447
- unit = types_3.CalendarUnit.Hour;
2447
+ unit = types_2.CalendarUnit.Hour;
2448
2448
  }
2449
2449
  else if (rawUnit.isDay) {
2450
- unit = types_3.CalendarUnit.Day;
2450
+ unit = types_2.CalendarUnit.Day;
2451
2451
  }
2452
2452
  else if (rawUnit.isWeek) {
2453
- unit = types_3.CalendarUnit.Week;
2453
+ unit = types_2.CalendarUnit.Week;
2454
2454
  }
2455
2455
  else if (rawUnit.isMonth) {
2456
- unit = types_3.CalendarUnit.Month;
2456
+ unit = types_2.CalendarUnit.Month;
2457
2457
  }
2458
2458
  else {
2459
- unit = types_3.CalendarUnit.Year;
2459
+ unit = types_2.CalendarUnit.Year;
2460
2460
  }
2461
2461
  return {
2462
2462
  unit,
@@ -2471,7 +2471,7 @@ function scheduleSpecToMeshScheduleSpec(details, context) {
2471
2471
  const { start, period, repetitions } = details;
2472
2472
  return context.createType('ScheduleSpec', {
2473
2473
  start: start && dateToMoment(start, context),
2474
- period: calendarPeriodToMeshCalendarPeriod(period || { unit: types_3.CalendarUnit.Month, amount: new bignumber_js_1.default(0) }, context),
2474
+ period: calendarPeriodToMeshCalendarPeriod(period || { unit: types_2.CalendarUnit.Month, amount: new bignumber_js_1.default(0) }, context),
2475
2475
  remaining: bigNumberToU64(repetitions || new bignumber_js_1.default(0), context),
2476
2476
  });
2477
2477
  }
@@ -2501,26 +2501,26 @@ exports.stringToSignature = stringToSignature;
2501
2501
  * @hidden
2502
2502
  */
2503
2503
  function meshCorporateActionToCorporateActionParams(corporateAction, details, context) {
2504
- const { kind: rawKind, decl_date: declDate, targets: { identities, treatment }, default_withholding_tax: defaultWithholdingTax, withholding_tax: withholdingTax, } = corporateAction;
2504
+ const { kind: rawKind, declDate, targets: { identities, treatment }, defaultWithholdingTax, withholdingTax, } = corporateAction;
2505
2505
  let kind;
2506
2506
  if (rawKind.isIssuerNotice) {
2507
- kind = types_3.CorporateActionKind.IssuerNotice;
2507
+ kind = types_2.CorporateActionKind.IssuerNotice;
2508
2508
  }
2509
2509
  else if (rawKind.isPredictableBenefit) {
2510
- kind = types_3.CorporateActionKind.PredictableBenefit;
2510
+ kind = types_2.CorporateActionKind.PredictableBenefit;
2511
2511
  }
2512
2512
  else if (rawKind.isUnpredictableBenefit) {
2513
- kind = types_3.CorporateActionKind.UnpredictableBenefit;
2513
+ kind = types_2.CorporateActionKind.UnpredictableBenefit;
2514
2514
  }
2515
2515
  else if (rawKind.isReorganization) {
2516
- kind = types_3.CorporateActionKind.Reorganization;
2516
+ kind = types_2.CorporateActionKind.Reorganization;
2517
2517
  }
2518
2518
  else {
2519
- kind = types_3.CorporateActionKind.Other;
2519
+ kind = types_2.CorporateActionKind.Other;
2520
2520
  }
2521
2521
  const targets = {
2522
2522
  identities: identities.map(identityId => new internal_1.Identity({ did: identityIdToString(identityId) }, context)),
2523
- treatment: treatment.isExclude ? types_3.TargetTreatment.Exclude : types_3.TargetTreatment.Include,
2523
+ treatment: treatment.isExclude ? types_2.TargetTreatment.Exclude : types_2.TargetTreatment.Include,
2524
2524
  };
2525
2525
  const taxWithholdings = withholdingTax.map(([identityId, tax]) => ({
2526
2526
  identity: new internal_1.Identity({ did: identityIdToString(identityId) }, context),
@@ -2529,7 +2529,7 @@ function meshCorporateActionToCorporateActionParams(corporateAction, details, co
2529
2529
  return {
2530
2530
  kind,
2531
2531
  declarationDate: momentToDate(declDate),
2532
- description: textToString(details),
2532
+ description: bytesToString(details),
2533
2533
  targets,
2534
2534
  defaultTaxWithholding: permillToBigNumber(defaultWithholdingTax),
2535
2535
  taxWithholdings,
@@ -2579,7 +2579,7 @@ exports.checkpointToRecordDateSpec = checkpointToRecordDateSpec;
2579
2579
  /**
2580
2580
  * @hidden
2581
2581
  */
2582
- function scopeClaimProofToMeshScopeClaimProof(proof, scopeId, context) {
2582
+ function scopeClaimProofToConfidentialIdentityClaimProof(proof, scopeId, context) {
2583
2583
  const { proofScopeIdWellFormed, proofScopeIdCddIdMatch: { challengeResponses, subtractExpressionsRes, blindedScopeDidHash }, } = proof;
2584
2584
  const zkProofData = context.createType('ZkProofData', {
2585
2585
  /* eslint-disable @typescript-eslint/naming-convention */
@@ -2588,15 +2588,13 @@ function scopeClaimProofToMeshScopeClaimProof(proof, scopeId, context) {
2588
2588
  blinded_scope_did_hash: stringToRistrettoPoint(blindedScopeDidHash, context),
2589
2589
  /* eslint-enable @typescript-eslint/naming-convention */
2590
2590
  });
2591
- return context.createType('ScopeClaimProof', {
2592
- /* eslint-disable @typescript-eslint/naming-convention */
2593
- proof_scope_id_wellformed: stringToSignature(proofScopeIdWellFormed, context),
2594
- proof_scope_id_cdd_id_match: zkProofData,
2595
- scope_id: stringToRistrettoPoint(scopeId, context),
2596
- /* eslint-enable @typescript-eslint/naming-convention */
2591
+ return context.createType('ConfidentialIdentityClaimProofsScopeClaimProof', {
2592
+ proofScopeIdWellformed: stringToSignature(proofScopeIdWellFormed, context),
2593
+ proofScopeIdCddIdMatch: zkProofData,
2594
+ scopeId: stringToRistrettoPoint(scopeId, context),
2597
2595
  });
2598
2596
  }
2599
- exports.scopeClaimProofToMeshScopeClaimProof = scopeClaimProofToMeshScopeClaimProof;
2597
+ exports.scopeClaimProofToConfidentialIdentityClaimProof = scopeClaimProofToConfidentialIdentityClaimProof;
2600
2598
  /**
2601
2599
  * @hidden
2602
2600
  */
@@ -2604,7 +2602,7 @@ function targetIdentitiesToCorporateActionTargets(targetIdentities, context) {
2604
2602
  const { identities, treatment } = targetIdentities;
2605
2603
  return {
2606
2604
  identities: identities.map(identity => new internal_1.Identity({ did: identityIdToString(identity) }, context)),
2607
- treatment: treatment.isInclude ? types_3.TargetTreatment.Include : types_3.TargetTreatment.Exclude,
2605
+ treatment: treatment.isInclude ? types_2.TargetTreatment.Include : types_2.TargetTreatment.Exclude,
2608
2606
  };
2609
2607
  }
2610
2608
  exports.targetIdentitiesToCorporateActionTargets = targetIdentitiesToCorporateActionTargets;
@@ -2623,7 +2621,7 @@ exports.targetsToTargetIdentities = targetsToTargetIdentities;
2623
2621
  * @hidden
2624
2622
  */
2625
2623
  function distributionToDividendDistributionParams(distribution, context) {
2626
- const { from, currency, per_share: perShare, amount, expires_at: expiryDate, payment_at: paymentDate, } = distribution;
2624
+ const { from, currency, perShare, amount, expiresAt: expiryDate, paymentAt: paymentDate, } = distribution;
2627
2625
  return {
2628
2626
  origin: meshPortfolioIdToPortfolio(from, context),
2629
2627
  currency: tickerToString(currency),
@@ -2639,11 +2637,70 @@ exports.distributionToDividendDistributionParams = distributionToDividendDistrib
2639
2637
  */
2640
2638
  function corporateActionIdentifierToCaId(corporateActionIdentifier, context) {
2641
2639
  const { ticker, localId } = corporateActionIdentifier;
2642
- return context.createType('CAId', {
2640
+ return context.createType('PalletCorporateActionsCaId', {
2643
2641
  ticker: stringToTicker(ticker, context),
2644
- // eslint-disable-next-line @typescript-eslint/naming-convention
2645
- local_id: bigNumberToU32(localId, context),
2642
+ localId: bigNumberToU32(localId, context),
2646
2643
  });
2647
2644
  }
2648
2645
  exports.corporateActionIdentifierToCaId = corporateActionIdentifierToCaId;
2646
+ /**
2647
+ * @hidden
2648
+ */
2649
+ function statisticsOpTypeToStatType(op, context) {
2650
+ return context.createType('PolymeshPrimitivesStatisticsStatType', { op });
2651
+ }
2652
+ exports.statisticsOpTypeToStatType = statisticsOpTypeToStatType;
2653
+ /**
2654
+ * @hidden
2655
+ */
2656
+ function statUpdate(key2, value, context) {
2657
+ return context.createType('PolymeshPrimitivesStatisticsStatUpdate', { key2, value });
2658
+ }
2659
+ exports.statUpdate = statUpdate;
2660
+ /**
2661
+ * @hidden
2662
+ */
2663
+ function statUpdatesToBtreeStatUpdate(statUpdates, context) {
2664
+ const sorted = [...statUpdates];
2665
+ return context.createType('BTreeSetStatUpdate', sorted);
2666
+ }
2667
+ exports.statUpdatesToBtreeStatUpdate = statUpdatesToBtreeStatUpdate;
2668
+ /**
2669
+ * @hidden
2670
+ */
2671
+ function meshStatToStatisticsOpType(rawStat) {
2672
+ return rawStat.op.type;
2673
+ }
2674
+ exports.meshStatToStatisticsOpType = meshStatToStatisticsOpType;
2675
+ /**
2676
+ * @hidden
2677
+ */
2678
+ function statisticsOpTypeToStatOpType(type, context) {
2679
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', type);
2680
+ }
2681
+ exports.statisticsOpTypeToStatOpType = statisticsOpTypeToStatOpType;
2682
+ /**
2683
+ * For now this is hard coded to return a NoClaimStat type. Once Claim scopes are added this should be extended
2684
+ * @hidden
2685
+ */
2686
+ function createStat2ndKey(context) {
2687
+ return context.createType('PolymeshPrimitivesStatisticsStat2ndKey', 'NoClaimStat');
2688
+ }
2689
+ exports.createStat2ndKey = createStat2ndKey;
2690
+ /**
2691
+ * @hidden
2692
+ */
2693
+ function complianceConditionsToBtreeSet(conditions, context) {
2694
+ // The chain expects inputs to be sorted. Copy to avoid mutating input
2695
+ const sorted = [...conditions].sort();
2696
+ return context.createType('BTreeSetTransferCondition', sorted);
2697
+ }
2698
+ exports.complianceConditionsToBtreeSet = complianceConditionsToBtreeSet;
2699
+ /**
2700
+ * @hidden
2701
+ */
2702
+ function toExemptKey(tickerKey, op) {
2703
+ return { asset: tickerKey, op };
2704
+ }
2705
+ exports.toExemptKey = toExemptKey;
2649
2706
  //# sourceMappingURL=conversion.js.map