@polymeshassociation/polymesh-sdk 23.0.0-alpha.9 → 23.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/CHANGELOG.md +74 -1
  2. package/README.md +49 -7
  3. package/api/client/Assets.d.ts +10 -2
  4. package/api/client/Assets.d.ts.map +1 -1
  5. package/api/client/Assets.js +27 -9
  6. package/api/client/Assets.js.map +1 -1
  7. package/api/client/Claims.d.ts +13 -1
  8. package/api/client/Claims.d.ts.map +1 -1
  9. package/api/client/Claims.js +32 -2
  10. package/api/client/Claims.js.map +1 -1
  11. package/api/client/Network.d.ts +1 -1
  12. package/api/client/Network.d.ts.map +1 -1
  13. package/api/client/Network.js.map +1 -1
  14. package/api/entities/Account/MultiSig/index.d.ts.map +1 -1
  15. package/api/entities/Account/MultiSig/index.js +2 -5
  16. package/api/entities/Account/MultiSig/index.js.map +1 -1
  17. package/api/entities/Account/index.d.ts.map +1 -1
  18. package/api/entities/Account/index.js +1 -1
  19. package/api/entities/Account/index.js.map +1 -1
  20. package/api/entities/Account/types.d.ts +1 -1
  21. package/api/entities/Asset/Base/Settlements/index.d.ts +85 -0
  22. package/api/entities/Asset/Base/Settlements/index.d.ts.map +1 -0
  23. package/api/entities/Asset/Base/Settlements/index.js +141 -0
  24. package/api/entities/Asset/Base/Settlements/index.js.map +1 -0
  25. package/api/entities/Asset/Fungible/index.d.ts +2 -2
  26. package/api/entities/Asset/Fungible/index.d.ts.map +1 -1
  27. package/api/entities/Asset/Fungible/index.js +2 -2
  28. package/api/entities/Asset/Fungible/index.js.map +1 -1
  29. package/api/entities/Asset/NonFungible/Nft.d.ts +76 -5
  30. package/api/entities/Asset/NonFungible/Nft.d.ts.map +1 -1
  31. package/api/entities/Asset/NonFungible/Nft.js +162 -6
  32. package/api/entities/Asset/NonFungible/Nft.js.map +1 -1
  33. package/api/entities/Asset/NonFungible/NftCollection.d.ts +30 -16
  34. package/api/entities/Asset/NonFungible/NftCollection.d.ts.map +1 -1
  35. package/api/entities/Asset/NonFungible/NftCollection.js +72 -27
  36. package/api/entities/Asset/NonFungible/NftCollection.js.map +1 -1
  37. package/api/entities/Asset/types.d.ts +23 -3
  38. package/api/entities/Asset/types.d.ts.map +1 -1
  39. package/api/entities/Asset/types.js.map +1 -1
  40. package/api/entities/Identity/AssetPermissions.d.ts +3 -3
  41. package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
  42. package/api/entities/Identity/AssetPermissions.js.map +1 -1
  43. package/api/entities/Identity/index.d.ts +17 -2
  44. package/api/entities/Identity/index.d.ts.map +1 -1
  45. package/api/entities/Identity/index.js +37 -0
  46. package/api/entities/Identity/index.js.map +1 -1
  47. package/api/entities/Instruction/index.d.ts.map +1 -1
  48. package/api/entities/Instruction/index.js +29 -20
  49. package/api/entities/Instruction/index.js.map +1 -1
  50. package/api/entities/Instruction/types.d.ts +10 -3
  51. package/api/entities/Instruction/types.d.ts.map +1 -1
  52. package/api/entities/Instruction/types.js.map +1 -1
  53. package/api/entities/MetadataEntry/index.d.ts +2 -2
  54. package/api/entities/MetadataEntry/index.d.ts.map +1 -1
  55. package/api/entities/MetadataEntry/index.js +1 -1
  56. package/api/entities/MetadataEntry/index.js.map +1 -1
  57. package/api/entities/MultiSigProposal/index.d.ts +36 -2
  58. package/api/entities/MultiSigProposal/index.d.ts.map +1 -1
  59. package/api/entities/MultiSigProposal/index.js +91 -10
  60. package/api/entities/MultiSigProposal/index.js.map +1 -1
  61. package/api/entities/MultiSigProposal/types.d.ts +15 -2
  62. package/api/entities/MultiSigProposal/types.d.ts.map +1 -1
  63. package/api/entities/MultiSigProposal/types.js +6 -1
  64. package/api/entities/MultiSigProposal/types.js.map +1 -1
  65. package/api/entities/Portfolio/index.d.ts +12 -4
  66. package/api/entities/Portfolio/index.d.ts.map +1 -1
  67. package/api/entities/Portfolio/index.js +66 -6
  68. package/api/entities/Portfolio/index.js.map +1 -1
  69. package/api/entities/Portfolio/types.d.ts +20 -5
  70. package/api/entities/Portfolio/types.d.ts.map +1 -1
  71. package/api/entities/Venue/types.d.ts +1 -1
  72. package/api/entities/common/namespaces/Authorizations.d.ts +2 -1
  73. package/api/entities/common/namespaces/Authorizations.d.ts.map +1 -1
  74. package/api/entities/common/namespaces/Authorizations.js.map +1 -1
  75. package/api/entities/types.d.ts +3 -1
  76. package/api/entities/types.d.ts.map +1 -1
  77. package/api/entities/types.js.map +1 -1
  78. package/api/procedures/addInstruction.d.ts.map +1 -1
  79. package/api/procedures/addInstruction.js +76 -17
  80. package/api/procedures/addInstruction.js.map +1 -1
  81. package/api/procedures/createNftCollection.d.ts.map +1 -1
  82. package/api/procedures/createNftCollection.js +1 -1
  83. package/api/procedures/createNftCollection.js.map +1 -1
  84. package/api/procedures/evaluateMultiSigProposal.d.ts +19 -0
  85. package/api/procedures/evaluateMultiSigProposal.d.ts.map +1 -0
  86. package/api/procedures/evaluateMultiSigProposal.js +92 -0
  87. package/api/procedures/evaluateMultiSigProposal.js.map +1 -0
  88. package/api/procedures/issueNft.js +1 -1
  89. package/api/procedures/issueNft.js.map +1 -1
  90. package/api/procedures/modifyClaims.d.ts.map +1 -1
  91. package/api/procedures/modifyClaims.js +7 -21
  92. package/api/procedures/modifyClaims.js.map +1 -1
  93. package/api/procedures/moveFunds.d.ts.map +1 -1
  94. package/api/procedures/moveFunds.js +82 -16
  95. package/api/procedures/moveFunds.js.map +1 -1
  96. package/api/procedures/redeemNft.d.ts +31 -0
  97. package/api/procedures/redeemNft.d.ts.map +1 -0
  98. package/api/procedures/redeemNft.js +87 -0
  99. package/api/procedures/redeemNft.js.map +1 -0
  100. package/api/procedures/setPermissionGroup.js +1 -1
  101. package/api/procedures/setPermissionGroup.js.map +1 -1
  102. package/api/procedures/types.d.ts +26 -9
  103. package/api/procedures/types.d.ts.map +1 -1
  104. package/api/procedures/types.js.map +1 -1
  105. package/api/procedures/waivePermissions.js +1 -1
  106. package/api/procedures/waivePermissions.js.map +1 -1
  107. package/base/Context.d.ts.map +1 -1
  108. package/base/Context.js +24 -24
  109. package/base/Context.js.map +1 -1
  110. package/generated/types.d.ts +5 -1
  111. package/generated/types.d.ts.map +1 -1
  112. package/generated/types.js +4 -0
  113. package/generated/types.js.map +1 -1
  114. package/internal.d.ts +2 -0
  115. package/internal.d.ts.map +1 -1
  116. package/internal.js +7 -3
  117. package/internal.js.map +1 -1
  118. package/middleware/queries.d.ts +19 -2
  119. package/middleware/queries.d.ts.map +1 -1
  120. package/middleware/queries.js +103 -6
  121. package/middleware/queries.js.map +1 -1
  122. package/middleware/types.d.ts +68950 -15292
  123. package/middleware/types.d.ts.map +1 -1
  124. package/middleware/types.js +36222 -999
  125. package/middleware/types.js.map +1 -1
  126. package/middleware/typesV1.d.ts +1 -1
  127. package/middleware/typesV1.d.ts.map +1 -1
  128. package/npm-package/polymeshassociation-polymesh-sdk-23.0.0-beta.1.tgz +0 -0
  129. package/package.json +2 -2
  130. package/polkadot/augment-api-errors.d.ts +4 -18
  131. package/polkadot/augment-api-errors.d.ts.map +1 -1
  132. package/polkadot/augment-api-events.d.ts +0 -6
  133. package/polkadot/augment-api-events.d.ts.map +1 -1
  134. package/polkadot/augment-api-query.d.ts +33 -26
  135. package/polkadot/augment-api-query.d.ts.map +1 -1
  136. package/polkadot/augment-api-tx.d.ts +123 -51
  137. package/polkadot/augment-api-tx.d.ts.map +1 -1
  138. package/polkadot/lookup.d.ts +246 -248
  139. package/polkadot/lookup.d.ts.map +1 -1
  140. package/polkadot/lookup.js +248 -253
  141. package/polkadot/lookup.js.map +1 -1
  142. package/polkadot/registry.d.ts +3 -5
  143. package/polkadot/registry.d.ts.map +1 -1
  144. package/polkadot/types-lookup.d.ts +251 -248
  145. package/polkadot/types-lookup.d.ts.map +1 -1
  146. package/types/index.d.ts +44 -7
  147. package/types/index.d.ts.map +1 -1
  148. package/types/index.js +18 -2
  149. package/types/index.js.map +1 -1
  150. package/types/internal.d.ts +1 -1
  151. package/utils/constants.d.ts +17 -1
  152. package/utils/constants.d.ts.map +1 -1
  153. package/utils/constants.js +18 -2
  154. package/utils/constants.js.map +1 -1
  155. package/utils/conversion.d.ts +34 -13
  156. package/utils/conversion.d.ts.map +1 -1
  157. package/utils/conversion.js +437 -364
  158. package/utils/conversion.js.map +1 -1
  159. package/utils/internal.d.ts +20 -3
  160. package/utils/internal.d.ts.map +1 -1
  161. package/utils/internal.js +119 -42
  162. package/utils/internal.js.map +1 -1
  163. package/utils/typeguards.d.ts +26 -2
  164. package/utils/typeguards.d.ts.map +1 -1
  165. package/utils/typeguards.js +39 -2
  166. package/utils/typeguards.js.map +1 -1
  167. package/api/entities/Asset/Fungible/Settlements/index.d.ts +0 -29
  168. package/api/entities/Asset/Fungible/Settlements/index.d.ts.map +0 -1
  169. package/api/entities/Asset/Fungible/Settlements/index.js +0 -70
  170. package/api/entities/Asset/Fungible/Settlements/index.js.map +0 -1
  171. package/middleware/enums.d.ts +0 -3
  172. package/middleware/enums.d.ts.map +0 -1
  173. package/middleware/enums.js +0 -38
  174. package/middleware/enums.js.map +0 -1
  175. package/npm-package/polymeshassociation-polymesh-sdk-23.0.0-alpha.9.tgz +0 -0
@@ -19,8 +19,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.u32ToBigNumber = exports.bigNumberToU32 = exports.meshPermissionsToPermissions = exports.extrinsicPermissionsToTransactionPermissions = exports.permissionsToMeshPermissions = exports.transactionPermissionsToExtrinsicPermissions = exports.transactionPermissionsToTxGroups = exports.txGroupToTxTags = exports.textToString = exports.stringToText = exports.portfolioToPortfolioKind = exports.portfolioIdToMeshPortfolioId = exports.portfolioLikeToPortfolio = exports.portfolioIdToPortfolio = exports.portfolioLikeToPortfolioId = exports.portfolioToPortfolioId = exports.meshPortfolioIdToPortfolio = exports.claimPercentageToClaimPercentageRestrictionValue = exports.claimCountToClaimCountRestrictionValue = exports.meshClaimToInputStatClaim = exports.permillToBigNumber = exports.percentageToPermill = exports.bigNumberToU128 = exports.bigNumberToU64 = exports.u128ToBigNumber = exports.u64ToBigNumber = exports.signerToString = exports.signerToSignatory = exports.signerValueToSigner = exports.signerToSignerValue = exports.signatoryToSignerValue = exports.signerValueToSignatory = exports.identityIdToString = exports.stringToIdentityId = exports.stringToBlockHash = exports.stringToHash = exports.hashToString = exports.accountIdToString = exports.stringToAccountId = exports.momentToDate = exports.dateToMoment = exports.stringToU8aFixed = exports.tickerToString = exports.stringToTickerKey = exports.stringToTicker = exports.bytesToString = exports.stringToBytes = exports.boolToBoolean = exports.booleanToBool = exports.tickerToDid = void 0;
21
21
  exports.txTagToExtrinsicIdentifier = exports.extrinsicIdentifierToTxTag = exports.txTagToProtocolOp = exports.complianceRequirementToRequirement = exports.complianceRequirementResultToRequirementCompliance = exports.requirementToComplianceRequirement = exports.trustedClaimIssuerToTrustedIssuer = exports.trustedIssuerToTrustedClaimIssuer = exports.meshClaimTypeToClaimType = exports.stringToTargetIdentity = exports.statsClaimToStatClaimInputType = exports.meshClaimToClaim = exports.middlewareEventDetailsToEventIdentifier = exports.scopeToMiddlewareScope = exports.middlewareScopeToScope = exports.claimToMeshClaim = 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.fundingRoundToAssetFundingRound = exports.nameToAssetName = exports.posRatioToBigNumber = exports.assetTypeToKnownOrId = exports.internalNftTypeToNftType = exports.internalAssetTypeToAssetType = exports.u8ToTransferStatus = exports.stringToMemo = exports.authorizationDataToAuthorization = exports.agentGroupToPermissionGroup = exports.balanceToBigNumber = exports.bigNumberToBalance = exports.authorizationTypeToMeshAuthorizationType = exports.authorizationToAuthorizationData = exports.agentGroupToPermissionGroupIdentifier = exports.permissionGroupIdentifierToAgentGroup = exports.u8ToBigNumber = exports.u16ToBigNumber = void 0;
22
- exports.toExemptKey = exports.complianceConditionsToBtreeSet = exports.sortTransferRestrictionByClaimValue = exports.createStat2ndKey = exports.transferRestrictionTypeToStatOpType = exports.statTypeToStatOpType = exports.meshStatToStatType = exports.statUpdatesToBtreeStatUpdate = exports.keyAndValueToStatUpdate = exports.transferConditionsToBtreeTransferConditions = exports.statisticStatTypesToBtreeStatType = exports.sortStatsByClaimType = exports.statisticsOpTypeToStatType = exports.corporateActionParamsToMeshCorporateActionArgs = exports.corporateActionIdentifierToCaId = exports.distributionToDividendDistributionParams = exports.caTaxWithholdingsToMeshTaxWithholdings = exports.targetsToTargetIdentities = exports.targetIdentitiesToCorporateActionTargets = exports.checkpointToRecordDateSpec = exports.corporateActionKindToCaKind = exports.meshCorporateActionToCorporateActionParams = exports.fundraiserToOfferingDetails = exports.fundraiserTierToTier = exports.middlewarePortfolioToPortfolio = exports.permissionsLikeToPermissions = exports.offeringTierToPriceTier = exports.granularCanTransferResultToTransferBreakdown = exports.transferConditionToTransferRestriction = exports.identitiesToBtreeSet = exports.transferRestrictionToPolymeshTransferCondition = exports.claimIssuerToMeshClaimIssuer = exports.claimTypeToMeshClaimType = exports.portfolioMovementToPortfolioFund = exports.toIdentityWithClaimsArray = exports.middlewareClaimToClaimData = exports.endConditionToSettlementType = exports.meshSettlementTypeToEndCondition = exports.meshAffirmationStatusToAffirmationStatus = exports.meshInstructionStatusToInstructionStatus = exports.venueTypeToMeshVenueType = exports.meshVenueTypeToVenueType = exports.secondaryAccountToMeshSecondaryKey = exports.transactionToTxTag = exports.transactionHexToTxTag = exports.coerceHexToString = exports.addressToKey = exports.keyToAddress = exports.moduleAddressToString = exports.assetComplianceResultToCompliance = void 0;
23
- exports.nftInputToNftMetadataVec = exports.nftInputToNftMetadataAttribute = exports.meshNftToNftId = exports.meshMetadataKeyToMetadataKey = exports.collectionKeysToMetadataKeys = exports.middlewareAuthorizationDataToAuthorization = exports.middlewarePermissionsDataToPermissions = exports.datesToScheduleCheckpoints = exports.middlewareAgentGroupDataToPermissionGroup = exports.legToSettlementLeg = exports.middlewarePortfolioDataToPortfolio = exports.expiryToMoment = exports.middlewareInstructionToHistoricInstruction = exports.instructionMemoToString = exports.metadataValueDetailToMeshMetadataValueDetail = exports.metadataValueToMeshMetadataValue = exports.meshMetadataValueToMetadataValue = exports.metadataToMeshMetadataKey = exports.meshMetadataSpecToMetadataSpec = exports.metadataSpecToMeshMetadataSpec = exports.meshProposalStatusToProposalStatus = exports.inputStatTypeToMeshStatType = exports.countStatInputToStatUpdates = exports.claimCountStatInputToStatUpdates = void 0;
22
+ exports.createStat2ndKey = exports.transferRestrictionTypeToStatOpType = exports.statTypeToStatOpType = exports.meshStatToStatType = exports.statUpdatesToBtreeStatUpdate = exports.keyAndValueToStatUpdate = exports.transferConditionsToBtreeTransferConditions = exports.statisticStatTypesToBtreeStatType = exports.sortStatsByClaimType = exports.statisticsOpTypeToStatType = exports.corporateActionParamsToMeshCorporateActionArgs = exports.corporateActionIdentifierToCaId = exports.distributionToDividendDistributionParams = exports.caTaxWithholdingsToMeshTaxWithholdings = exports.targetsToTargetIdentities = exports.targetIdentitiesToCorporateActionTargets = exports.checkpointToRecordDateSpec = exports.corporateActionKindToCaKind = exports.meshCorporateActionToCorporateActionParams = exports.fundraiserToOfferingDetails = exports.fundraiserTierToTier = exports.middlewarePortfolioToPortfolio = exports.permissionsLikeToPermissions = exports.offeringTierToPriceTier = exports.granularCanTransferResultToTransferBreakdown = exports.nftDispatchErrorToTransferError = exports.transferConditionToTransferRestriction = exports.identitiesToBtreeSet = exports.transferRestrictionToPolymeshTransferCondition = exports.claimIssuerToMeshClaimIssuer = exports.claimTypeToMeshClaimType = exports.nftMovementToPortfolioFund = exports.fungibleMovementToPortfolioFund = exports.nftToMeshNft = exports.toIdentityWithClaimsArray = exports.middlewareClaimToClaimData = exports.endConditionToSettlementType = exports.meshSettlementTypeToEndCondition = exports.meshAffirmationStatusToAffirmationStatus = exports.meshInstructionStatusToInstructionStatus = exports.venueTypeToMeshVenueType = exports.meshVenueTypeToVenueType = exports.secondaryAccountToMeshSecondaryKey = exports.transactionToTxTag = exports.transactionHexToTxTag = exports.coerceHexToString = exports.addressToKey = exports.keyToAddress = exports.moduleAddressToString = exports.assetComplianceResultToCompliance = void 0;
23
+ exports.nftInputToNftMetadataVec = exports.nftInputToNftMetadataAttribute = exports.meshNftToNftId = exports.meshMetadataKeyToMetadataKey = exports.collectionKeysToMetadataKeys = exports.middlewareAuthorizationDataToAuthorization = exports.middlewarePermissionsDataToPermissions = exports.datesToScheduleCheckpoints = exports.middlewareAgentGroupDataToPermissionGroup = exports.legToNonFungibleLeg = exports.legToFungibleLeg = exports.middlewarePortfolioDataToPortfolio = exports.expiryToMoment = exports.middlewareInstructionToHistoricInstruction = exports.instructionMemoToString = exports.metadataValueDetailToMeshMetadataValueDetail = exports.metadataValueToMeshMetadataValue = exports.meshMetadataValueToMetadataValue = exports.metadataToMeshMetadataKey = exports.meshMetadataSpecToMetadataSpec = exports.metadataSpecToMeshMetadataSpec = exports.meshProposalStatusToProposalStatus = exports.inputStatTypeToMeshStatType = exports.countStatInputToStatUpdates = exports.claimCountStatInputToStatUpdates = exports.toExemptKey = exports.complianceConditionsToBtreeSet = exports.sortTransferRestrictionByClaimValue = void 0;
24
24
  const util_1 = require("@polkadot/util");
25
25
  const util_crypto_1 = require("@polkadot/util-crypto");
26
26
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
@@ -29,9 +29,9 @@ const lodash_1 = require("lodash");
29
29
  const utils_1 = require("../api/procedures/utils");
30
30
  const utils_2 = require("../generated/utils");
31
31
  const internal_1 = require("../internal");
32
- const enums_1 = require("../middleware/enums");
32
+ const types_1 = require("../middleware/types");
33
33
  const typesV1_1 = require("../middleware/typesV1");
34
- const types_1 = require("../types");
34
+ const types_2 = require("../types");
35
35
  const internal_2 = require("../types/internal");
36
36
  const utils_3 = require("../types/utils");
37
37
  const constants_1 = require("./constants");
@@ -189,9 +189,9 @@ function createSignerValue(type, value) {
189
189
  */
190
190
  function signatoryToSignerValue(signatory) {
191
191
  if (signatory.isAccount) {
192
- return createSignerValue(types_1.SignerType.Account, accountIdToString(signatory.asAccount));
192
+ return createSignerValue(types_2.SignerType.Account, accountIdToString(signatory.asAccount));
193
193
  }
194
- return createSignerValue(types_1.SignerType.Identity, identityIdToString(signatory.asIdentity));
194
+ return createSignerValue(types_2.SignerType.Identity, identityIdToString(signatory.asIdentity));
195
195
  }
196
196
  exports.signatoryToSignerValue = signatoryToSignerValue;
197
197
  /**
@@ -199,9 +199,9 @@ exports.signatoryToSignerValue = signatoryToSignerValue;
199
199
  */
200
200
  function signerToSignerValue(signer) {
201
201
  if (signer instanceof internal_1.Account) {
202
- return createSignerValue(types_1.SignerType.Account, signer.address);
202
+ return createSignerValue(types_2.SignerType.Account, signer.address);
203
203
  }
204
- return createSignerValue(types_1.SignerType.Identity, signer.did);
204
+ return createSignerValue(types_2.SignerType.Identity, signer.did);
205
205
  }
206
206
  exports.signerToSignerValue = signerToSignerValue;
207
207
  /**
@@ -209,7 +209,7 @@ exports.signerToSignerValue = signerToSignerValue;
209
209
  */
210
210
  function signerValueToSigner(signerValue, context) {
211
211
  const { type, value } = signerValue;
212
- if (type === types_1.SignerType.Account) {
212
+ if (type === types_2.SignerType.Account) {
213
213
  return new internal_1.Account({ address: value }, context);
214
214
  }
215
215
  return new internal_1.Identity({ did: value }, context);
@@ -271,7 +271,7 @@ function percentageToPermill(value, context) {
271
271
  (0, internal_3.assertIsPositive)(value);
272
272
  if (value.gt(100)) {
273
273
  throw new internal_1.PolymeshError({
274
- code: types_1.ErrorCode.ValidationError,
274
+ code: types_2.ErrorCode.ValidationError,
275
275
  message: "Percentage shouldn't exceed 100",
276
276
  });
277
277
  }
@@ -293,19 +293,19 @@ exports.permillToBigNumber = permillToBigNumber;
293
293
  function meshClaimToInputStatClaim(claim) {
294
294
  if (claim.isAccredited) {
295
295
  return {
296
- type: types_1.ClaimType.Accredited,
296
+ type: types_2.ClaimType.Accredited,
297
297
  accredited: boolToBoolean(claim.asAccredited),
298
298
  };
299
299
  }
300
300
  else if (claim.isAffiliate) {
301
301
  return {
302
- type: types_1.ClaimType.Affiliate,
302
+ type: types_2.ClaimType.Affiliate,
303
303
  affiliate: boolToBoolean(claim.asAffiliate),
304
304
  };
305
305
  }
306
306
  else {
307
307
  return {
308
- type: types_1.ClaimType.Jurisdiction,
308
+ type: types_2.ClaimType.Jurisdiction,
309
309
  countryCode: claim.asJurisdiction.isSome
310
310
  ? (0, utils_2.meshCountryCodeToCountryCode)(claim.asJurisdiction.unwrap())
311
311
  : undefined,
@@ -449,89 +449,89 @@ exports.textToString = textToString;
449
449
  */
450
450
  function txGroupToTxTags(group) {
451
451
  switch (group) {
452
- case types_1.TxGroup.PortfolioManagement: {
452
+ case types_2.TxGroup.PortfolioManagement: {
453
453
  return [
454
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
455
- types_1.TxTags.portfolio.MovePortfolioFunds,
456
- types_1.TxTags.settlement.AddInstruction,
457
- types_1.TxTags.settlement.AddInstructionWithMemo,
458
- types_1.TxTags.settlement.AddAndAffirmInstruction,
459
- types_1.TxTags.settlement.AddAndAffirmInstructionWithMemo,
460
- types_1.TxTags.settlement.AffirmInstruction,
461
- types_1.TxTags.settlement.RejectInstruction,
462
- types_1.TxTags.settlement.CreateVenue,
454
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
455
+ types_2.TxTags.portfolio.MovePortfolioFunds,
456
+ types_2.TxTags.settlement.AddInstruction,
457
+ types_2.TxTags.settlement.AddInstructionWithMemo,
458
+ types_2.TxTags.settlement.AddAndAffirmInstruction,
459
+ types_2.TxTags.settlement.AddAndAffirmInstructionWithMemo,
460
+ types_2.TxTags.settlement.AffirmInstruction,
461
+ types_2.TxTags.settlement.RejectInstruction,
462
+ types_2.TxTags.settlement.CreateVenue,
463
463
  ];
464
464
  }
465
- case types_1.TxGroup.AssetManagement: {
465
+ case types_2.TxGroup.AssetManagement: {
466
466
  return [
467
- types_1.TxTags.asset.MakeDivisible,
468
- types_1.TxTags.asset.RenameAsset,
469
- types_1.TxTags.asset.SetFundingRound,
470
- types_1.TxTags.asset.AddDocuments,
471
- types_1.TxTags.asset.RemoveDocuments,
467
+ types_2.TxTags.asset.MakeDivisible,
468
+ types_2.TxTags.asset.RenameAsset,
469
+ types_2.TxTags.asset.SetFundingRound,
470
+ types_2.TxTags.asset.AddDocuments,
471
+ types_2.TxTags.asset.RemoveDocuments,
472
472
  ];
473
473
  }
474
- case types_1.TxGroup.AdvancedAssetManagement: {
474
+ case types_2.TxGroup.AdvancedAssetManagement: {
475
475
  return [
476
- types_1.TxTags.asset.Freeze,
477
- types_1.TxTags.asset.Unfreeze,
478
- types_1.TxTags.identity.AddAuthorization,
479
- types_1.TxTags.identity.RemoveAuthorization,
476
+ types_2.TxTags.asset.Freeze,
477
+ types_2.TxTags.asset.Unfreeze,
478
+ types_2.TxTags.identity.AddAuthorization,
479
+ types_2.TxTags.identity.RemoveAuthorization,
480
480
  ];
481
481
  }
482
- case types_1.TxGroup.Distribution: {
482
+ case types_2.TxGroup.Distribution: {
483
483
  return [
484
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
485
- types_1.TxTags.settlement.CreateVenue,
486
- types_1.TxTags.settlement.AddInstruction,
487
- types_1.TxTags.settlement.AddInstructionWithMemo,
488
- types_1.TxTags.settlement.AddAndAffirmInstruction,
489
- types_1.TxTags.settlement.AddAndAffirmInstructionWithMemo,
484
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
485
+ types_2.TxTags.settlement.CreateVenue,
486
+ types_2.TxTags.settlement.AddInstruction,
487
+ types_2.TxTags.settlement.AddInstructionWithMemo,
488
+ types_2.TxTags.settlement.AddAndAffirmInstruction,
489
+ types_2.TxTags.settlement.AddAndAffirmInstructionWithMemo,
490
490
  ];
491
491
  }
492
- case types_1.TxGroup.Issuance: {
493
- return [types_1.TxTags.asset.Issue];
492
+ case types_2.TxGroup.Issuance: {
493
+ return [types_2.TxTags.asset.Issue];
494
494
  }
495
- case types_1.TxGroup.TrustedClaimIssuersManagement: {
495
+ case types_2.TxGroup.TrustedClaimIssuersManagement: {
496
496
  return [
497
- types_1.TxTags.complianceManager.AddDefaultTrustedClaimIssuer,
498
- types_1.TxTags.complianceManager.RemoveDefaultTrustedClaimIssuer,
497
+ types_2.TxTags.complianceManager.AddDefaultTrustedClaimIssuer,
498
+ types_2.TxTags.complianceManager.RemoveDefaultTrustedClaimIssuer,
499
499
  ];
500
500
  }
501
- case types_1.TxGroup.ClaimsManagement: {
502
- return [types_1.TxTags.identity.AddClaim, types_1.TxTags.identity.RevokeClaim];
501
+ case types_2.TxGroup.ClaimsManagement: {
502
+ return [types_2.TxTags.identity.AddClaim, types_2.TxTags.identity.RevokeClaim];
503
503
  }
504
- case types_1.TxGroup.ComplianceRequirementsManagement: {
504
+ case types_2.TxGroup.ComplianceRequirementsManagement: {
505
505
  return [
506
- types_1.TxTags.complianceManager.AddComplianceRequirement,
507
- types_1.TxTags.complianceManager.RemoveComplianceRequirement,
508
- types_1.TxTags.complianceManager.PauseAssetCompliance,
509
- types_1.TxTags.complianceManager.ResumeAssetCompliance,
510
- types_1.TxTags.complianceManager.ResetAssetCompliance,
506
+ types_2.TxTags.complianceManager.AddComplianceRequirement,
507
+ types_2.TxTags.complianceManager.RemoveComplianceRequirement,
508
+ types_2.TxTags.complianceManager.PauseAssetCompliance,
509
+ types_2.TxTags.complianceManager.ResumeAssetCompliance,
510
+ types_2.TxTags.complianceManager.ResetAssetCompliance,
511
511
  ];
512
512
  }
513
- case types_1.TxGroup.CorporateActionsManagement: {
513
+ case types_2.TxGroup.CorporateActionsManagement: {
514
514
  return [
515
- types_1.TxTags.checkpoint.CreateSchedule,
516
- types_1.TxTags.checkpoint.RemoveSchedule,
517
- types_1.TxTags.checkpoint.CreateCheckpoint,
518
- types_1.TxTags.corporateAction.InitiateCorporateAction,
519
- types_1.TxTags.capitalDistribution.Distribute,
520
- types_1.TxTags.capitalDistribution.Claim,
521
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
515
+ types_2.TxTags.checkpoint.CreateSchedule,
516
+ types_2.TxTags.checkpoint.RemoveSchedule,
517
+ types_2.TxTags.checkpoint.CreateCheckpoint,
518
+ types_2.TxTags.corporateAction.InitiateCorporateAction,
519
+ types_2.TxTags.capitalDistribution.Distribute,
520
+ types_2.TxTags.capitalDistribution.Claim,
521
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
522
522
  ];
523
523
  }
524
- case types_1.TxGroup.StoManagement: {
524
+ case types_2.TxGroup.StoManagement: {
525
525
  return [
526
- types_1.TxTags.sto.CreateFundraiser,
527
- types_1.TxTags.sto.FreezeFundraiser,
528
- types_1.TxTags.sto.Invest,
529
- types_1.TxTags.sto.ModifyFundraiserWindow,
530
- types_1.TxTags.sto.Stop,
531
- types_1.TxTags.sto.UnfreezeFundraiser,
532
- types_1.TxTags.identity.AddInvestorUniquenessClaim,
533
- types_1.TxTags.asset.Issue,
534
- types_1.TxTags.settlement.CreateVenue,
526
+ types_2.TxTags.sto.CreateFundraiser,
527
+ types_2.TxTags.sto.FreezeFundraiser,
528
+ types_2.TxTags.sto.Invest,
529
+ types_2.TxTags.sto.ModifyFundraiserWindow,
530
+ types_2.TxTags.sto.Stop,
531
+ types_2.TxTags.sto.UnfreezeFundraiser,
532
+ types_2.TxTags.identity.AddInvestorUniquenessClaim,
533
+ types_2.TxTags.asset.Issue,
534
+ types_2.TxTags.settlement.CreateVenue,
535
535
  ];
536
536
  }
537
537
  }
@@ -550,7 +550,7 @@ function transactionPermissionsToTxGroups(permissions) {
550
550
  const { values: transactionValues, type, exceptions = [] } = permissions;
551
551
  let includedTags;
552
552
  let excludedTags;
553
- if (type === types_1.PermissionType.Include) {
553
+ if (type === types_2.PermissionType.Include) {
554
554
  includedTags = transactionValues;
555
555
  excludedTags = exceptions;
556
556
  }
@@ -558,7 +558,7 @@ function transactionPermissionsToTxGroups(permissions) {
558
558
  includedTags = exceptions;
559
559
  excludedTags = transactionValues;
560
560
  }
561
- return (0, lodash_1.values)(types_1.TxGroup)
561
+ return (0, lodash_1.values)(types_2.TxGroup)
562
562
  .sort()
563
563
  .filter(group => {
564
564
  const tagsInGroup = txGroupToTxTags(group);
@@ -594,7 +594,7 @@ function initExtrinsicDict(txValues, message) {
594
594
  let pallet = extrinsicDict[palletName];
595
595
  if (pallet === null) {
596
596
  throw new internal_1.PolymeshError({
597
- code: types_1.ErrorCode.ValidationError,
597
+ code: types_2.ErrorCode.ValidationError,
598
598
  message,
599
599
  data: {
600
600
  module: palletName,
@@ -626,7 +626,7 @@ function buildPalletPermissions(transactions) {
626
626
  const pallet = extrinsicDict[palletName];
627
627
  if (pallet === undefined) {
628
628
  throw new internal_1.PolymeshError({
629
- code: types_1.ErrorCode.ValidationError,
629
+ code: types_2.ErrorCode.ValidationError,
630
630
  message: 'Attempting to add a transaction permission exception without its corresponding module being included/excluded',
631
631
  });
632
632
  }
@@ -638,7 +638,7 @@ function buildPalletPermissions(transactions) {
638
638
  }
639
639
  else {
640
640
  throw new internal_1.PolymeshError({
641
- code: types_1.ErrorCode.ValidationError,
641
+ code: types_2.ErrorCode.ValidationError,
642
642
  message: 'Cannot simultaneously include and exclude transactions belonging to the same module',
643
643
  });
644
644
  }
@@ -668,7 +668,7 @@ function buildPalletPermissions(transactions) {
668
668
  /* eslint-enable @typescript-eslint/naming-convention */
669
669
  };
670
670
  });
671
- if (type === types_1.PermissionType.Include) {
671
+ if (type === types_2.PermissionType.Include) {
672
672
  extrinsic = {
673
673
  These: pallets,
674
674
  };
@@ -698,7 +698,7 @@ function permissionsToMeshPermissions(permissions, context) {
698
698
  const { values: assetValues, type } = assets;
699
699
  assetValues.sort(({ ticker: tickerA }, { ticker: tickerB }) => tickerA.localeCompare(tickerB));
700
700
  const tickers = assetValues.map(({ ticker }) => stringToTicker(ticker, context));
701
- if (type === types_1.PermissionType.Include) {
701
+ if (type === types_2.PermissionType.Include) {
702
702
  asset = {
703
703
  These: tickers,
704
704
  };
@@ -713,7 +713,7 @@ function permissionsToMeshPermissions(permissions, context) {
713
713
  if (portfolios) {
714
714
  const { values: portfolioValues, type } = portfolios;
715
715
  const portfolioIds = portfolioValues.map(pValue => portfolioIdToMeshPortfolioId(portfolioToPortfolioId(pValue), context));
716
- if (type === types_1.PermissionType.Include) {
716
+ if (type === types_2.PermissionType.Include) {
717
717
  portfolio = {
718
718
  These: portfolioIds,
719
719
  };
@@ -742,11 +742,11 @@ function extrinsicPermissionsToTransactionPermissions(permissions) {
742
742
  let extrinsicType;
743
743
  let pallets;
744
744
  if (permissions.isThese) {
745
- extrinsicType = types_1.PermissionType.Include;
745
+ extrinsicType = types_2.PermissionType.Include;
746
746
  pallets = permissions.asThese;
747
747
  }
748
748
  else if (permissions.isExcept) {
749
- extrinsicType = types_1.PermissionType.Exclude;
749
+ extrinsicType = types_2.PermissionType.Exclude;
750
750
  pallets = permissions.asExcept;
751
751
  }
752
752
  let txValues = [];
@@ -794,11 +794,11 @@ function meshPermissionsToPermissions(permissions, context) {
794
794
  let assetsType;
795
795
  let assetsPermissions;
796
796
  if (asset.isThese) {
797
- assetsType = types_1.PermissionType.Include;
797
+ assetsType = types_2.PermissionType.Include;
798
798
  assetsPermissions = asset.asThese;
799
799
  }
800
800
  else if (asset.isExcept) {
801
- assetsType = types_1.PermissionType.Exclude;
801
+ assetsType = types_2.PermissionType.Exclude;
802
802
  assetsPermissions = asset.asExcept;
803
803
  }
804
804
  if (assetsPermissions) {
@@ -812,11 +812,11 @@ function meshPermissionsToPermissions(permissions, context) {
812
812
  let portfoliosType;
813
813
  let portfolioIds;
814
814
  if (portfolio.isThese) {
815
- portfoliosType = types_1.PermissionType.Include;
815
+ portfoliosType = types_2.PermissionType.Include;
816
816
  portfolioIds = portfolio.asThese;
817
817
  }
818
818
  else if (portfolio.isExcept) {
819
- portfoliosType = types_1.PermissionType.Exclude;
819
+ portfoliosType = types_2.PermissionType.Exclude;
820
820
  portfolioIds = portfolio.asExcept;
821
821
  }
822
822
  if (portfolioIds) {
@@ -878,16 +878,16 @@ exports.permissionGroupIdentifierToAgentGroup = permissionGroupIdentifierToAgent
878
878
  */
879
879
  function agentGroupToPermissionGroupIdentifier(agentGroup) {
880
880
  if (agentGroup.isFull) {
881
- return types_1.PermissionGroupType.Full;
881
+ return types_2.PermissionGroupType.Full;
882
882
  }
883
883
  else if (agentGroup.isExceptMeta) {
884
- return types_1.PermissionGroupType.ExceptMeta;
884
+ return types_2.PermissionGroupType.ExceptMeta;
885
885
  }
886
886
  else if (agentGroup.isPolymeshV1CAA) {
887
- return types_1.PermissionGroupType.PolymeshV1Caa;
887
+ return types_2.PermissionGroupType.PolymeshV1Caa;
888
888
  }
889
889
  else if (agentGroup.isPolymeshV1PIA) {
890
- return types_1.PermissionGroupType.PolymeshV1Pia;
890
+ return types_2.PermissionGroupType.PolymeshV1Pia;
891
891
  }
892
892
  else {
893
893
  return { custom: u32ToBigNumber(agentGroup.asCustom) };
@@ -900,26 +900,26 @@ exports.agentGroupToPermissionGroupIdentifier = agentGroupToPermissionGroupIdent
900
900
  function authorizationToAuthorizationData(auth, context) {
901
901
  let value;
902
902
  const { type } = auth;
903
- if (type === types_1.AuthorizationType.AttestPrimaryKeyRotation) {
903
+ if (type === types_2.AuthorizationType.AttestPrimaryKeyRotation) {
904
904
  value = stringToIdentityId(auth.value.did, context);
905
905
  }
906
- else if (type === types_1.AuthorizationType.RotatePrimaryKey) {
906
+ else if (type === types_2.AuthorizationType.RotatePrimaryKey) {
907
907
  value = null;
908
908
  }
909
- else if (type === types_1.AuthorizationType.JoinIdentity) {
909
+ else if (type === types_2.AuthorizationType.JoinIdentity) {
910
910
  value = permissionsToMeshPermissions(auth.value, context);
911
911
  }
912
- else if (type === types_1.AuthorizationType.PortfolioCustody) {
912
+ else if (type === types_2.AuthorizationType.PortfolioCustody) {
913
913
  value = portfolioIdToMeshPortfolioId(portfolioToPortfolioId(auth.value), context);
914
914
  }
915
- else if (auth.type === types_1.AuthorizationType.TransferAssetOwnership ||
916
- auth.type === types_1.AuthorizationType.TransferTicker) {
915
+ else if (auth.type === types_2.AuthorizationType.TransferAssetOwnership ||
916
+ auth.type === types_2.AuthorizationType.TransferTicker) {
917
917
  value = stringToTicker(auth.value, context);
918
918
  }
919
- else if (type === types_1.AuthorizationType.RotatePrimaryKeyToSecondary) {
919
+ else if (type === types_2.AuthorizationType.RotatePrimaryKeyToSecondary) {
920
920
  value = permissionsToMeshPermissions(auth.value, context);
921
921
  }
922
- else if (type === types_1.AuthorizationType.BecomeAgent) {
922
+ else if (type === types_2.AuthorizationType.BecomeAgent) {
923
923
  const ticker = stringToTicker(auth.value.asset.ticker, context);
924
924
  if (auth.value instanceof internal_1.CustomPermissionGroup) {
925
925
  const { id } = auth.value;
@@ -953,7 +953,7 @@ function bigNumberToBalance(value, context, divisible = true) {
953
953
  (0, internal_3.assertIsPositive)(value);
954
954
  if (value.isGreaterThan(constants_1.MAX_BALANCE)) {
955
955
  throw new internal_1.PolymeshError({
956
- code: types_1.ErrorCode.ValidationError,
956
+ code: types_2.ErrorCode.ValidationError,
957
957
  message: 'The value exceeds the maximum possible balance',
958
958
  data: {
959
959
  currentValue: value,
@@ -964,7 +964,7 @@ function bigNumberToBalance(value, context, divisible = true) {
964
964
  if (divisible) {
965
965
  if (((_a = value.decimalPlaces()) !== null && _a !== void 0 ? _a : 0) > constants_1.MAX_DECIMALS) {
966
966
  throw new internal_1.PolymeshError({
967
- code: types_1.ErrorCode.ValidationError,
967
+ code: types_2.ErrorCode.ValidationError,
968
968
  message: 'The value has more decimal places than allowed',
969
969
  data: {
970
970
  currentValue: value,
@@ -976,7 +976,7 @@ function bigNumberToBalance(value, context, divisible = true) {
976
976
  else {
977
977
  if (value.decimalPlaces()) {
978
978
  throw new internal_1.PolymeshError({
979
- code: types_1.ErrorCode.ValidationError,
979
+ code: types_2.ErrorCode.ValidationError,
980
980
  message: 'The value has decimals but the Asset is indivisible',
981
981
  });
982
982
  }
@@ -996,10 +996,10 @@ exports.balanceToBigNumber = balanceToBigNumber;
996
996
  */
997
997
  function assemblePermissionGroup(permissionGroupIdentifier, ticker, context) {
998
998
  switch (permissionGroupIdentifier) {
999
- case types_1.PermissionGroupType.ExceptMeta:
1000
- case types_1.PermissionGroupType.Full:
1001
- case types_1.PermissionGroupType.PolymeshV1Caa:
1002
- case types_1.PermissionGroupType.PolymeshV1Pia: {
999
+ case types_2.PermissionGroupType.ExceptMeta:
1000
+ case types_2.PermissionGroupType.Full:
1001
+ case types_2.PermissionGroupType.PolymeshV1Caa:
1002
+ case types_2.PermissionGroupType.PolymeshV1Pia: {
1003
1003
  return new internal_1.KnownPermissionGroup({ type: permissionGroupIdentifier, ticker }, context);
1004
1004
  }
1005
1005
  default: {
@@ -1022,7 +1022,7 @@ exports.agentGroupToPermissionGroup = agentGroupToPermissionGroup;
1022
1022
  function authorizationDataToAuthorization(auth, context) {
1023
1023
  if (auth.isAttestPrimaryKeyRotation) {
1024
1024
  return {
1025
- type: types_1.AuthorizationType.AttestPrimaryKeyRotation,
1025
+ type: types_2.AuthorizationType.AttestPrimaryKeyRotation,
1026
1026
  value: new internal_1.Identity({
1027
1027
  did: identityIdToString(auth.asAttestPrimaryKeyRotation),
1028
1028
  }, context),
@@ -1030,43 +1030,43 @@ function authorizationDataToAuthorization(auth, context) {
1030
1030
  }
1031
1031
  if (auth.isRotatePrimaryKey) {
1032
1032
  return {
1033
- type: types_1.AuthorizationType.RotatePrimaryKey,
1033
+ type: types_2.AuthorizationType.RotatePrimaryKey,
1034
1034
  };
1035
1035
  }
1036
1036
  if (auth.isTransferTicker) {
1037
1037
  return {
1038
- type: types_1.AuthorizationType.TransferTicker,
1038
+ type: types_2.AuthorizationType.TransferTicker,
1039
1039
  value: tickerToString(auth.asTransferTicker),
1040
1040
  };
1041
1041
  }
1042
1042
  if (auth.isAddMultiSigSigner) {
1043
1043
  return {
1044
- type: types_1.AuthorizationType.AddMultiSigSigner,
1044
+ type: types_2.AuthorizationType.AddMultiSigSigner,
1045
1045
  value: accountIdToString(auth.asAddMultiSigSigner),
1046
1046
  };
1047
1047
  }
1048
1048
  if (auth.isTransferAssetOwnership) {
1049
1049
  return {
1050
- type: types_1.AuthorizationType.TransferAssetOwnership,
1050
+ type: types_2.AuthorizationType.TransferAssetOwnership,
1051
1051
  value: tickerToString(auth.asTransferAssetOwnership),
1052
1052
  };
1053
1053
  }
1054
1054
  if (auth.isPortfolioCustody) {
1055
1055
  return {
1056
- type: types_1.AuthorizationType.PortfolioCustody,
1056
+ type: types_2.AuthorizationType.PortfolioCustody,
1057
1057
  value: meshPortfolioIdToPortfolio(auth.asPortfolioCustody, context),
1058
1058
  };
1059
1059
  }
1060
1060
  if (auth.isJoinIdentity) {
1061
1061
  return {
1062
- type: types_1.AuthorizationType.JoinIdentity,
1062
+ type: types_2.AuthorizationType.JoinIdentity,
1063
1063
  value: meshPermissionsToPermissions(auth.asJoinIdentity, context),
1064
1064
  };
1065
1065
  }
1066
1066
  if (auth.isAddRelayerPayingKey) {
1067
1067
  const [userKey, payingKey, polyxLimit] = auth.asAddRelayerPayingKey;
1068
1068
  return {
1069
- type: types_1.AuthorizationType.AddRelayerPayingKey,
1069
+ type: types_2.AuthorizationType.AddRelayerPayingKey,
1070
1070
  value: {
1071
1071
  beneficiary: new internal_1.Account({ address: accountIdToString(userKey) }, context),
1072
1072
  subsidizer: new internal_1.Account({ address: accountIdToString(payingKey) }, context),
@@ -1077,18 +1077,18 @@ function authorizationDataToAuthorization(auth, context) {
1077
1077
  if (auth.isBecomeAgent) {
1078
1078
  const [ticker, agentGroup] = auth.asBecomeAgent;
1079
1079
  return {
1080
- type: types_1.AuthorizationType.BecomeAgent,
1080
+ type: types_2.AuthorizationType.BecomeAgent,
1081
1081
  value: agentGroupToPermissionGroup(agentGroup, tickerToString(ticker), context),
1082
1082
  };
1083
1083
  }
1084
1084
  if (auth.isRotatePrimaryKeyToSecondary) {
1085
1085
  return {
1086
- type: types_1.AuthorizationType.RotatePrimaryKeyToSecondary,
1086
+ type: types_2.AuthorizationType.RotatePrimaryKeyToSecondary,
1087
1087
  value: meshPermissionsToPermissions(auth.asRotatePrimaryKeyToSecondary, context),
1088
1088
  };
1089
1089
  }
1090
1090
  throw new internal_1.PolymeshError({
1091
- code: types_1.ErrorCode.UnexpectedError,
1091
+ code: types_2.ErrorCode.UnexpectedError,
1092
1092
  message: 'Unsupported Authorization Type. Please contact the Polymesh team',
1093
1093
  data: {
1094
1094
  auth: JSON.stringify(auth, null, 2),
@@ -1102,7 +1102,7 @@ exports.authorizationDataToAuthorization = authorizationDataToAuthorization;
1102
1102
  function assertMemoValid(value) {
1103
1103
  if (value.length > constants_1.MAX_MEMO_LENGTH) {
1104
1104
  throw new internal_1.PolymeshError({
1105
- code: types_1.ErrorCode.ValidationError,
1105
+ code: types_2.ErrorCode.ValidationError,
1106
1106
  message: 'Max memo length exceeded',
1107
1107
  data: {
1108
1108
  maxLength: constants_1.MAX_MEMO_LENGTH,
@@ -1125,71 +1125,71 @@ function u8ToTransferStatus(status) {
1125
1125
  const code = status.toNumber();
1126
1126
  switch (code) {
1127
1127
  case 81: {
1128
- return types_1.TransferStatus.Success;
1128
+ return types_2.TransferStatus.Success;
1129
1129
  }
1130
1130
  case 82: {
1131
- return types_1.TransferStatus.InsufficientBalance;
1131
+ return types_2.TransferStatus.InsufficientBalance;
1132
1132
  }
1133
1133
  case 83: {
1134
- return types_1.TransferStatus.InsufficientAllowance;
1134
+ return types_2.TransferStatus.InsufficientAllowance;
1135
1135
  }
1136
1136
  case 84: {
1137
- return types_1.TransferStatus.TransfersHalted;
1137
+ return types_2.TransferStatus.TransfersHalted;
1138
1138
  }
1139
1139
  case 85: {
1140
- return types_1.TransferStatus.FundsLocked;
1140
+ return types_2.TransferStatus.FundsLocked;
1141
1141
  }
1142
1142
  case 86: {
1143
- return types_1.TransferStatus.InvalidSenderAddress;
1143
+ return types_2.TransferStatus.InvalidSenderAddress;
1144
1144
  }
1145
1145
  case 87: {
1146
- return types_1.TransferStatus.InvalidReceiverAddress;
1146
+ return types_2.TransferStatus.InvalidReceiverAddress;
1147
1147
  }
1148
1148
  case 88: {
1149
- return types_1.TransferStatus.InvalidOperator;
1149
+ return types_2.TransferStatus.InvalidOperator;
1150
1150
  }
1151
1151
  case 160: {
1152
- return types_1.TransferStatus.InvalidSenderIdentity;
1152
+ return types_2.TransferStatus.InvalidSenderIdentity;
1153
1153
  }
1154
1154
  case 161: {
1155
- return types_1.TransferStatus.InvalidReceiverIdentity;
1155
+ return types_2.TransferStatus.InvalidReceiverIdentity;
1156
1156
  }
1157
1157
  case 162: {
1158
- return types_1.TransferStatus.ComplianceFailure;
1158
+ return types_2.TransferStatus.ComplianceFailure;
1159
1159
  }
1160
1160
  case 163: {
1161
- return types_1.TransferStatus.SmartExtensionFailure;
1161
+ return types_2.TransferStatus.SmartExtensionFailure;
1162
1162
  }
1163
1163
  case 164: {
1164
- return types_1.TransferStatus.InvalidGranularity;
1164
+ return types_2.TransferStatus.InvalidGranularity;
1165
1165
  }
1166
1166
  case 165: {
1167
- return types_1.TransferStatus.VolumeLimitReached;
1167
+ return types_2.TransferStatus.VolumeLimitReached;
1168
1168
  }
1169
1169
  case 166: {
1170
- return types_1.TransferStatus.BlockedTransaction;
1170
+ return types_2.TransferStatus.BlockedTransaction;
1171
1171
  }
1172
1172
  case 168: {
1173
- return types_1.TransferStatus.FundsLimitReached;
1173
+ return types_2.TransferStatus.FundsLimitReached;
1174
1174
  }
1175
1175
  case 169: {
1176
- return types_1.TransferStatus.PortfolioFailure;
1176
+ return types_2.TransferStatus.PortfolioFailure;
1177
1177
  }
1178
1178
  case 170: {
1179
- return types_1.TransferStatus.CustodianError;
1179
+ return types_2.TransferStatus.CustodianError;
1180
1180
  }
1181
1181
  case 171: {
1182
- return types_1.TransferStatus.ScopeClaimMissing;
1182
+ return types_2.TransferStatus.ScopeClaimMissing;
1183
1183
  }
1184
1184
  case 172: {
1185
- return types_1.TransferStatus.TransferRestrictionFailure;
1185
+ return types_2.TransferStatus.TransferRestrictionFailure;
1186
1186
  }
1187
1187
  case 80: {
1188
- return types_1.TransferStatus.Failure;
1188
+ return types_2.TransferStatus.Failure;
1189
1189
  }
1190
1190
  default: {
1191
1191
  throw new internal_1.PolymeshError({
1192
- code: types_1.ErrorCode.UnexpectedError,
1192
+ code: types_2.ErrorCode.UnexpectedError,
1193
1193
  message: `Unsupported status code "${status.toString()}". Please report this issue to the Polymesh team`,
1194
1194
  });
1195
1195
  }
@@ -1218,46 +1218,46 @@ function assetTypeToKnownOrId(assetType) {
1218
1218
  const type = 'NonFungible';
1219
1219
  const rawNftType = assetType.asNonFungible;
1220
1220
  if (rawNftType.isDerivative) {
1221
- return { type, value: types_1.KnownNftType.Derivative };
1221
+ return { type, value: types_2.KnownNftType.Derivative };
1222
1222
  }
1223
1223
  else if (rawNftType.isFixedIncome) {
1224
- return { type, value: types_1.KnownNftType.FixedIncome };
1224
+ return { type, value: types_2.KnownNftType.FixedIncome };
1225
1225
  }
1226
1226
  else if (rawNftType.isInvoice) {
1227
- return { type, value: types_1.KnownNftType.Invoice };
1227
+ return { type, value: types_2.KnownNftType.Invoice };
1228
1228
  }
1229
1229
  return { type, value: u32ToBigNumber(rawNftType.asCustom) };
1230
1230
  }
1231
1231
  const type = 'Fungible';
1232
1232
  if (assetType.isEquityCommon) {
1233
- return { type, value: types_1.KnownAssetType.EquityCommon };
1233
+ return { type, value: types_2.KnownAssetType.EquityCommon };
1234
1234
  }
1235
1235
  if (assetType.isEquityPreferred) {
1236
- return { type, value: types_1.KnownAssetType.EquityPreferred };
1236
+ return { type, value: types_2.KnownAssetType.EquityPreferred };
1237
1237
  }
1238
1238
  if (assetType.isCommodity) {
1239
- return { type, value: types_1.KnownAssetType.Commodity };
1239
+ return { type, value: types_2.KnownAssetType.Commodity };
1240
1240
  }
1241
1241
  if (assetType.isFixedIncome) {
1242
- return { type, value: types_1.KnownAssetType.FixedIncome };
1242
+ return { type, value: types_2.KnownAssetType.FixedIncome };
1243
1243
  }
1244
1244
  if (assetType.isReit) {
1245
- return { type, value: types_1.KnownAssetType.Reit };
1245
+ return { type, value: types_2.KnownAssetType.Reit };
1246
1246
  }
1247
1247
  if (assetType.isFund) {
1248
- return { type, value: types_1.KnownAssetType.Fund };
1248
+ return { type, value: types_2.KnownAssetType.Fund };
1249
1249
  }
1250
1250
  if (assetType.isRevenueShareAgreement) {
1251
- return { type, value: types_1.KnownAssetType.RevenueShareAgreement };
1251
+ return { type, value: types_2.KnownAssetType.RevenueShareAgreement };
1252
1252
  }
1253
1253
  if (assetType.isStructuredProduct) {
1254
- return { type, value: types_1.KnownAssetType.StructuredProduct };
1254
+ return { type, value: types_2.KnownAssetType.StructuredProduct };
1255
1255
  }
1256
1256
  if (assetType.isDerivative) {
1257
- return { type, value: types_1.KnownAssetType.Derivative };
1257
+ return { type, value: types_2.KnownAssetType.Derivative };
1258
1258
  }
1259
1259
  if (assetType.isStableCoin) {
1260
- return { type, value: types_1.KnownAssetType.StableCoin };
1260
+ return { type, value: types_2.KnownAssetType.StableCoin };
1261
1261
  }
1262
1262
  return { type, value: u32ToBigNumber(assetType.asCustom) };
1263
1263
  }
@@ -1278,7 +1278,7 @@ function nameToAssetName(value, context) {
1278
1278
  const nameMaxLength = u32ToBigNumber(assetNameMaxLength);
1279
1279
  if (nameMaxLength.lt(value.length)) {
1280
1280
  throw new internal_1.PolymeshError({
1281
- code: types_1.ErrorCode.ValidationError,
1281
+ code: types_2.ErrorCode.ValidationError,
1282
1282
  message: 'Asset name length exceeded',
1283
1283
  data: {
1284
1284
  maxLength: nameMaxLength,
@@ -1296,7 +1296,7 @@ function fundingRoundToAssetFundingRound(value, context) {
1296
1296
  const nameMaxLength = u32ToBigNumber(fundingRoundNameMaxLength);
1297
1297
  if (nameMaxLength.lt(value.length)) {
1298
1298
  throw new internal_1.PolymeshError({
1299
- code: types_1.ErrorCode.ValidationError,
1299
+ code: types_2.ErrorCode.ValidationError,
1300
1300
  message: 'Asset funding round name length exceeded',
1301
1301
  data: {
1302
1302
  maxLength: nameMaxLength,
@@ -1416,19 +1416,19 @@ function securityIdentifierToAssetIdentifier(identifier, context) {
1416
1416
  const { type, value } = identifier;
1417
1417
  let error = false;
1418
1418
  switch (type) {
1419
- case types_1.SecurityIdentifierType.Isin: {
1419
+ case types_2.SecurityIdentifierType.Isin: {
1420
1420
  if (!isIsinValid(value)) {
1421
1421
  error = true;
1422
1422
  }
1423
1423
  break;
1424
1424
  }
1425
- case types_1.SecurityIdentifierType.Lei: {
1425
+ case types_2.SecurityIdentifierType.Lei: {
1426
1426
  if (!isLeiValid(value)) {
1427
1427
  error = true;
1428
1428
  }
1429
1429
  break;
1430
1430
  }
1431
- case types_1.SecurityIdentifierType.Figi: {
1431
+ case types_2.SecurityIdentifierType.Figi: {
1432
1432
  if (!isFigiValid(value)) {
1433
1433
  error = true;
1434
1434
  }
@@ -1443,7 +1443,7 @@ function securityIdentifierToAssetIdentifier(identifier, context) {
1443
1443
  }
1444
1444
  if (error) {
1445
1445
  throw new internal_1.PolymeshError({
1446
- code: types_1.ErrorCode.ValidationError,
1446
+ code: types_2.ErrorCode.ValidationError,
1447
1447
  message: `Invalid security identifier ${value} of type ${type}`,
1448
1448
  });
1449
1449
  }
@@ -1456,30 +1456,30 @@ exports.securityIdentifierToAssetIdentifier = securityIdentifierToAssetIdentifie
1456
1456
  function assetIdentifierToSecurityIdentifier(identifier) {
1457
1457
  if (identifier.isCusip) {
1458
1458
  return {
1459
- type: types_1.SecurityIdentifierType.Cusip,
1459
+ type: types_2.SecurityIdentifierType.Cusip,
1460
1460
  value: (0, util_1.u8aToString)(identifier.asCusip),
1461
1461
  };
1462
1462
  }
1463
1463
  if (identifier.isIsin) {
1464
1464
  return {
1465
- type: types_1.SecurityIdentifierType.Isin,
1465
+ type: types_2.SecurityIdentifierType.Isin,
1466
1466
  value: (0, util_1.u8aToString)(identifier.asIsin),
1467
1467
  };
1468
1468
  }
1469
1469
  if (identifier.isCins) {
1470
1470
  return {
1471
- type: types_1.SecurityIdentifierType.Cins,
1471
+ type: types_2.SecurityIdentifierType.Cins,
1472
1472
  value: (0, util_1.u8aToString)(identifier.asCins),
1473
1473
  };
1474
1474
  }
1475
1475
  if (identifier.isFigi) {
1476
1476
  return {
1477
- type: types_1.SecurityIdentifierType.Figi,
1477
+ type: types_2.SecurityIdentifierType.Figi,
1478
1478
  value: (0, util_1.u8aToString)(identifier.asFigi),
1479
1479
  };
1480
1480
  }
1481
1481
  return {
1482
- type: types_1.SecurityIdentifierType.Lei,
1482
+ type: types_2.SecurityIdentifierType.Lei,
1483
1483
  value: (0, util_1.u8aToString)(identifier.asLei),
1484
1484
  };
1485
1485
  }
@@ -1493,7 +1493,7 @@ function stringToDocumentHash(docHash, context) {
1493
1493
  }
1494
1494
  if (!(0, util_1.isHex)(docHash, -1, true)) {
1495
1495
  throw new internal_1.PolymeshError({
1496
- code: types_1.ErrorCode.ValidationError,
1496
+ code: types_2.ErrorCode.ValidationError,
1497
1497
  message: 'Document hash must be a hexadecimal string prefixed by 0x',
1498
1498
  });
1499
1499
  }
@@ -1506,7 +1506,7 @@ function stringToDocumentHash(docHash, context) {
1506
1506
  const type = hashTypes.find(({ maxLength: max }) => length <= max);
1507
1507
  if (!type) {
1508
1508
  throw new internal_1.PolymeshError({
1509
- code: types_1.ErrorCode.ValidationError,
1509
+ code: types_2.ErrorCode.ValidationError,
1510
1510
  message: 'Document hash exceeds max length',
1511
1511
  });
1512
1512
  }
@@ -1599,7 +1599,7 @@ exports.cddStatusToBoolean = cddStatusToBoolean;
1599
1599
  function canTransferResultToTransferStatus(canTransferResult) {
1600
1600
  if (canTransferResult.isErr) {
1601
1601
  throw new internal_1.PolymeshError({
1602
- code: types_1.ErrorCode.UnexpectedError,
1602
+ code: types_2.ErrorCode.UnexpectedError,
1603
1603
  message: `Error while checking transfer validity: ${bytesToString(canTransferResult.asErr)}`,
1604
1604
  });
1605
1605
  }
@@ -1613,10 +1613,10 @@ function scopeToMeshScope(scope, context) {
1613
1613
  const { type, value } = scope;
1614
1614
  let scopeValue;
1615
1615
  switch (type) {
1616
- case types_1.ScopeType.Ticker:
1616
+ case types_2.ScopeType.Ticker:
1617
1617
  scopeValue = stringToTicker(value, context);
1618
1618
  break;
1619
- case types_1.ScopeType.Identity:
1619
+ case types_2.ScopeType.Identity:
1620
1620
  scopeValue = stringToIdentityId(value, context);
1621
1621
  break;
1622
1622
  default:
@@ -1634,18 +1634,18 @@ exports.scopeToMeshScope = scopeToMeshScope;
1634
1634
  function meshScopeToScope(scope) {
1635
1635
  if (scope.isTicker) {
1636
1636
  return {
1637
- type: types_1.ScopeType.Ticker,
1637
+ type: types_2.ScopeType.Ticker,
1638
1638
  value: tickerToString(scope.asTicker),
1639
1639
  };
1640
1640
  }
1641
1641
  if (scope.isIdentity) {
1642
1642
  return {
1643
- type: types_1.ScopeType.Identity,
1643
+ type: types_2.ScopeType.Identity,
1644
1644
  value: identityIdToString(scope.asIdentity),
1645
1645
  };
1646
1646
  }
1647
1647
  return {
1648
- type: types_1.ScopeType.Custom,
1648
+ type: types_2.ScopeType.Custom,
1649
1649
  value: (0, util_1.u8aToString)(scope.asCustom),
1650
1650
  };
1651
1651
  }
@@ -1670,15 +1670,20 @@ exports.cddIdToString = cddIdToString;
1670
1670
  function claimToMeshClaim(claim, context) {
1671
1671
  let value;
1672
1672
  switch (claim.type) {
1673
- case types_1.ClaimType.CustomerDueDiligence: {
1673
+ case types_2.ClaimType.CustomerDueDiligence: {
1674
1674
  value = stringToCddId(claim.id, context);
1675
1675
  break;
1676
1676
  }
1677
- case types_1.ClaimType.Jurisdiction: {
1677
+ case types_2.ClaimType.Jurisdiction: {
1678
1678
  const { code, scope } = claim;
1679
1679
  value = (0, utils_3.tuple)(code, scopeToMeshScope(scope, context));
1680
1680
  break;
1681
1681
  }
1682
+ case types_2.ClaimType.Custom: {
1683
+ const { customClaimTypeId, scope } = claim;
1684
+ value = (0, utils_3.tuple)(bigNumberToU32(customClaimTypeId, context), scopeToMeshScope(scope, context));
1685
+ break;
1686
+ }
1682
1687
  default: {
1683
1688
  value = scopeToMeshScope(claim.scope, context);
1684
1689
  }
@@ -1693,13 +1698,13 @@ function middlewareScopeToScope(scope) {
1693
1698
  const { type, value } = scope;
1694
1699
  switch (type) {
1695
1700
  case typesV1_1.ClaimScopeTypeEnum.Ticker:
1696
- return { type: types_1.ScopeType.Ticker, value: (0, internal_3.removePadding)(value) };
1701
+ return { type: types_2.ScopeType.Ticker, value: (0, internal_3.removePadding)(value) };
1697
1702
  case typesV1_1.ClaimScopeTypeEnum.Identity:
1698
1703
  case typesV1_1.ClaimScopeTypeEnum.Custom:
1699
1704
  return { type: scope.type, value };
1700
1705
  }
1701
1706
  throw new internal_1.PolymeshError({
1702
- code: types_1.ErrorCode.UnexpectedError,
1707
+ code: types_2.ErrorCode.UnexpectedError,
1703
1708
  message: 'Unsupported Scope Type. Please contact the Polymesh team',
1704
1709
  data: {
1705
1710
  scope,
@@ -1713,13 +1718,13 @@ exports.middlewareScopeToScope = middlewareScopeToScope;
1713
1718
  function scopeToMiddlewareScope(scope, padTicker = true) {
1714
1719
  const { type, value } = scope;
1715
1720
  switch (type) {
1716
- case types_1.ScopeType.Ticker:
1721
+ case types_2.ScopeType.Ticker:
1717
1722
  return {
1718
1723
  type: typesV1_1.ClaimScopeTypeEnum.Ticker,
1719
1724
  value: padTicker ? (0, lodash_1.padEnd)(value, 12, '\0') : value,
1720
1725
  };
1721
- case types_1.ScopeType.Identity:
1722
- case types_1.ScopeType.Custom:
1726
+ case types_2.ScopeType.Identity:
1727
+ case types_2.ScopeType.Custom:
1723
1728
  return { type: typesV1_1.ClaimScopeTypeEnum[scope.type], value };
1724
1729
  }
1725
1730
  }
@@ -1744,55 +1749,55 @@ function meshClaimToClaim(claim) {
1744
1749
  if (claim.isJurisdiction) {
1745
1750
  const [code, scope] = claim.asJurisdiction;
1746
1751
  return {
1747
- type: types_1.ClaimType.Jurisdiction,
1752
+ type: types_2.ClaimType.Jurisdiction,
1748
1753
  code: (0, utils_2.meshCountryCodeToCountryCode)(code),
1749
1754
  scope: meshScopeToScope(scope),
1750
1755
  };
1751
1756
  }
1752
1757
  if (claim.isAccredited) {
1753
1758
  return {
1754
- type: types_1.ClaimType.Accredited,
1759
+ type: types_2.ClaimType.Accredited,
1755
1760
  scope: meshScopeToScope(claim.asAccredited),
1756
1761
  };
1757
1762
  }
1758
1763
  if (claim.isAffiliate) {
1759
1764
  return {
1760
- type: types_1.ClaimType.Affiliate,
1765
+ type: types_2.ClaimType.Affiliate,
1761
1766
  scope: meshScopeToScope(claim.asAffiliate),
1762
1767
  };
1763
1768
  }
1764
1769
  if (claim.isBuyLockup) {
1765
1770
  return {
1766
- type: types_1.ClaimType.BuyLockup,
1771
+ type: types_2.ClaimType.BuyLockup,
1767
1772
  scope: meshScopeToScope(claim.asBuyLockup),
1768
1773
  };
1769
1774
  }
1770
1775
  if (claim.isSellLockup) {
1771
1776
  return {
1772
- type: types_1.ClaimType.SellLockup,
1777
+ type: types_2.ClaimType.SellLockup,
1773
1778
  scope: meshScopeToScope(claim.asSellLockup),
1774
1779
  };
1775
1780
  }
1776
1781
  if (claim.isCustomerDueDiligence) {
1777
1782
  return {
1778
- type: types_1.ClaimType.CustomerDueDiligence,
1783
+ type: types_2.ClaimType.CustomerDueDiligence,
1779
1784
  id: cddIdToString(claim.asCustomerDueDiligence),
1780
1785
  };
1781
1786
  }
1782
1787
  if (claim.isKnowYourCustomer) {
1783
1788
  return {
1784
- type: types_1.ClaimType.KnowYourCustomer,
1789
+ type: types_2.ClaimType.KnowYourCustomer,
1785
1790
  scope: meshScopeToScope(claim.asKnowYourCustomer),
1786
1791
  };
1787
1792
  }
1788
1793
  if (claim.isExempted) {
1789
1794
  return {
1790
- type: types_1.ClaimType.Exempted,
1795
+ type: types_2.ClaimType.Exempted,
1791
1796
  scope: meshScopeToScope(claim.asExempted),
1792
1797
  };
1793
1798
  }
1794
1799
  return {
1795
- type: types_1.ClaimType.Blocked,
1800
+ type: types_2.ClaimType.Blocked,
1796
1801
  scope: meshScopeToScope(claim.asBlocked),
1797
1802
  };
1798
1803
  }
@@ -1803,14 +1808,14 @@ exports.meshClaimToClaim = meshClaimToClaim;
1803
1808
  function statsClaimToStatClaimInputType(claim) {
1804
1809
  if (claim.isJurisdiction) {
1805
1810
  return {
1806
- type: types_1.ClaimType.Jurisdiction,
1811
+ type: types_2.ClaimType.Jurisdiction,
1807
1812
  };
1808
1813
  }
1809
1814
  else if (claim.isAccredited) {
1810
- return { type: types_1.ClaimType.Accredited };
1815
+ return { type: types_2.ClaimType.Accredited };
1811
1816
  }
1812
1817
  else {
1813
- return { type: types_1.ClaimType.Affiliate };
1818
+ return { type: types_2.ClaimType.Affiliate };
1814
1819
  }
1815
1820
  }
1816
1821
  exports.statsClaimToStatClaimInputType = statsClaimToStatClaimInputType;
@@ -1828,30 +1833,30 @@ exports.stringToTargetIdentity = stringToTargetIdentity;
1828
1833
  */
1829
1834
  function meshClaimTypeToClaimType(claimType) {
1830
1835
  if (claimType.isJurisdiction) {
1831
- return types_1.ClaimType.Jurisdiction;
1836
+ return types_2.ClaimType.Jurisdiction;
1832
1837
  }
1833
1838
  if (claimType.isAccredited) {
1834
- return types_1.ClaimType.Accredited;
1839
+ return types_2.ClaimType.Accredited;
1835
1840
  }
1836
1841
  if (claimType.isAffiliate) {
1837
- return types_1.ClaimType.Affiliate;
1842
+ return types_2.ClaimType.Affiliate;
1838
1843
  }
1839
1844
  if (claimType.isBuyLockup) {
1840
- return types_1.ClaimType.BuyLockup;
1845
+ return types_2.ClaimType.BuyLockup;
1841
1846
  }
1842
1847
  if (claimType.isSellLockup) {
1843
- return types_1.ClaimType.SellLockup;
1848
+ return types_2.ClaimType.SellLockup;
1844
1849
  }
1845
1850
  if (claimType.isCustomerDueDiligence) {
1846
- return types_1.ClaimType.CustomerDueDiligence;
1851
+ return types_2.ClaimType.CustomerDueDiligence;
1847
1852
  }
1848
1853
  if (claimType.isKnowYourCustomer) {
1849
- return types_1.ClaimType.KnowYourCustomer;
1854
+ return types_2.ClaimType.KnowYourCustomer;
1850
1855
  }
1851
1856
  if (claimType.isExempted) {
1852
- return types_1.ClaimType.Exempted;
1857
+ return types_2.ClaimType.Exempted;
1853
1858
  }
1854
- return types_1.ClaimType.Blocked;
1859
+ return types_2.ClaimType.Blocked;
1855
1860
  }
1856
1861
  exports.meshClaimTypeToClaimType = meshClaimTypeToClaimType;
1857
1862
  /**
@@ -1912,7 +1917,7 @@ function requirementToComplianceRequirement(requirement, context) {
1912
1917
  }
1913
1918
  else {
1914
1919
  // IsExternalAgent does not exist as a condition type in Polymesh, it's SDK sugar
1915
- type = types_1.ConditionType.IsIdentity;
1920
+ type = types_2.ConditionType.IsIdentity;
1916
1921
  conditionContent = stringToTargetIdentity(null, context);
1917
1922
  }
1918
1923
  const { target, trustedClaimIssuers = [] } = condition;
@@ -1922,10 +1927,10 @@ function requirementToComplianceRequirement(requirement, context) {
1922
1927
  },
1923
1928
  issuers: trustedClaimIssuers.map(issuer => trustedClaimIssuerToTrustedIssuer(issuer, context)),
1924
1929
  });
1925
- if ([types_1.ConditionTarget.Both, types_1.ConditionTarget.Receiver].includes(target)) {
1930
+ if ([types_2.ConditionTarget.Both, types_2.ConditionTarget.Receiver].includes(target)) {
1926
1931
  receiverConditions.push(meshCondition);
1927
1932
  }
1928
- if ([types_1.ConditionTarget.Both, types_1.ConditionTarget.Sender].includes(target)) {
1933
+ if ([types_2.ConditionTarget.Both, types_2.ConditionTarget.Sender].includes(target)) {
1929
1934
  senderConditions.push(meshCondition);
1930
1935
  }
1931
1936
  });
@@ -1942,19 +1947,19 @@ exports.requirementToComplianceRequirement = requirementToComplianceRequirement;
1942
1947
  function meshConditionTypeToCondition(meshConditionType, context) {
1943
1948
  if (meshConditionType.isIsPresent) {
1944
1949
  return {
1945
- type: types_1.ConditionType.IsPresent,
1950
+ type: types_2.ConditionType.IsPresent,
1946
1951
  claim: meshClaimToClaim(meshConditionType.asIsPresent),
1947
1952
  };
1948
1953
  }
1949
1954
  if (meshConditionType.isIsAbsent) {
1950
1955
  return {
1951
- type: types_1.ConditionType.IsAbsent,
1956
+ type: types_2.ConditionType.IsAbsent,
1952
1957
  claim: meshClaimToClaim(meshConditionType.asIsAbsent),
1953
1958
  };
1954
1959
  }
1955
1960
  if (meshConditionType.isIsAnyOf) {
1956
1961
  return {
1957
- type: types_1.ConditionType.IsAnyOf,
1962
+ type: types_2.ConditionType.IsAnyOf,
1958
1963
  claims: meshConditionType.asIsAnyOf.map(claim => meshClaimToClaim(claim)),
1959
1964
  };
1960
1965
  }
@@ -1962,16 +1967,16 @@ function meshConditionTypeToCondition(meshConditionType, context) {
1962
1967
  const target = meshConditionType.asIsIdentity;
1963
1968
  if (target.isExternalAgent) {
1964
1969
  return {
1965
- type: types_1.ConditionType.IsExternalAgent,
1970
+ type: types_2.ConditionType.IsExternalAgent,
1966
1971
  };
1967
1972
  }
1968
1973
  return {
1969
- type: types_1.ConditionType.IsIdentity,
1974
+ type: types_2.ConditionType.IsIdentity,
1970
1975
  identity: new internal_1.Identity({ did: identityIdToString(target.asSpecific) }, context),
1971
1976
  };
1972
1977
  }
1973
1978
  return {
1974
- type: types_1.ConditionType.IsNoneOf,
1979
+ type: types_2.ConditionType.IsNoneOf,
1975
1980
  claims: meshConditionType.asIsNoneOf.map(claim => meshClaimToClaim(claim)),
1976
1981
  };
1977
1982
  }
@@ -1984,7 +1989,7 @@ function complianceRequirementResultToRequirementCompliance(complianceRequiremen
1984
1989
  const conditionCompliancesAreEqual = ({ condition: aCondition, complies: aComplies }, { condition: bCondition, complies: bComplies }) => (0, internal_3.conditionsAreEqual)(aCondition, bCondition) && aComplies === bComplies;
1985
1990
  complianceRequirement.senderConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
1986
1991
  const newCondition = {
1987
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_1.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
1992
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
1988
1993
  complies: boolToBoolean(result),
1989
1994
  };
1990
1995
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
@@ -1994,12 +1999,12 @@ function complianceRequirementResultToRequirementCompliance(complianceRequiremen
1994
1999
  });
1995
2000
  complianceRequirement.receiverConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
1996
2001
  const newCondition = {
1997
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_1.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2002
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
1998
2003
  complies: boolToBoolean(result),
1999
2004
  };
2000
2005
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
2001
- if (existingCondition && existingCondition.condition.target === types_1.ConditionTarget.Sender) {
2002
- existingCondition.condition.target = types_1.ConditionTarget.Both;
2006
+ if (existingCondition && existingCondition.condition.target === types_2.ConditionTarget.Sender) {
2007
+ existingCondition.condition.target = types_2.ConditionTarget.Both;
2003
2008
  }
2004
2009
  else {
2005
2010
  conditions.push(newCondition);
@@ -2018,7 +2023,7 @@ exports.complianceRequirementResultToRequirementCompliance = complianceRequireme
2018
2023
  function complianceRequirementToRequirement(complianceRequirement, context) {
2019
2024
  const conditions = [];
2020
2025
  complianceRequirement.senderConditions.forEach(({ conditionType, issuers }) => {
2021
- const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_1.ConditionTarget.Sender });
2026
+ const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Sender });
2022
2027
  if (issuers.length) {
2023
2028
  newCondition.trustedClaimIssuers = issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context));
2024
2029
  }
@@ -2028,13 +2033,13 @@ function complianceRequirementToRequirement(complianceRequirement, context) {
2028
2033
  }
2029
2034
  });
2030
2035
  complianceRequirement.receiverConditions.forEach(({ conditionType, issuers }) => {
2031
- const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_1.ConditionTarget.Receiver });
2036
+ const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Receiver });
2032
2037
  if (issuers.length) {
2033
2038
  newCondition.trustedClaimIssuers = issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context));
2034
2039
  }
2035
2040
  const existingCondition = conditions.find(condition => (0, internal_3.conditionsAreEqual)(condition, newCondition));
2036
- if (existingCondition && existingCondition.target === types_1.ConditionTarget.Sender) {
2037
- existingCondition.target = types_1.ConditionTarget.Both;
2041
+ if (existingCondition && existingCondition.target === types_2.ConditionTarget.Sender) {
2042
+ existingCondition.target = types_2.ConditionTarget.Both;
2038
2043
  }
2039
2044
  else {
2040
2045
  conditions.push(newCondition);
@@ -2051,25 +2056,25 @@ exports.complianceRequirementToRequirement = complianceRequirementToRequirement;
2051
2056
  */
2052
2057
  function txTagToProtocolOp(tag, context) {
2053
2058
  const protocolOpTags = [
2054
- types_1.TxTags.asset.RegisterTicker,
2055
- types_1.TxTags.asset.Issue,
2056
- types_1.TxTags.asset.AddDocuments,
2057
- types_1.TxTags.asset.CreateAsset,
2058
- types_1.TxTags.capitalDistribution.Distribute,
2059
- types_1.TxTags.checkpoint.CreateSchedule,
2060
- types_1.TxTags.complianceManager.AddComplianceRequirement,
2061
- types_1.TxTags.identity.CddRegisterDid,
2062
- types_1.TxTags.identity.AddClaim,
2063
- types_1.TxTags.identity.AddSecondaryKeysWithAuthorization,
2064
- types_1.TxTags.pips.Propose,
2065
- types_1.TxTags.corporateBallot.AttachBallot,
2066
- types_1.TxTags.capitalDistribution.Distribute,
2059
+ types_2.TxTags.asset.RegisterTicker,
2060
+ types_2.TxTags.asset.Issue,
2061
+ types_2.TxTags.asset.AddDocuments,
2062
+ types_2.TxTags.asset.CreateAsset,
2063
+ types_2.TxTags.capitalDistribution.Distribute,
2064
+ types_2.TxTags.checkpoint.CreateSchedule,
2065
+ types_2.TxTags.complianceManager.AddComplianceRequirement,
2066
+ types_2.TxTags.identity.CddRegisterDid,
2067
+ types_2.TxTags.identity.AddClaim,
2068
+ types_2.TxTags.identity.AddSecondaryKeysWithAuthorization,
2069
+ types_2.TxTags.pips.Propose,
2070
+ types_2.TxTags.corporateBallot.AttachBallot,
2071
+ types_2.TxTags.capitalDistribution.Distribute,
2067
2072
  ];
2068
2073
  const [moduleName, extrinsicName] = tag.split('.');
2069
2074
  const value = `${(0, util_1.stringUpperFirst)(moduleName)}${(0, util_1.stringUpperFirst)(extrinsicName)}`;
2070
2075
  if (!(0, lodash_1.includes)(protocolOpTags, tag)) {
2071
2076
  throw new internal_1.PolymeshError({
2072
- code: types_1.ErrorCode.ValidationError,
2077
+ code: types_2.ErrorCode.ValidationError,
2073
2078
  message: `${value} does not match any PolymeshCommonUtilitiesProtocolFeeProtocolOp`,
2074
2079
  });
2075
2080
  }
@@ -2082,7 +2087,7 @@ exports.txTagToProtocolOp = txTagToProtocolOp;
2082
2087
  function extrinsicIdentifierToTxTag(extrinsicIdentifier) {
2083
2088
  const { moduleId, callId } = extrinsicIdentifier;
2084
2089
  let moduleName;
2085
- for (const txTagItem in types_1.TxTags) {
2090
+ for (const txTagItem in types_2.TxTags) {
2086
2091
  if (txTagItem.toLowerCase() === moduleId) {
2087
2092
  moduleName = txTagItem;
2088
2093
  }
@@ -2181,15 +2186,15 @@ exports.secondaryAccountToMeshSecondaryKey = secondaryAccountToMeshSecondaryKey;
2181
2186
  */
2182
2187
  function meshVenueTypeToVenueType(type) {
2183
2188
  if (type.isOther) {
2184
- return types_1.VenueType.Other;
2189
+ return types_2.VenueType.Other;
2185
2190
  }
2186
2191
  if (type.isDistribution) {
2187
- return types_1.VenueType.Distribution;
2192
+ return types_2.VenueType.Distribution;
2188
2193
  }
2189
2194
  if (type.isSto) {
2190
- return types_1.VenueType.Sto;
2195
+ return types_2.VenueType.Sto;
2191
2196
  }
2192
- return types_1.VenueType.Exchange;
2197
+ return types_2.VenueType.Exchange;
2193
2198
  }
2194
2199
  exports.meshVenueTypeToVenueType = meshVenueTypeToVenueType;
2195
2200
  /**
@@ -2223,12 +2228,12 @@ exports.meshInstructionStatusToInstructionStatus = meshInstructionStatusToInstru
2223
2228
  */
2224
2229
  function meshAffirmationStatusToAffirmationStatus(status) {
2225
2230
  if (status.isUnknown) {
2226
- return types_1.AffirmationStatus.Unknown;
2231
+ return types_2.AffirmationStatus.Unknown;
2227
2232
  }
2228
2233
  if (status.isPending) {
2229
- return types_1.AffirmationStatus.Pending;
2234
+ return types_2.AffirmationStatus.Pending;
2230
2235
  }
2231
- return types_1.AffirmationStatus.Affirmed;
2236
+ return types_2.AffirmationStatus.Affirmed;
2232
2237
  }
2233
2238
  exports.meshAffirmationStatusToAffirmationStatus = meshAffirmationStatusToAffirmationStatus;
2234
2239
  /**
@@ -2236,15 +2241,15 @@ exports.meshAffirmationStatusToAffirmationStatus = meshAffirmationStatusToAffirm
2236
2241
  */
2237
2242
  function meshSettlementTypeToEndCondition(type) {
2238
2243
  if (type.isSettleOnBlock) {
2239
- return { type: types_1.InstructionType.SettleOnBlock, endBlock: u32ToBigNumber(type.asSettleOnBlock) };
2244
+ return { type: types_2.InstructionType.SettleOnBlock, endBlock: u32ToBigNumber(type.asSettleOnBlock) };
2240
2245
  }
2241
2246
  if (type.isSettleManual) {
2242
2247
  return {
2243
- type: types_1.InstructionType.SettleManual,
2248
+ type: types_2.InstructionType.SettleManual,
2244
2249
  endAfterBlock: u32ToBigNumber(type.asSettleManual),
2245
2250
  };
2246
2251
  }
2247
- return { type: types_1.InstructionType.SettleOnAffirmation };
2252
+ return { type: types_2.InstructionType.SettleOnAffirmation };
2248
2253
  }
2249
2254
  exports.meshSettlementTypeToEndCondition = meshSettlementTypeToEndCondition;
2250
2255
  /**
@@ -2254,16 +2259,16 @@ function endConditionToSettlementType(endCondition, context) {
2254
2259
  let value;
2255
2260
  const { type } = endCondition;
2256
2261
  switch (type) {
2257
- case types_1.InstructionType.SettleOnBlock:
2258
- value = { [types_1.InstructionType.SettleOnBlock]: bigNumberToU32(endCondition.endBlock, context) };
2262
+ case types_2.InstructionType.SettleOnBlock:
2263
+ value = { [types_2.InstructionType.SettleOnBlock]: bigNumberToU32(endCondition.endBlock, context) };
2259
2264
  break;
2260
- case types_1.InstructionType.SettleManual:
2265
+ case types_2.InstructionType.SettleManual:
2261
2266
  value = {
2262
- [types_1.InstructionType.SettleManual]: bigNumberToU32(endCondition.endAfterBlock, context),
2267
+ [types_2.InstructionType.SettleManual]: bigNumberToU32(endCondition.endAfterBlock, context),
2263
2268
  };
2264
2269
  break;
2265
2270
  default:
2266
- value = types_1.InstructionType.SettleOnAffirmation;
2271
+ value = types_2.InstructionType.SettleOnAffirmation;
2267
2272
  }
2268
2273
  return context.createType('PolymeshPrimitivesSettlementSettlementType', value);
2269
2274
  }
@@ -2272,14 +2277,14 @@ exports.endConditionToSettlementType = endConditionToSettlementType;
2272
2277
  * @hidden
2273
2278
  */
2274
2279
  function middlewareClaimToClaimData(claim, context) {
2275
- const { targetId, issuerId, issuanceDate, lastUpdateDate, expiry, type, jurisdiction, scope, cddId, } = claim;
2280
+ const { targetId, issuerId, issuanceDate, lastUpdateDate, expiry, type, jurisdiction, scope, cddId, customClaimTypeId, } = claim;
2276
2281
  return {
2277
2282
  target: new internal_1.Identity({ did: targetId }, context),
2278
2283
  issuer: new internal_1.Identity({ did: issuerId }, context),
2279
2284
  issuedAt: new Date(parseFloat(issuanceDate)),
2280
2285
  lastUpdatedAt: new Date(parseFloat(lastUpdateDate)),
2281
2286
  expiry: expiry ? new Date(parseFloat(expiry)) : null,
2282
- claim: (0, internal_3.createClaim)(type, jurisdiction, scope, cddId),
2287
+ claim: (0, internal_3.createClaim)(type, jurisdiction, scope, cddId, customClaimTypeId ? new bignumber_js_1.default(customClaimTypeId) : undefined),
2283
2288
  };
2284
2289
  }
2285
2290
  exports.middlewareClaimToClaimData = middlewareClaimToClaimData;
@@ -2297,7 +2302,17 @@ exports.toIdentityWithClaimsArray = toIdentityWithClaimsArray;
2297
2302
  /**
2298
2303
  * @hidden
2299
2304
  */
2300
- function portfolioMovementToPortfolioFund(portfolioItem, context) {
2305
+ function nftToMeshNft(ticker, nfts, context) {
2306
+ return context.createType('PolymeshPrimitivesNftNfTs', {
2307
+ ticker: stringToTicker(ticker, context),
2308
+ ids: nfts.map(id => bigNumberToU64((0, internal_3.asNftId)(id), context)),
2309
+ });
2310
+ }
2311
+ exports.nftToMeshNft = nftToMeshNft;
2312
+ /**
2313
+ * @hidden
2314
+ */
2315
+ function fungibleMovementToPortfolioFund(portfolioItem, context) {
2301
2316
  const { asset, amount, memo } = portfolioItem;
2302
2317
  return context.createType('PolymeshPrimitivesPortfolioFund', {
2303
2318
  description: {
@@ -2309,7 +2324,23 @@ function portfolioMovementToPortfolioFund(portfolioItem, context) {
2309
2324
  memo: (0, internal_3.optionize)(stringToMemo)(memo, context),
2310
2325
  });
2311
2326
  }
2312
- exports.portfolioMovementToPortfolioFund = portfolioMovementToPortfolioFund;
2327
+ exports.fungibleMovementToPortfolioFund = fungibleMovementToPortfolioFund;
2328
+ /**
2329
+ * @hidden
2330
+ */
2331
+ function nftMovementToPortfolioFund(portfolioItem, context) {
2332
+ const { asset, nfts, memo } = portfolioItem;
2333
+ return context.createType('PolymeshPrimitivesPortfolioFund', {
2334
+ description: {
2335
+ NonFungible: {
2336
+ ticker: stringToTicker((0, internal_3.asTicker)(asset), context),
2337
+ ids: nfts.map(nftId => bigNumberToU64((0, internal_3.asNftId)(nftId), context)),
2338
+ },
2339
+ },
2340
+ memo: (0, internal_3.optionize)(stringToMemo)(memo, context),
2341
+ });
2342
+ }
2343
+ exports.nftMovementToPortfolioFund = nftMovementToPortfolioFund;
2313
2344
  /**
2314
2345
  * @hidden
2315
2346
  */
@@ -2334,30 +2365,30 @@ function transferRestrictionToPolymeshTransferCondition(restriction, context) {
2334
2365
  let restrictionType;
2335
2366
  let restrictionValue;
2336
2367
  const extractClaimValue = (claim) => {
2337
- if (claim.type === types_1.ClaimType.Accredited) {
2368
+ if (claim.type === types_2.ClaimType.Accredited) {
2338
2369
  return booleanToBool(claim.accredited, context);
2339
2370
  }
2340
- else if (claim.type === types_1.ClaimType.Affiliate) {
2371
+ else if (claim.type === types_2.ClaimType.Affiliate) {
2341
2372
  return booleanToBool(claim.affiliate, context);
2342
2373
  }
2343
2374
  else {
2344
2375
  return (0, internal_3.optionize)(utils_2.countryCodeToMeshCountryCode)(claim.countryCode, context);
2345
2376
  }
2346
2377
  };
2347
- if (type === types_1.TransferRestrictionType.Count) {
2378
+ if (type === types_2.TransferRestrictionType.Count) {
2348
2379
  restrictionType = 'MaxInvestorCount';
2349
2380
  restrictionValue = bigNumberToU64(value, context);
2350
2381
  }
2351
- else if (type === types_1.TransferRestrictionType.Percentage) {
2382
+ else if (type === types_2.TransferRestrictionType.Percentage) {
2352
2383
  restrictionType = 'MaxInvestorOwnership';
2353
2384
  restrictionValue = percentageToPermill(value, context);
2354
2385
  }
2355
- else if (type === types_1.TransferRestrictionType.ClaimCount ||
2356
- type === types_1.TransferRestrictionType.ClaimPercentage) {
2386
+ else if (type === types_2.TransferRestrictionType.ClaimCount ||
2387
+ type === types_2.TransferRestrictionType.ClaimPercentage) {
2357
2388
  let rawMin;
2358
2389
  let rawMax;
2359
2390
  const { min, max, claim, issuer } = value;
2360
- if (type === types_1.TransferRestrictionType.ClaimCount) {
2391
+ if (type === types_2.TransferRestrictionType.ClaimCount) {
2361
2392
  restrictionType = 'ClaimCount';
2362
2393
  rawMin = bigNumberToU64(min, context);
2363
2394
  rawMax = (0, internal_3.optionize)(bigNumberToU64)(max, context);
@@ -2377,7 +2408,7 @@ function transferRestrictionToPolymeshTransferCondition(restriction, context) {
2377
2408
  }
2378
2409
  else {
2379
2410
  throw new internal_1.PolymeshError({
2380
- code: types_1.ErrorCode.UnexpectedError,
2411
+ code: types_2.ErrorCode.UnexpectedError,
2381
2412
  message: `Unexpected transfer restriction type: "${type}". Please report this to the Polymesh team`,
2382
2413
  });
2383
2414
  }
@@ -2400,31 +2431,31 @@ exports.identitiesToBtreeSet = identitiesToBtreeSet;
2400
2431
  function transferConditionToTransferRestriction(transferCondition, context) {
2401
2432
  if (transferCondition.isMaxInvestorCount) {
2402
2433
  return {
2403
- type: types_1.TransferRestrictionType.Count,
2434
+ type: types_2.TransferRestrictionType.Count,
2404
2435
  value: u64ToBigNumber(transferCondition.asMaxInvestorCount),
2405
2436
  };
2406
2437
  }
2407
2438
  else if (transferCondition.isMaxInvestorOwnership) {
2408
2439
  return {
2409
- type: types_1.TransferRestrictionType.Percentage,
2440
+ type: types_2.TransferRestrictionType.Percentage,
2410
2441
  value: permillToBigNumber(transferCondition.asMaxInvestorOwnership),
2411
2442
  };
2412
2443
  }
2413
2444
  else if (transferCondition.isClaimCount) {
2414
2445
  return {
2415
- type: types_1.TransferRestrictionType.ClaimCount,
2446
+ type: types_2.TransferRestrictionType.ClaimCount,
2416
2447
  value: claimCountToClaimCountRestrictionValue(transferCondition.asClaimCount, context),
2417
2448
  };
2418
2449
  }
2419
2450
  else if (transferCondition.isClaimOwnership) {
2420
2451
  return {
2421
- type: types_1.TransferRestrictionType.ClaimPercentage,
2452
+ type: types_2.TransferRestrictionType.ClaimPercentage,
2422
2453
  value: claimPercentageToClaimPercentageRestrictionValue(transferCondition.asClaimOwnership, context),
2423
2454
  };
2424
2455
  }
2425
2456
  else {
2426
2457
  throw new internal_1.PolymeshError({
2427
- code: types_1.ErrorCode.FatalError,
2458
+ code: types_2.ErrorCode.FatalError,
2428
2459
  message: 'Unexpected transfer condition type',
2429
2460
  });
2430
2461
  }
@@ -2433,38 +2464,64 @@ exports.transferConditionToTransferRestriction = transferConditionToTransferRest
2433
2464
  /**
2434
2465
  * @hidden
2435
2466
  */
2436
- function granularCanTransferResultToTransferBreakdown(result, context) {
2467
+ function nftDispatchErrorToTransferError(error, context) {
2468
+ const { DuplicatedNFTId: duplicateErr, InvalidNFTTransferComplianceFailure: complianceErr, InvalidNFTTransferFrozenAsset: frozenErr, InvalidNFTTransferInsufficientCount: insufficientErr, NFTNotFound: notFoundErr, InvalidNFTTransferNFTNotOwned: notOwnedErr, InvalidNFTTransferSamePortfolio: samePortfolioErr, } = context.polymeshApi.errors.nft;
2469
+ if (error.isModule) {
2470
+ const moduleErr = error.asModule;
2471
+ if ([notOwnedErr, notFoundErr, insufficientErr, duplicateErr].some(err => err.is(moduleErr))) {
2472
+ return types_2.TransferError.InsufficientPortfolioBalance;
2473
+ }
2474
+ else if (frozenErr.is(moduleErr)) {
2475
+ return types_2.TransferError.TransfersFrozen;
2476
+ }
2477
+ else if (complianceErr.is(moduleErr)) {
2478
+ return types_2.TransferError.ComplianceFailure;
2479
+ }
2480
+ else if (samePortfolioErr.is(moduleErr)) {
2481
+ return types_2.TransferError.SelfTransfer;
2482
+ }
2483
+ }
2484
+ throw new internal_1.PolymeshError({
2485
+ code: types_2.ErrorCode.UnexpectedError,
2486
+ message: 'Received unknown NFT can transfer status',
2487
+ });
2488
+ }
2489
+ exports.nftDispatchErrorToTransferError = nftDispatchErrorToTransferError;
2490
+ /**
2491
+ * @hidden
2492
+ */
2493
+ function granularCanTransferResultToTransferBreakdown(result, validateNftResult, context) {
2437
2494
  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;
2438
2495
  const general = [];
2439
2496
  if (boolToBoolean(invalidGranularity)) {
2440
- general.push(types_1.TransferError.InvalidGranularity);
2497
+ general.push(types_2.TransferError.InvalidGranularity);
2441
2498
  }
2442
2499
  if (boolToBoolean(selfTransfer)) {
2443
- general.push(types_1.TransferError.SelfTransfer);
2500
+ general.push(types_2.TransferError.SelfTransfer);
2444
2501
  }
2445
2502
  if (boolToBoolean(invalidReceiverCdd)) {
2446
- general.push(types_1.TransferError.InvalidReceiverCdd);
2503
+ general.push(types_2.TransferError.InvalidReceiverCdd);
2447
2504
  }
2448
2505
  if (boolToBoolean(invalidSenderCdd)) {
2449
- general.push(types_1.TransferError.InvalidSenderCdd);
2506
+ general.push(types_2.TransferError.InvalidSenderCdd);
2450
2507
  }
2451
2508
  if (boolToBoolean(missingScopeClaim)) {
2452
- general.push(types_1.TransferError.ScopeClaimMissing);
2509
+ general.push(types_2.TransferError.ScopeClaimMissing);
2453
2510
  }
2454
2511
  if (boolToBoolean(insufficientBalance)) {
2455
- general.push(types_1.TransferError.InsufficientBalance);
2512
+ general.push(types_2.TransferError.InsufficientBalance);
2456
2513
  }
2457
2514
  if (boolToBoolean(assetFrozen)) {
2458
- general.push(types_1.TransferError.TransfersFrozen);
2515
+ general.push(types_2.TransferError.TransfersFrozen);
2459
2516
  }
2460
2517
  if (boolToBoolean(senderPortfolioNotExists)) {
2461
- general.push(types_1.TransferError.InvalidSenderPortfolio);
2518
+ general.push(types_2.TransferError.InvalidSenderPortfolio);
2462
2519
  }
2463
2520
  if (boolToBoolean(receiverPortfolioNotExists)) {
2464
- general.push(types_1.TransferError.InvalidReceiverPortfolio);
2521
+ general.push(types_2.TransferError.InvalidReceiverPortfolio);
2465
2522
  }
2466
2523
  if (boolToBoolean(senderInsufficientBalance)) {
2467
- general.push(types_1.TransferError.InsufficientPortfolioBalance);
2524
+ general.push(types_2.TransferError.InsufficientPortfolioBalance);
2468
2525
  }
2469
2526
  const restrictions = transferConditionResult.map(({ condition, result: tmResult }) => {
2470
2527
  return {
@@ -2472,14 +2529,23 @@ function granularCanTransferResultToTransferBreakdown(result, context) {
2472
2529
  result: boolToBoolean(tmResult),
2473
2530
  };
2474
2531
  });
2532
+ let canTransfer = boolToBoolean(finalResult);
2533
+ if (canTransfer && (validateNftResult === null || validateNftResult === void 0 ? void 0 : validateNftResult.isErr)) {
2534
+ const transferError = nftDispatchErrorToTransferError(validateNftResult.asErr, context);
2535
+ general.push(transferError);
2536
+ canTransfer = false;
2537
+ }
2475
2538
  return {
2476
2539
  general,
2477
2540
  compliance: assetComplianceResultToCompliance(complianceResult, context),
2478
2541
  restrictions,
2479
- result: boolToBoolean(finalResult),
2542
+ result: canTransfer,
2480
2543
  };
2481
2544
  }
2482
2545
  exports.granularCanTransferResultToTransferBreakdown = granularCanTransferResultToTransferBreakdown;
2546
+ /**
2547
+ * @hidden
2548
+ */
2483
2549
  /**
2484
2550
  * @hidden
2485
2551
  */
@@ -2497,16 +2563,16 @@ exports.offeringTierToPriceTier = offeringTierToPriceTier;
2497
2563
  function permissionsLikeToPermissions(permissionsLike, context) {
2498
2564
  let assetPermissions = {
2499
2565
  values: [],
2500
- type: types_1.PermissionType.Include,
2566
+ type: types_2.PermissionType.Include,
2501
2567
  };
2502
2568
  let transactionPermissions = {
2503
2569
  values: [],
2504
- type: types_1.PermissionType.Include,
2570
+ type: types_2.PermissionType.Include,
2505
2571
  };
2506
2572
  let transactionGroupPermissions = [];
2507
2573
  let portfolioPermissions = {
2508
2574
  values: [],
2509
- type: types_1.PermissionType.Include,
2575
+ type: types_2.PermissionType.Include,
2510
2576
  };
2511
2577
  let transactions;
2512
2578
  let transactionGroups;
@@ -2591,29 +2657,29 @@ function fundraiserToOfferingDetails(fundraiser, name, context) {
2591
2657
  const isStarted = now > start;
2592
2658
  const isExpired = end && now > end;
2593
2659
  const minInvestment = balanceToBigNumber(rawMinInvestment);
2594
- let timing = types_1.OfferingTimingStatus.NotStarted;
2595
- let balance = types_1.OfferingBalanceStatus.Available;
2596
- let sale = types_1.OfferingSaleStatus.Live;
2660
+ let timing = types_2.OfferingTimingStatus.NotStarted;
2661
+ let balance = types_2.OfferingBalanceStatus.Available;
2662
+ let sale = types_2.OfferingSaleStatus.Live;
2597
2663
  if (isExpired) {
2598
- timing = types_1.OfferingTimingStatus.Expired;
2664
+ timing = types_2.OfferingTimingStatus.Expired;
2599
2665
  }
2600
2666
  else if (isStarted) {
2601
- timing = types_1.OfferingTimingStatus.Started;
2667
+ timing = types_2.OfferingTimingStatus.Started;
2602
2668
  }
2603
2669
  if (totalRemainingValue.isZero()) {
2604
- balance = types_1.OfferingBalanceStatus.SoldOut;
2670
+ balance = types_2.OfferingBalanceStatus.SoldOut;
2605
2671
  }
2606
2672
  else if (totalRemainingValue.lt(minInvestment)) {
2607
- balance = types_1.OfferingBalanceStatus.Residual;
2673
+ balance = types_2.OfferingBalanceStatus.Residual;
2608
2674
  }
2609
2675
  if (rawStatus.isClosedEarly) {
2610
- sale = types_1.OfferingSaleStatus.ClosedEarly;
2676
+ sale = types_2.OfferingSaleStatus.ClosedEarly;
2611
2677
  }
2612
2678
  else if (rawStatus.isClosed) {
2613
- sale = types_1.OfferingSaleStatus.Closed;
2679
+ sale = types_2.OfferingSaleStatus.Closed;
2614
2680
  }
2615
2681
  else if (rawStatus.isFrozen) {
2616
- sale = types_1.OfferingSaleStatus.Frozen;
2682
+ sale = types_2.OfferingSaleStatus.Frozen;
2617
2683
  }
2618
2684
  return {
2619
2685
  creator: new internal_1.Identity({ did: identityIdToString(creator) }, context),
@@ -2643,23 +2709,23 @@ function meshCorporateActionToCorporateActionParams(corporateAction, details, co
2643
2709
  const { kind: rawKind, declDate, targets: { identities, treatment }, defaultWithholdingTax, withholdingTax, } = corporateAction;
2644
2710
  let kind;
2645
2711
  if (rawKind.isIssuerNotice) {
2646
- kind = types_1.CorporateActionKind.IssuerNotice;
2712
+ kind = types_2.CorporateActionKind.IssuerNotice;
2647
2713
  }
2648
2714
  else if (rawKind.isPredictableBenefit) {
2649
- kind = types_1.CorporateActionKind.PredictableBenefit;
2715
+ kind = types_2.CorporateActionKind.PredictableBenefit;
2650
2716
  }
2651
2717
  else if (rawKind.isUnpredictableBenefit) {
2652
- kind = types_1.CorporateActionKind.UnpredictableBenefit;
2718
+ kind = types_2.CorporateActionKind.UnpredictableBenefit;
2653
2719
  }
2654
2720
  else if (rawKind.isReorganization) {
2655
- kind = types_1.CorporateActionKind.Reorganization;
2721
+ kind = types_2.CorporateActionKind.Reorganization;
2656
2722
  }
2657
2723
  else {
2658
- kind = types_1.CorporateActionKind.Other;
2724
+ kind = types_2.CorporateActionKind.Other;
2659
2725
  }
2660
2726
  const targets = {
2661
2727
  identities: identities.map(identityId => new internal_1.Identity({ did: identityIdToString(identityId) }, context)),
2662
- treatment: treatment.isExclude ? types_1.TargetTreatment.Exclude : types_1.TargetTreatment.Include,
2728
+ treatment: treatment.isExclude ? types_2.TargetTreatment.Exclude : types_2.TargetTreatment.Include,
2663
2729
  };
2664
2730
  const taxWithholdings = withholdingTax.map(([identityId, tax]) => ({
2665
2731
  identity: new internal_1.Identity({ did: identityIdToString(identityId) }, context),
@@ -2708,7 +2774,7 @@ function targetIdentitiesToCorporateActionTargets(targetIdentities, context) {
2708
2774
  const { identities, treatment } = targetIdentities;
2709
2775
  return {
2710
2776
  identities: identities.map(identity => new internal_1.Identity({ did: identityIdToString(identity) }, context)),
2711
- treatment: treatment.isInclude ? types_1.TargetTreatment.Include : types_1.TargetTreatment.Exclude,
2777
+ treatment: treatment.isInclude ? types_2.TargetTreatment.Include : types_2.TargetTreatment.Exclude,
2712
2778
  };
2713
2779
  }
2714
2780
  exports.targetIdentitiesToCorporateActionTargets = targetIdentitiesToCorporateActionTargets;
@@ -2721,7 +2787,7 @@ function targetsToTargetIdentities(targets, context) {
2721
2787
  const maxTargets = u32ToBigNumber(maxTargetIds);
2722
2788
  if (maxTargets.lt(targets.identities.length)) {
2723
2789
  throw new internal_1.PolymeshError({
2724
- code: types_1.ErrorCode.ValidationError,
2790
+ code: types_2.ErrorCode.ValidationError,
2725
2791
  message: 'Too many target Identities',
2726
2792
  data: {
2727
2793
  maxTargets,
@@ -2861,17 +2927,17 @@ function meshStatToStatType(rawStat) {
2861
2927
  const { op: { type }, claimIssuer, } = rawStat;
2862
2928
  if (claimIssuer.isNone) {
2863
2929
  if (type === 'Count') {
2864
- return types_1.StatType.Count;
2930
+ return types_2.StatType.Count;
2865
2931
  }
2866
2932
  else {
2867
- return types_1.StatType.Balance;
2933
+ return types_2.StatType.Balance;
2868
2934
  }
2869
2935
  }
2870
2936
  if (type === 'Count') {
2871
- return types_1.StatType.ScopedCount;
2937
+ return types_2.StatType.ScopedCount;
2872
2938
  }
2873
2939
  else {
2874
- return types_1.StatType.ScopedBalance;
2940
+ return types_2.StatType.ScopedBalance;
2875
2941
  }
2876
2942
  }
2877
2943
  exports.meshStatToStatType = meshStatToStatType;
@@ -2879,20 +2945,20 @@ exports.meshStatToStatType = meshStatToStatType;
2879
2945
  * @hidden
2880
2946
  */
2881
2947
  function statTypeToStatOpType(type, context) {
2882
- if (type === types_1.StatType.Count || type === types_1.StatType.ScopedCount) {
2883
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_1.StatType.Count);
2948
+ if (type === types_2.StatType.Count || type === types_2.StatType.ScopedCount) {
2949
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Count);
2884
2950
  }
2885
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_1.StatType.Balance);
2951
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Balance);
2886
2952
  }
2887
2953
  exports.statTypeToStatOpType = statTypeToStatOpType;
2888
2954
  /**
2889
2955
  * @hidden
2890
2956
  */
2891
2957
  function transferRestrictionTypeToStatOpType(type, context) {
2892
- if (type === types_1.TransferRestrictionType.Count || type === types_1.TransferRestrictionType.ClaimCount) {
2893
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_1.StatType.Count);
2958
+ if (type === types_2.TransferRestrictionType.Count || type === types_2.TransferRestrictionType.ClaimCount) {
2959
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Count);
2894
2960
  }
2895
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_1.StatType.Balance);
2961
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Balance);
2896
2962
  }
2897
2963
  exports.transferRestrictionTypeToStatOpType = transferRestrictionTypeToStatOpType;
2898
2964
  /**
@@ -2967,7 +3033,7 @@ function sortTransferRestrictionByClaimValue(conditions) {
2967
3033
  }
2968
3034
  const aCode = (0, utils_2.meshCountryCodeToCountryCode)(aClaim.unwrap());
2969
3035
  const bCode = (0, utils_2.meshCountryCodeToCountryCode)(bClaim.unwrap());
2970
- const countryOrder = Object.values(types_1.CountryCode);
3036
+ const countryOrder = Object.values(types_2.CountryCode);
2971
3037
  return countryOrder.indexOf(aCode) - countryOrder.indexOf(bCode);
2972
3038
  });
2973
3039
  }
@@ -2993,7 +3059,7 @@ exports.toExemptKey = toExemptKey;
2993
3059
  function claimCountStatInputToStatUpdates(args, context) {
2994
3060
  const { value, claimType: type } = args;
2995
3061
  let updateArgs;
2996
- if (type === types_1.ClaimType.Jurisdiction) {
3062
+ if (type === types_2.ClaimType.Jurisdiction) {
2997
3063
  updateArgs = value.map(({ countryCode, count }) => {
2998
3064
  const rawSecondKey = createStat2ndKey(type, context, countryCode);
2999
3065
  return keyAndValueToStatUpdate(rawSecondKey, bigNumberToU128(count, context), context);
@@ -3001,7 +3067,7 @@ function claimCountStatInputToStatUpdates(args, context) {
3001
3067
  }
3002
3068
  else {
3003
3069
  let yes, no;
3004
- if (type === types_1.ClaimType.Accredited) {
3070
+ if (type === types_2.ClaimType.Accredited) {
3005
3071
  ({ accredited: yes, nonAccredited: no } = value);
3006
3072
  }
3007
3073
  else {
@@ -3037,7 +3103,7 @@ function inputStatTypeToMeshStatType(input, context) {
3037
3103
  const { type } = input;
3038
3104
  const op = statTypeToStatOpType(type, context);
3039
3105
  let claimIssuer;
3040
- if (type === types_1.StatType.ScopedCount || type === types_1.StatType.ScopedBalance) {
3106
+ if (type === types_2.StatType.ScopedCount || type === types_2.StatType.ScopedBalance) {
3041
3107
  claimIssuer = claimIssuerToMeshClaimIssuer(input.claimIssuer, context);
3042
3108
  }
3043
3109
  return statisticsOpTypeToStatType({ op, claimIssuer }, context);
@@ -3051,19 +3117,19 @@ function meshProposalStatusToProposalStatus(status, expiry) {
3051
3117
  switch (type) {
3052
3118
  case 'ActiveOrExpired':
3053
3119
  if (!expiry || expiry > new Date()) {
3054
- return types_1.ProposalStatus.Active;
3120
+ return types_2.ProposalStatus.Active;
3055
3121
  }
3056
3122
  else {
3057
- return types_1.ProposalStatus.Expired;
3123
+ return types_2.ProposalStatus.Expired;
3058
3124
  }
3059
3125
  case 'Invalid':
3060
- return types_1.ProposalStatus.Invalid;
3126
+ return types_2.ProposalStatus.Invalid;
3061
3127
  case 'ExecutionSuccessful':
3062
- return types_1.ProposalStatus.Successful;
3128
+ return types_2.ProposalStatus.Successful;
3063
3129
  case 'ExecutionFailed':
3064
- return types_1.ProposalStatus.Failed;
3130
+ return types_2.ProposalStatus.Failed;
3065
3131
  case 'Rejected':
3066
- return types_1.ProposalStatus.Rejected;
3132
+ return types_2.ProposalStatus.Rejected;
3067
3133
  default:
3068
3134
  throw new utils_1.UnreachableCaseError(type);
3069
3135
  }
@@ -3078,7 +3144,7 @@ function metadataSpecToMeshMetadataSpec(specs, context) {
3078
3144
  const metadataTypeDefMaxLength = u32ToBigNumber(assetMetadataTypeDefMaxLength);
3079
3145
  if (typeDef && metadataTypeDefMaxLength.lt(typeDef.length)) {
3080
3146
  throw new internal_1.PolymeshError({
3081
- code: types_1.ErrorCode.ValidationError,
3147
+ code: types_2.ErrorCode.ValidationError,
3082
3148
  message: '"typeDef" length exceeded for given Asset Metadata spec',
3083
3149
  data: {
3084
3150
  maxLength: metadataTypeDefMaxLength,
@@ -3118,7 +3184,7 @@ exports.meshMetadataSpecToMetadataSpec = meshMetadataSpecToMetadataSpec;
3118
3184
  function metadataToMeshMetadataKey(type, id, context) {
3119
3185
  const rawId = bigNumberToU64(id, context);
3120
3186
  let metadataKey;
3121
- if (type === types_1.MetadataType.Local) {
3187
+ if (type === types_2.MetadataType.Local) {
3122
3188
  metadataKey = { Local: rawId };
3123
3189
  }
3124
3190
  else {
@@ -3136,17 +3202,17 @@ function meshMetadataValueToMetadataValue(rawValue, rawDetails) {
3136
3202
  }
3137
3203
  let metadataValue = {
3138
3204
  value: bytesToString(rawValue.unwrap()),
3139
- lockStatus: types_1.MetadataLockStatus.Unlocked,
3205
+ lockStatus: types_2.MetadataLockStatus.Unlocked,
3140
3206
  expiry: null,
3141
3207
  };
3142
3208
  if (rawDetails.isSome) {
3143
3209
  const { lockStatus: rawLockStatus, expire } = rawDetails.unwrap();
3144
3210
  metadataValue = Object.assign(Object.assign({}, metadataValue), { expiry: (0, internal_3.optionize)(momentToDate)(expire.unwrapOr(null)) });
3145
3211
  if (rawLockStatus.isLocked) {
3146
- metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_1.MetadataLockStatus.Locked });
3212
+ metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_2.MetadataLockStatus.Locked });
3147
3213
  }
3148
3214
  if (rawLockStatus.isLockedUntil) {
3149
- metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_1.MetadataLockStatus.LockedUntil, lockedUntil: momentToDate(rawLockStatus.asLockedUntil) });
3215
+ metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_2.MetadataLockStatus.LockedUntil, lockedUntil: momentToDate(rawLockStatus.asLockedUntil) });
3150
3216
  }
3151
3217
  }
3152
3218
  return metadataValue;
@@ -3160,7 +3226,7 @@ function metadataValueToMeshMetadataValue(value, context) {
3160
3226
  const metadataValueMaxLength = u32ToBigNumber(assetMetadataValueMaxLength);
3161
3227
  if (metadataValueMaxLength.lt(value.length)) {
3162
3228
  throw new internal_1.PolymeshError({
3163
- code: types_1.ErrorCode.ValidationError,
3229
+ code: types_2.ErrorCode.ValidationError,
3164
3230
  message: 'Asset Metadata value length exceeded',
3165
3231
  data: {
3166
3232
  maxLength: metadataValueMaxLength,
@@ -3176,11 +3242,11 @@ exports.metadataValueToMeshMetadataValue = metadataValueToMeshMetadataValue;
3176
3242
  function metadataValueDetailToMeshMetadataValueDetail(details, context) {
3177
3243
  const { lockStatus, expiry } = details;
3178
3244
  let meshLockStatus;
3179
- if (lockStatus === types_1.MetadataLockStatus.LockedUntil) {
3245
+ if (lockStatus === types_2.MetadataLockStatus.LockedUntil) {
3180
3246
  const { lockedUntil } = details;
3181
3247
  if (lockedUntil < new Date()) {
3182
3248
  throw new internal_1.PolymeshError({
3183
- code: types_1.ErrorCode.UnmetPrerequisite,
3249
+ code: types_2.ErrorCode.UnmetPrerequisite,
3184
3250
  message: 'Locked until date must be in the future',
3185
3251
  });
3186
3252
  }
@@ -3191,7 +3257,7 @@ function metadataValueDetailToMeshMetadataValueDetail(details, context) {
3191
3257
  }
3192
3258
  if (expiry && expiry < new Date()) {
3193
3259
  throw new internal_1.PolymeshError({
3194
- code: types_1.ErrorCode.UnmetPrerequisite,
3260
+ code: types_2.ErrorCode.UnmetPrerequisite,
3195
3261
  message: 'Expiry date must be in the future',
3196
3262
  });
3197
3263
  }
@@ -3216,9 +3282,9 @@ function middlewareInstructionToHistoricInstruction(instruction, context) {
3216
3282
  const { id: instructionId, status, settlementType, endBlock, tradeDate, valueDate, legs: { nodes: legs }, memo, createdBlock, venueId, } = instruction;
3217
3283
  const { blockId, hash, datetime } = createdBlock;
3218
3284
  let typeDetails;
3219
- if (settlementType === types_1.InstructionType.SettleOnAffirmation) {
3285
+ if (settlementType === types_2.InstructionType.SettleOnAffirmation) {
3220
3286
  typeDetails = {
3221
- type: types_1.InstructionType.SettleOnAffirmation,
3287
+ type: types_2.InstructionType.SettleOnAffirmation,
3222
3288
  };
3223
3289
  }
3224
3290
  else {
@@ -3244,7 +3310,7 @@ exports.middlewareInstructionToHistoricInstruction = middlewareInstructionToHist
3244
3310
  function expiryToMoment(expiry, context) {
3245
3311
  if (expiry && expiry <= new Date()) {
3246
3312
  throw new internal_1.PolymeshError({
3247
- code: types_1.ErrorCode.UnmetPrerequisite,
3313
+ code: types_2.ErrorCode.UnmetPrerequisite,
3248
3314
  message: 'Expiry date must be in the future',
3249
3315
  });
3250
3316
  }
@@ -3266,10 +3332,17 @@ exports.middlewarePortfolioDataToPortfolio = middlewarePortfolioDataToPortfolio;
3266
3332
  /**
3267
3333
  * @hidden
3268
3334
  */
3269
- function legToSettlementLeg(leg, context) {
3270
- return context.createType('PolymeshPrimitivesSettlementLeg', leg);
3335
+ function legToFungibleLeg(leg, context) {
3336
+ return context.createType('PolymeshPrimitivesSettlementLeg', { Fungible: leg });
3337
+ }
3338
+ exports.legToFungibleLeg = legToFungibleLeg;
3339
+ /**
3340
+ * @hidden
3341
+ */
3342
+ function legToNonFungibleLeg(leg, context) {
3343
+ return context.createType('PolymeshPrimitivesSettlementLeg', { NonFungible: leg });
3271
3344
  }
3272
- exports.legToSettlementLeg = legToSettlementLeg;
3345
+ exports.legToNonFungibleLeg = legToNonFungibleLeg;
3273
3346
  /**
3274
3347
  * @hidden
3275
3348
  */
@@ -3278,16 +3351,16 @@ function middlewareAgentGroupDataToPermissionGroup(agentGroupData, context) {
3278
3351
  const agentGroup = agentGroupData[asset];
3279
3352
  let permissionGroupIdentifier;
3280
3353
  if ('full' in agentGroup) {
3281
- permissionGroupIdentifier = types_1.PermissionGroupType.Full;
3354
+ permissionGroupIdentifier = types_2.PermissionGroupType.Full;
3282
3355
  }
3283
3356
  else if ('exceptMeta' in agentGroup) {
3284
- permissionGroupIdentifier = types_1.PermissionGroupType.ExceptMeta;
3357
+ permissionGroupIdentifier = types_2.PermissionGroupType.ExceptMeta;
3285
3358
  }
3286
3359
  else if ('polymeshV1CAA' in agentGroup) {
3287
- permissionGroupIdentifier = types_1.PermissionGroupType.PolymeshV1Caa;
3360
+ permissionGroupIdentifier = types_2.PermissionGroupType.PolymeshV1Caa;
3288
3361
  }
3289
3362
  else if ('polymeshV1PIA' in agentGroup) {
3290
- permissionGroupIdentifier = types_1.PermissionGroupType.PolymeshV1Pia;
3363
+ permissionGroupIdentifier = types_2.PermissionGroupType.PolymeshV1Pia;
3291
3364
  }
3292
3365
  else {
3293
3366
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -3304,11 +3377,11 @@ function middlewareExtrinsicPermissionsDataToTransactionPermissions(permissions)
3304
3377
  let extrinsicType;
3305
3378
  let pallets;
3306
3379
  if ('these' in permissions) {
3307
- extrinsicType = types_1.PermissionType.Include;
3380
+ extrinsicType = types_2.PermissionType.Include;
3308
3381
  pallets = permissions.these;
3309
3382
  }
3310
3383
  else if ('except' in permissions) {
3311
- extrinsicType = types_1.PermissionType.Exclude;
3384
+ extrinsicType = types_2.PermissionType.Exclude;
3312
3385
  pallets = permissions.except;
3313
3386
  }
3314
3387
  let txValues = [];
@@ -3364,11 +3437,11 @@ function middlewarePermissionsDataToPermissions(permissionsData, context) {
3364
3437
  let assetsType;
3365
3438
  let assetsPermissions;
3366
3439
  if ('these' in asset) {
3367
- assetsType = types_1.PermissionType.Include;
3440
+ assetsType = types_2.PermissionType.Include;
3368
3441
  assetsPermissions = asset.these;
3369
3442
  }
3370
3443
  else if ('except' in asset) {
3371
- assetsType = types_1.PermissionType.Exclude;
3444
+ assetsType = types_2.PermissionType.Exclude;
3372
3445
  assetsPermissions = asset.except;
3373
3446
  }
3374
3447
  if (assetsPermissions) {
@@ -3382,11 +3455,11 @@ function middlewarePermissionsDataToPermissions(permissionsData, context) {
3382
3455
  let portfoliosType;
3383
3456
  let portfolioIds;
3384
3457
  if ('these' in portfolio) {
3385
- portfoliosType = types_1.PermissionType.Include;
3458
+ portfoliosType = types_2.PermissionType.Include;
3386
3459
  portfolioIds = portfolio.these;
3387
3460
  }
3388
3461
  else if ('except' in portfolio) {
3389
- portfoliosType = types_1.PermissionType.Exclude;
3462
+ portfoliosType = types_2.PermissionType.Exclude;
3390
3463
  portfolioIds = portfolio.except;
3391
3464
  }
3392
3465
  if (portfolioIds) {
@@ -3410,41 +3483,41 @@ exports.middlewarePermissionsDataToPermissions = middlewarePermissionsDataToPerm
3410
3483
  */
3411
3484
  function middlewareAuthorizationDataToAuthorization(context, type, data) {
3412
3485
  switch (type) {
3413
- case enums_1.AuthTypeEnum.AttestPrimaryKeyRotation:
3486
+ case types_1.AuthTypeEnum.AttestPrimaryKeyRotation:
3414
3487
  return {
3415
- type: types_1.AuthorizationType.AttestPrimaryKeyRotation,
3488
+ type: types_2.AuthorizationType.AttestPrimaryKeyRotation,
3416
3489
  value: new internal_1.Identity({ did: data }, context),
3417
3490
  };
3418
- case enums_1.AuthTypeEnum.RotatePrimaryKey: {
3491
+ case types_1.AuthTypeEnum.RotatePrimaryKey: {
3419
3492
  return {
3420
- type: types_1.AuthorizationType.RotatePrimaryKey,
3493
+ type: types_2.AuthorizationType.RotatePrimaryKey,
3421
3494
  };
3422
3495
  }
3423
- case enums_1.AuthTypeEnum.RotatePrimaryKeyToSecondary: {
3496
+ case types_1.AuthTypeEnum.RotatePrimaryKeyToSecondary: {
3424
3497
  return {
3425
- type: types_1.AuthorizationType.RotatePrimaryKeyToSecondary,
3498
+ type: types_2.AuthorizationType.RotatePrimaryKeyToSecondary,
3426
3499
  value: middlewarePermissionsDataToPermissions(data, context),
3427
3500
  };
3428
3501
  }
3429
- case enums_1.AuthTypeEnum.JoinIdentity: {
3502
+ case types_1.AuthTypeEnum.JoinIdentity: {
3430
3503
  return {
3431
- type: types_1.AuthorizationType.JoinIdentity,
3504
+ type: types_2.AuthorizationType.JoinIdentity,
3432
3505
  value: middlewarePermissionsDataToPermissions(data, context),
3433
3506
  };
3434
3507
  }
3435
- case enums_1.AuthTypeEnum.AddMultiSigSigner:
3508
+ case types_1.AuthTypeEnum.AddMultiSigSigner:
3436
3509
  return {
3437
- type: types_1.AuthorizationType.AddMultiSigSigner,
3510
+ type: types_2.AuthorizationType.AddMultiSigSigner,
3438
3511
  value: data,
3439
3512
  };
3440
- case enums_1.AuthTypeEnum.AddRelayerPayingKey: {
3513
+ case types_1.AuthTypeEnum.AddRelayerPayingKey: {
3441
3514
  // data is received in the format - {"5Ci94GCJC2JBM8U1PCkpHX6HkscWmucN9XwUrjb7o4TDgVns","5DZp1QYH49MKZhCtDupNaAeHp8xtqetuSzgf2p2cUWoxW3iu","1000000000"}
3442
3515
  const [beneficiary, subsidizer, allowance] = data
3443
3516
  .substring(1, data.length - 1)
3444
3517
  .replace(/"/g, '')
3445
3518
  .split(',');
3446
3519
  return {
3447
- type: types_1.AuthorizationType.AddRelayerPayingKey,
3520
+ type: types_2.AuthorizationType.AddRelayerPayingKey,
3448
3521
  value: {
3449
3522
  beneficiary: new internal_1.Account({ address: beneficiary }, context),
3450
3523
  subsidizer: new internal_1.Account({ address: subsidizer }, context),
@@ -3452,33 +3525,33 @@ function middlewareAuthorizationDataToAuthorization(context, type, data) {
3452
3525
  },
3453
3526
  };
3454
3527
  }
3455
- case enums_1.AuthTypeEnum.BecomeAgent: {
3528
+ case types_1.AuthTypeEnum.BecomeAgent: {
3456
3529
  const becomeAgentData = JSON.parse(data.replace(',', ':'));
3457
3530
  return {
3458
- type: types_1.AuthorizationType.BecomeAgent,
3531
+ type: types_2.AuthorizationType.BecomeAgent,
3459
3532
  value: middlewareAgentGroupDataToPermissionGroup(becomeAgentData, context),
3460
3533
  };
3461
3534
  }
3462
- case enums_1.AuthTypeEnum.TransferTicker:
3535
+ case types_1.AuthTypeEnum.TransferTicker:
3463
3536
  return {
3464
- type: types_1.AuthorizationType.TransferTicker,
3537
+ type: types_2.AuthorizationType.TransferTicker,
3465
3538
  value: (0, exports.coerceHexToString)(data),
3466
3539
  };
3467
- case enums_1.AuthTypeEnum.TransferAssetOwnership: {
3540
+ case types_1.AuthTypeEnum.TransferAssetOwnership: {
3468
3541
  return {
3469
- type: types_1.AuthorizationType.TransferAssetOwnership,
3542
+ type: types_2.AuthorizationType.TransferAssetOwnership,
3470
3543
  value: (0, exports.coerceHexToString)(data),
3471
3544
  };
3472
3545
  }
3473
- case enums_1.AuthTypeEnum.PortfolioCustody: {
3546
+ case types_1.AuthTypeEnum.PortfolioCustody: {
3474
3547
  return {
3475
- type: types_1.AuthorizationType.PortfolioCustody,
3548
+ type: types_2.AuthorizationType.PortfolioCustody,
3476
3549
  value: middlewarePortfolioDataToPortfolio(JSON.parse(data), context),
3477
3550
  };
3478
3551
  }
3479
3552
  }
3480
3553
  throw new internal_1.PolymeshError({
3481
- code: types_1.ErrorCode.UnexpectedError,
3554
+ code: types_2.ErrorCode.UnexpectedError,
3482
3555
  message: 'Unsupported Authorization Type. Please contact the Polymesh team',
3483
3556
  data: {
3484
3557
  auth: data,
@@ -3502,10 +3575,10 @@ exports.collectionKeysToMetadataKeys = collectionKeysToMetadataKeys;
3502
3575
  */
3503
3576
  function meshMetadataKeyToMetadataKey(rawKey, ticker) {
3504
3577
  if (rawKey.isGlobal) {
3505
- return { type: types_1.MetadataType.Global, id: u64ToBigNumber(rawKey.asGlobal) };
3578
+ return { type: types_2.MetadataType.Global, id: u64ToBigNumber(rawKey.asGlobal) };
3506
3579
  }
3507
3580
  else {
3508
- return { type: types_1.MetadataType.Local, id: u64ToBigNumber(rawKey.asLocal), ticker };
3581
+ return { type: types_2.MetadataType.Local, id: u64ToBigNumber(rawKey.asLocal), ticker };
3509
3582
  }
3510
3583
  }
3511
3584
  exports.meshMetadataKeyToMetadataKey = meshMetadataKeyToMetadataKey;