@polymeshassociation/polymesh-sdk 27.5.0 → 27.6.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 (96) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/api/entities/Asset/Fungible/CorporateActions/Ballots.d.ts +30 -0
  3. package/api/entities/Asset/Fungible/CorporateActions/Ballots.d.ts.map +1 -0
  4. package/api/entities/Asset/Fungible/CorporateActions/Ballots.js +80 -0
  5. package/api/entities/Asset/Fungible/CorporateActions/Ballots.js.map +1 -0
  6. package/api/entities/Asset/Fungible/CorporateActions/index.d.ts +5 -2
  7. package/api/entities/Asset/Fungible/CorporateActions/index.d.ts.map +1 -1
  8. package/api/entities/Asset/Fungible/CorporateActions/index.js +4 -0
  9. package/api/entities/Asset/Fungible/CorporateActions/index.js.map +1 -1
  10. package/api/entities/CorporateBallot/index.d.ts +84 -0
  11. package/api/entities/CorporateBallot/index.d.ts.map +1 -0
  12. package/api/entities/CorporateBallot/index.js +190 -0
  13. package/api/entities/CorporateBallot/index.js.map +1 -0
  14. package/api/entities/CorporateBallot/types.d.ts +119 -0
  15. package/api/entities/CorporateBallot/types.d.ts.map +1 -0
  16. package/api/entities/CorporateBallot/types.js +10 -0
  17. package/api/entities/CorporateBallot/types.js.map +1 -0
  18. package/api/entities/types.d.ts +6 -1
  19. package/api/entities/types.d.ts.map +1 -1
  20. package/api/entities/types.js.map +1 -1
  21. package/api/procedures/castBallotVote.d.ts +46 -0
  22. package/api/procedures/castBallotVote.d.ts.map +1 -0
  23. package/api/procedures/castBallotVote.js +151 -0
  24. package/api/procedures/castBallotVote.js.map +1 -0
  25. package/api/procedures/createBallot.d.ts +33 -0
  26. package/api/procedures/createBallot.d.ts.map +1 -0
  27. package/api/procedures/createBallot.js +92 -0
  28. package/api/procedures/createBallot.js.map +1 -0
  29. package/api/procedures/initiateCorporateAction.d.ts +31 -0
  30. package/api/procedures/initiateCorporateAction.d.ts.map +1 -0
  31. package/api/procedures/initiateCorporateAction.js +137 -0
  32. package/api/procedures/initiateCorporateAction.js.map +1 -0
  33. package/api/procedures/modifyBallot.d.ts +40 -0
  34. package/api/procedures/modifyBallot.d.ts.map +1 -0
  35. package/api/procedures/modifyBallot.js +157 -0
  36. package/api/procedures/modifyBallot.js.map +1 -0
  37. package/api/procedures/modifyCaCheckpoint.d.ts.map +1 -1
  38. package/api/procedures/modifyCaCheckpoint.js +16 -1
  39. package/api/procedures/modifyCaCheckpoint.js.map +1 -1
  40. package/api/procedures/removeBallot.d.ts +23 -0
  41. package/api/procedures/removeBallot.d.ts.map +1 -0
  42. package/api/procedures/removeBallot.js +53 -0
  43. package/api/procedures/removeBallot.js.map +1 -0
  44. package/api/procedures/types.d.ts +79 -2
  45. package/api/procedures/types.d.ts.map +1 -1
  46. package/api/procedures/types.js.map +1 -1
  47. package/api/procedures/utils.d.ts +4 -6
  48. package/api/procedures/utils.d.ts.map +1 -1
  49. package/api/procedures/utils.js +43 -19
  50. package/api/procedures/utils.js.map +1 -1
  51. package/generated/types.d.ts +11 -4
  52. package/generated/types.d.ts.map +1 -1
  53. package/generated/types.js +9 -1
  54. package/generated/types.js.map +1 -1
  55. package/internal.d.ts +1 -0
  56. package/internal.d.ts.map +1 -1
  57. package/internal.js +3 -1
  58. package/internal.js.map +1 -1
  59. package/npm-package/polymeshassociation-polymesh-sdk-27.6.0-beta.1.tgz +0 -0
  60. package/package.json +9 -5
  61. package/polkadot/augment-api-consts.d.ts +85 -1
  62. package/polkadot/augment-api-consts.d.ts.map +1 -1
  63. package/polkadot/augment-api-errors.d.ts +44 -12
  64. package/polkadot/augment-api-errors.d.ts.map +1 -1
  65. package/polkadot/augment-api-events.d.ts +179 -51
  66. package/polkadot/augment-api-events.d.ts.map +1 -1
  67. package/polkadot/augment-api-query.d.ts +49 -59
  68. package/polkadot/augment-api-query.d.ts.map +1 -1
  69. package/polkadot/augment-api-runtime.d.ts +144 -3
  70. package/polkadot/augment-api-runtime.d.ts.map +1 -1
  71. package/polkadot/augment-api-tx.d.ts +663 -284
  72. package/polkadot/augment-api-tx.d.ts.map +1 -1
  73. package/polkadot/lookup.d.ts +388 -509
  74. package/polkadot/lookup.d.ts.map +1 -1
  75. package/polkadot/lookup.js +408 -521
  76. package/polkadot/lookup.js.map +1 -1
  77. package/polkadot/polymesh/definitions.d.ts +307 -1
  78. package/polkadot/polymesh/definitions.d.ts.map +1 -1
  79. package/polkadot/polymesh/definitions.js +571 -1
  80. package/polkadot/polymesh/definitions.js.map +1 -1
  81. package/polkadot/registry.d.ts +36 -53
  82. package/polkadot/registry.d.ts.map +1 -1
  83. package/polkadot/types-lookup.d.ts +431 -582
  84. package/polkadot/types-lookup.d.ts.map +1 -1
  85. package/utils/constants.d.ts +1 -0
  86. package/utils/constants.d.ts.map +1 -1
  87. package/utils/constants.js +2 -1
  88. package/utils/constants.js.map +1 -1
  89. package/utils/conversion.d.ts +41 -3
  90. package/utils/conversion.d.ts.map +1 -1
  91. package/utils/conversion.js +561 -412
  92. package/utils/conversion.js.map +1 -1
  93. package/utils/internal.d.ts +29 -1
  94. package/utils/internal.d.ts.map +1 -1
  95. package/utils/internal.js +106 -1
  96. package/utils/internal.js.map +1 -1
@@ -26,22 +26,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- 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.perbillToBigNumber = 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.stringToH512 = exports.stringToU8aFixed = exports.assetToMeshAssetId = exports.assetIdToString = exports.tickerToString = exports.stringToAssetId = exports.stringToTicker = exports.bytesToString = exports.stringToBytes = exports.boolToBoolean = exports.booleanToBool = exports.tickerToDid = void 0;
30
- 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.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.getInternalAssetType = exports.getInternalNftType = 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 = exports.u32ToBigNumber = exports.bigNumberToU32 = exports.meshPermissionsToPermissionsV2 = exports.meshPermissionsToPermissions = exports.extrinsicPermissionsToTransactionPermissions = void 0;
31
- 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.transferReportToTransferBreakdown = exports.granularCanTransferResultToTransferBreakdown = exports.nftDispatchErrorToTransferError = exports.assetDispatchErrorToTransferError = exports.transferConditionToTransferRestriction = exports.identitiesSetToIdentities = exports.portfolioIdsToBtreeSet = 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.assetComplianceReportToCompliance = exports.assetComplianceResultToCompliance = exports.txTagToExtrinsicIdentifier = exports.extrinsicIdentifierToTxTag = exports.txTagToProtocolOp = exports.complianceRequirementToRequirement = exports.complianceRequirementReportToRequirementCompliance = exports.complianceRequirementResultToRequirementCompliance = exports.requirementToComplianceRequirement = void 0;
32
- exports.assetCountToRaw = exports.mediatorAffirmationStatusToStatus = exports.toHistoricalSettlements = exports.toCustomClaimTypeWithIdentity = exports.nftInputToNftMetadataVec = exports.nftInputToNftMetadataAttribute = exports.meshNftToNftId = exports.meshMetadataKeyToMetadataKey = exports.collectionKeysToMetadataKeys = exports.middlewareAuthorizationDataToAuthorization = exports.middlewarePermissionsDataToPermissions = exports.datesToScheduleCheckpoints = exports.middlewareAgentGroupDataToPermissionGroup = exports.legToOffChainLeg = exports.legToNonFungibleLeg = exports.legToFungibleLeg = exports.middlewarePortfolioDataToPortfolio = exports.expiryToMoment = exports.middlewareInstructionToHistoricInstruction = exports.middlewareInstructionToInstructionEndCondition = exports.middlewareInstructionStatusToInstructionStatus = exports.middlewareAffirmStatusToAffirmationStatus = exports.middlewareLegToLeg = exports.portfolioIdStringToPortfolio = exports.instructionMemoToString = exports.metadataValueDetailToMeshMetadataValueDetail = exports.metadataValueToMeshMetadataValue = exports.meshMetadataValueToMetadataValue = exports.metadataToMeshMetadataKey = exports.meshMetadataSpecToMetadataSpec = exports.metadataSpecToMeshMetadataSpec = exports.meshProposalStateToProposalStatus = exports.inputStatTypeToMeshStatType = exports.countStatInputToStatUpdates = exports.claimCountStatInputToStatUpdates = 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 = void 0;
33
- exports.rawValidatorPrefToCommission = exports.rawStakingLedgerToStakingLedgerEntry = exports.rewardDestinationToPayee = exports.rawNominationToStakingNomination = exports.activeEraStakingToActiveEraInfo = exports.stakingRewardDestinationToRaw = exports.middlewareProposalStateToProposalStatus = exports.childKeysWithAuthToCreateChildIdentitiesWithAuth = exports.secondaryAccountWithAuthToSecondaryKeyWithAuth = exports.receiptDetailsToMeshReceiptDetails = exports.offChainMetadataToMeshReceiptMetadata = exports.signatureToMeshRuntimeMultiSignature = exports.createRawExtrinsicStatus = void 0;
29
+ 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.perbillToBigNumber = exports.permillToBigNumber = exports.percentageToPermill = exports.bigNumberToU128 = exports.bigNumberToU64 = exports.bigNumberToU16 = 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.stringToH512 = exports.stringToU8aFixed = exports.assetToMeshAssetId = exports.assetIdToString = exports.tickerToString = exports.stringToAssetId = exports.stringToTicker = exports.bytesToString = exports.stringToBytes = exports.boolToBoolean = exports.booleanToBool = exports.tickerToDid = void 0;
30
+ 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.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.getInternalAssetType = exports.getInternalNftType = 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 = exports.u32ToBigNumber = exports.bigNumberToU32 = exports.meshPermissionsToPermissionsV2 = exports.meshPermissionsToPermissions = exports.extrinsicPermissionsToTransactionPermissions = exports.permissionsToMeshPermissions = void 0;
31
+ exports.caTaxWithholdingsToMeshTaxWithholdings = exports.targetsToTargetIdentities = exports.targetIdentitiesToCorporateActionTargets = exports.checkpointToRecordDateSpec = exports.corporateActionKindToCaKind = exports.meshCorporateActionToCorporateActionParams = exports.fundraiserToOfferingDetails = exports.fundraiserTierToTier = exports.middlewarePortfolioToPortfolio = exports.permissionsLikeToPermissions = exports.offeringTierToPriceTier = exports.transferReportToTransferBreakdown = exports.granularCanTransferResultToTransferBreakdown = exports.nftDispatchErrorToTransferError = exports.assetDispatchErrorToTransferError = exports.transferConditionToTransferRestriction = exports.identitiesSetToIdentities = exports.portfolioIdsToBtreeSet = 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.assetComplianceReportToCompliance = exports.assetComplianceResultToCompliance = exports.txTagToExtrinsicIdentifier = exports.extrinsicIdentifierToTxTag = exports.txTagToProtocolOp = exports.complianceRequirementToRequirement = exports.complianceRequirementReportToRequirementCompliance = exports.complianceRequirementResultToRequirementCompliance = exports.requirementToComplianceRequirement = exports.trustedClaimIssuerToTrustedIssuer = void 0;
32
+ exports.mediatorAffirmationStatusToStatus = exports.toHistoricalSettlements = exports.toCustomClaimTypeWithIdentity = exports.nftInputToNftMetadataVec = exports.nftInputToNftMetadataAttribute = exports.meshNftToNftId = exports.meshMetadataKeyToMetadataKey = exports.collectionKeysToMetadataKeys = exports.middlewareAuthorizationDataToAuthorization = exports.middlewarePermissionsDataToPermissions = exports.datesToScheduleCheckpoints = exports.middlewareAgentGroupDataToPermissionGroup = exports.legToOffChainLeg = exports.legToNonFungibleLeg = exports.legToFungibleLeg = exports.middlewarePortfolioDataToPortfolio = exports.expiryToMoment = exports.middlewareInstructionToHistoricInstruction = exports.middlewareInstructionToInstructionEndCondition = exports.middlewareInstructionStatusToInstructionStatus = exports.middlewareAffirmStatusToAffirmationStatus = exports.middlewareLegToLeg = exports.portfolioIdStringToPortfolio = exports.instructionMemoToString = exports.metadataValueDetailToMeshMetadataValueDetail = exports.metadataValueToMeshMetadataValue = exports.meshMetadataValueToMetadataValue = exports.metadataToMeshMetadataKey = exports.meshMetadataSpecToMetadataSpec = exports.metadataSpecToMeshMetadataSpec = exports.meshProposalStateToProposalStatus = exports.inputStatTypeToMeshStatType = exports.countStatInputToStatUpdates = exports.claimCountStatInputToStatUpdates = 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 = void 0;
33
+ exports.meshBallotDetailsToCorporateBallotDetails = exports.ballotVoteToMeshBallotVote = exports.ballotDetailsToBallotStatus = exports.corporateBallotMetaToMeshCorporateBallotMeta = exports.corporateMotionToMeshCorporateMotion = exports.corporateBallotTimeRangeToMeshCorporateBallotTimeRange = exports.meshCorporateBallotMetaToCorporateBallotMeta = exports.meshCorporateBallotMotionToCorporateBallotMotion = exports.rawValidatorPrefToCommission = exports.rawStakingLedgerToStakingLedgerEntry = exports.rewardDestinationToPayee = exports.rawNominationToStakingNomination = exports.activeEraStakingToActiveEraInfo = exports.stakingRewardDestinationToRaw = exports.middlewareProposalStateToProposalStatus = exports.childKeysWithAuthToCreateChildIdentitiesWithAuth = exports.secondaryAccountWithAuthToSecondaryKeyWithAuth = exports.receiptDetailsToMeshReceiptDetails = exports.offChainMetadataToMeshReceiptMetadata = exports.signatureToMeshRuntimeMultiSignature = exports.createRawExtrinsicStatus = exports.assetCountToRaw = void 0;
34
34
  const util_1 = require("@polkadot/util");
35
35
  const util_crypto_1 = require("@polkadot/util-crypto");
36
36
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
37
37
  const iso_7064_1 = require("iso-7064");
38
38
  const lodash_1 = require("lodash");
39
+ const types_1 = require("../api/entities/CorporateBallot/types");
39
40
  const utils_1 = require("../api/procedures/utils");
40
41
  const utils_2 = require("../generated/utils");
41
42
  const internal_1 = require("../internal");
42
- const types_1 = require("../middleware/types");
43
+ const types_2 = require("../middleware/types");
43
44
  const typesV1_1 = require("../middleware/typesV1");
44
- const types_2 = require("../types");
45
+ const types_3 = require("../types");
45
46
  const internal_2 = require("../types/internal");
46
47
  const utils_3 = require("../types/utils");
47
48
  const utils_4 = require("./");
@@ -222,9 +223,9 @@ function createSignerValue(type, value) {
222
223
  */
223
224
  function signatoryToSignerValue(signatory) {
224
225
  if (signatory.isAccount) {
225
- return createSignerValue(types_2.SignerType.Account, accountIdToString(signatory.asAccount));
226
+ return createSignerValue(types_3.SignerType.Account, accountIdToString(signatory.asAccount));
226
227
  }
227
- return createSignerValue(types_2.SignerType.Identity, identityIdToString(signatory.asIdentity));
228
+ return createSignerValue(types_3.SignerType.Identity, identityIdToString(signatory.asIdentity));
228
229
  }
229
230
  exports.signatoryToSignerValue = signatoryToSignerValue;
230
231
  /**
@@ -232,9 +233,9 @@ exports.signatoryToSignerValue = signatoryToSignerValue;
232
233
  */
233
234
  function signerToSignerValue(signer) {
234
235
  if (signer instanceof internal_1.Account) {
235
- return createSignerValue(types_2.SignerType.Account, signer.address);
236
+ return createSignerValue(types_3.SignerType.Account, signer.address);
236
237
  }
237
- return createSignerValue(types_2.SignerType.Identity, signer.did);
238
+ return createSignerValue(types_3.SignerType.Identity, signer.did);
238
239
  }
239
240
  exports.signerToSignerValue = signerToSignerValue;
240
241
  /**
@@ -242,7 +243,7 @@ exports.signerToSignerValue = signerToSignerValue;
242
243
  */
243
244
  function signerValueToSigner(signerValue, context) {
244
245
  const { type, value } = signerValue;
245
- if (type === types_2.SignerType.Account) {
246
+ if (type === types_3.SignerType.Account) {
246
247
  return new internal_1.Account({ address: value }, context);
247
248
  }
248
249
  return new internal_1.Identity({ did: value }, context);
@@ -279,6 +280,15 @@ function u128ToBigNumber(value) {
279
280
  return new bignumber_js_1.default(value.toString());
280
281
  }
281
282
  exports.u128ToBigNumber = u128ToBigNumber;
283
+ /**
284
+ * @hidden
285
+ */
286
+ function bigNumberToU16(value, context) {
287
+ (0, internal_3.assertIsInteger)(value);
288
+ (0, internal_3.assertIsPositive)(value);
289
+ return context.createType('u16', value.toString());
290
+ }
291
+ exports.bigNumberToU16 = bigNumberToU16;
282
292
  /**
283
293
  * @hidden
284
294
  */
@@ -304,7 +314,7 @@ function percentageToPermill(value, context) {
304
314
  (0, internal_3.assertIsPositive)(value);
305
315
  if (value.gt(100)) {
306
316
  throw new internal_1.PolymeshError({
307
- code: types_2.ErrorCode.ValidationError,
317
+ code: types_3.ErrorCode.ValidationError,
308
318
  message: "Percentage shouldn't exceed 100",
309
319
  });
310
320
  }
@@ -335,19 +345,19 @@ exports.perbillToBigNumber = perbillToBigNumber;
335
345
  function meshClaimToInputStatClaim(claim) {
336
346
  if (claim.isAccredited) {
337
347
  return {
338
- type: types_2.ClaimType.Accredited,
348
+ type: types_3.ClaimType.Accredited,
339
349
  accredited: boolToBoolean(claim.asAccredited),
340
350
  };
341
351
  }
342
352
  else if (claim.isAffiliate) {
343
353
  return {
344
- type: types_2.ClaimType.Affiliate,
354
+ type: types_3.ClaimType.Affiliate,
345
355
  affiliate: boolToBoolean(claim.asAffiliate),
346
356
  };
347
357
  }
348
358
  else {
349
359
  return {
350
- type: types_2.ClaimType.Jurisdiction,
360
+ type: types_3.ClaimType.Jurisdiction,
351
361
  countryCode: claim.asJurisdiction.isSome
352
362
  ? (0, utils_2.meshCountryCodeToCountryCode)(claim.asJurisdiction.unwrap())
353
363
  : undefined,
@@ -491,89 +501,89 @@ exports.textToString = textToString;
491
501
  */
492
502
  function txGroupToTxTags(group) {
493
503
  switch (group) {
494
- case types_2.TxGroup.PortfolioManagement: {
504
+ case types_3.TxGroup.PortfolioManagement: {
495
505
  return [
496
- types_2.TxTags.identity.AddInvestorUniquenessClaim,
497
- types_2.TxTags.portfolio.MovePortfolioFunds,
498
- types_2.TxTags.settlement.AddInstruction,
499
- types_2.TxTags.settlement.AddInstructionWithMemo,
500
- types_2.TxTags.settlement.AddAndAffirmInstruction,
501
- types_2.TxTags.settlement.AddAndAffirmInstructionWithMemo,
502
- types_2.TxTags.settlement.AffirmInstruction,
503
- types_2.TxTags.settlement.RejectInstruction,
504
- types_2.TxTags.settlement.CreateVenue,
506
+ types_3.TxTags.identity.AddInvestorUniquenessClaim,
507
+ types_3.TxTags.portfolio.MovePortfolioFunds,
508
+ types_3.TxTags.settlement.AddInstruction,
509
+ types_3.TxTags.settlement.AddInstructionWithMemo,
510
+ types_3.TxTags.settlement.AddAndAffirmInstruction,
511
+ types_3.TxTags.settlement.AddAndAffirmInstructionWithMemo,
512
+ types_3.TxTags.settlement.AffirmInstruction,
513
+ types_3.TxTags.settlement.RejectInstruction,
514
+ types_3.TxTags.settlement.CreateVenue,
505
515
  ];
506
516
  }
507
- case types_2.TxGroup.AssetManagement: {
517
+ case types_3.TxGroup.AssetManagement: {
508
518
  return [
509
- types_2.TxTags.asset.MakeDivisible,
510
- types_2.TxTags.asset.RenameAsset,
511
- types_2.TxTags.asset.SetFundingRound,
512
- types_2.TxTags.asset.AddDocuments,
513
- types_2.TxTags.asset.RemoveDocuments,
519
+ types_3.TxTags.asset.MakeDivisible,
520
+ types_3.TxTags.asset.RenameAsset,
521
+ types_3.TxTags.asset.SetFundingRound,
522
+ types_3.TxTags.asset.AddDocuments,
523
+ types_3.TxTags.asset.RemoveDocuments,
514
524
  ];
515
525
  }
516
- case types_2.TxGroup.AdvancedAssetManagement: {
526
+ case types_3.TxGroup.AdvancedAssetManagement: {
517
527
  return [
518
- types_2.TxTags.asset.Freeze,
519
- types_2.TxTags.asset.Unfreeze,
520
- types_2.TxTags.identity.AddAuthorization,
521
- types_2.TxTags.identity.RemoveAuthorization,
528
+ types_3.TxTags.asset.Freeze,
529
+ types_3.TxTags.asset.Unfreeze,
530
+ types_3.TxTags.identity.AddAuthorization,
531
+ types_3.TxTags.identity.RemoveAuthorization,
522
532
  ];
523
533
  }
524
- case types_2.TxGroup.Distribution: {
534
+ case types_3.TxGroup.Distribution: {
525
535
  return [
526
- types_2.TxTags.identity.AddInvestorUniquenessClaim,
527
- types_2.TxTags.settlement.CreateVenue,
528
- types_2.TxTags.settlement.AddInstruction,
529
- types_2.TxTags.settlement.AddInstructionWithMemo,
530
- types_2.TxTags.settlement.AddAndAffirmInstruction,
531
- types_2.TxTags.settlement.AddAndAffirmInstructionWithMemo,
536
+ types_3.TxTags.identity.AddInvestorUniquenessClaim,
537
+ types_3.TxTags.settlement.CreateVenue,
538
+ types_3.TxTags.settlement.AddInstruction,
539
+ types_3.TxTags.settlement.AddInstructionWithMemo,
540
+ types_3.TxTags.settlement.AddAndAffirmInstruction,
541
+ types_3.TxTags.settlement.AddAndAffirmInstructionWithMemo,
532
542
  ];
533
543
  }
534
- case types_2.TxGroup.Issuance: {
535
- return [types_2.TxTags.asset.Issue];
544
+ case types_3.TxGroup.Issuance: {
545
+ return [types_3.TxTags.asset.Issue];
536
546
  }
537
- case types_2.TxGroup.TrustedClaimIssuersManagement: {
547
+ case types_3.TxGroup.TrustedClaimIssuersManagement: {
538
548
  return [
539
- types_2.TxTags.complianceManager.AddDefaultTrustedClaimIssuer,
540
- types_2.TxTags.complianceManager.RemoveDefaultTrustedClaimIssuer,
549
+ types_3.TxTags.complianceManager.AddDefaultTrustedClaimIssuer,
550
+ types_3.TxTags.complianceManager.RemoveDefaultTrustedClaimIssuer,
541
551
  ];
542
552
  }
543
- case types_2.TxGroup.ClaimsManagement: {
544
- return [types_2.TxTags.identity.AddClaim, types_2.TxTags.identity.RevokeClaim];
553
+ case types_3.TxGroup.ClaimsManagement: {
554
+ return [types_3.TxTags.identity.AddClaim, types_3.TxTags.identity.RevokeClaim];
545
555
  }
546
- case types_2.TxGroup.ComplianceRequirementsManagement: {
556
+ case types_3.TxGroup.ComplianceRequirementsManagement: {
547
557
  return [
548
- types_2.TxTags.complianceManager.AddComplianceRequirement,
549
- types_2.TxTags.complianceManager.RemoveComplianceRequirement,
550
- types_2.TxTags.complianceManager.PauseAssetCompliance,
551
- types_2.TxTags.complianceManager.ResumeAssetCompliance,
552
- types_2.TxTags.complianceManager.ResetAssetCompliance,
558
+ types_3.TxTags.complianceManager.AddComplianceRequirement,
559
+ types_3.TxTags.complianceManager.RemoveComplianceRequirement,
560
+ types_3.TxTags.complianceManager.PauseAssetCompliance,
561
+ types_3.TxTags.complianceManager.ResumeAssetCompliance,
562
+ types_3.TxTags.complianceManager.ResetAssetCompliance,
553
563
  ];
554
564
  }
555
- case types_2.TxGroup.CorporateActionsManagement: {
565
+ case types_3.TxGroup.CorporateActionsManagement: {
556
566
  return [
557
- types_2.TxTags.checkpoint.CreateSchedule,
558
- types_2.TxTags.checkpoint.RemoveSchedule,
559
- types_2.TxTags.checkpoint.CreateCheckpoint,
560
- types_2.TxTags.corporateAction.InitiateCorporateAction,
561
- types_2.TxTags.capitalDistribution.Distribute,
562
- types_2.TxTags.capitalDistribution.Claim,
563
- types_2.TxTags.identity.AddInvestorUniquenessClaim,
567
+ types_3.TxTags.checkpoint.CreateSchedule,
568
+ types_3.TxTags.checkpoint.RemoveSchedule,
569
+ types_3.TxTags.checkpoint.CreateCheckpoint,
570
+ types_3.TxTags.corporateAction.InitiateCorporateAction,
571
+ types_3.TxTags.capitalDistribution.Distribute,
572
+ types_3.TxTags.capitalDistribution.Claim,
573
+ types_3.TxTags.identity.AddInvestorUniquenessClaim,
564
574
  ];
565
575
  }
566
- case types_2.TxGroup.StoManagement: {
576
+ case types_3.TxGroup.StoManagement: {
567
577
  return [
568
- types_2.TxTags.sto.CreateFundraiser,
569
- types_2.TxTags.sto.FreezeFundraiser,
570
- types_2.TxTags.sto.Invest,
571
- types_2.TxTags.sto.ModifyFundraiserWindow,
572
- types_2.TxTags.sto.Stop,
573
- types_2.TxTags.sto.UnfreezeFundraiser,
574
- types_2.TxTags.identity.AddInvestorUniquenessClaim,
575
- types_2.TxTags.asset.Issue,
576
- types_2.TxTags.settlement.CreateVenue,
578
+ types_3.TxTags.sto.CreateFundraiser,
579
+ types_3.TxTags.sto.FreezeFundraiser,
580
+ types_3.TxTags.sto.Invest,
581
+ types_3.TxTags.sto.ModifyFundraiserWindow,
582
+ types_3.TxTags.sto.Stop,
583
+ types_3.TxTags.sto.UnfreezeFundraiser,
584
+ types_3.TxTags.identity.AddInvestorUniquenessClaim,
585
+ types_3.TxTags.asset.Issue,
586
+ types_3.TxTags.settlement.CreateVenue,
577
587
  ];
578
588
  }
579
589
  }
@@ -592,7 +602,7 @@ function transactionPermissionsToTxGroups(permissions) {
592
602
  const { values: transactionValues, type, exceptions = [] } = permissions;
593
603
  let includedTags;
594
604
  let excludedTags;
595
- if (type === types_2.PermissionType.Include) {
605
+ if (type === types_3.PermissionType.Include) {
596
606
  includedTags = transactionValues;
597
607
  excludedTags = exceptions;
598
608
  }
@@ -600,7 +610,7 @@ function transactionPermissionsToTxGroups(permissions) {
600
610
  includedTags = exceptions;
601
611
  excludedTags = transactionValues;
602
612
  }
603
- return (0, lodash_1.values)(types_2.TxGroup)
613
+ return (0, lodash_1.values)(types_3.TxGroup)
604
614
  .sort()
605
615
  .filter(group => {
606
616
  const tagsInGroup = txGroupToTxTags(group);
@@ -636,7 +646,7 @@ function initExtrinsicDict(txValues, message) {
636
646
  let pallet = extrinsicDict[palletName];
637
647
  if (pallet === null) {
638
648
  throw new internal_1.PolymeshError({
639
- code: types_2.ErrorCode.ValidationError,
649
+ code: types_3.ErrorCode.ValidationError,
640
650
  message,
641
651
  data: {
642
652
  module: palletName,
@@ -668,7 +678,7 @@ function buildPalletPermissions(transactions) {
668
678
  const pallet = extrinsicDict[palletName];
669
679
  if (pallet === undefined) {
670
680
  throw new internal_1.PolymeshError({
671
- code: types_2.ErrorCode.ValidationError,
681
+ code: types_3.ErrorCode.ValidationError,
672
682
  message: 'Attempting to add a transaction permission exception without its corresponding module being included/excluded',
673
683
  });
674
684
  }
@@ -680,7 +690,7 @@ function buildPalletPermissions(transactions) {
680
690
  }
681
691
  else {
682
692
  throw new internal_1.PolymeshError({
683
- code: types_2.ErrorCode.ValidationError,
693
+ code: types_3.ErrorCode.ValidationError,
684
694
  message: 'Cannot simultaneously include and exclude transactions belonging to the same module',
685
695
  });
686
696
  }
@@ -709,7 +719,7 @@ function buildPalletPermissions(transactions) {
709
719
  (0, lodash_1.forEach)(extrinsicDict, (val, key) => {
710
720
  pallets.set(key, { extrinsics: getDispatchables(val) });
711
721
  });
712
- if (type === types_2.PermissionType.Include) {
722
+ if (type === types_3.PermissionType.Include) {
713
723
  extrinsic = {
714
724
  These: pallets,
715
725
  };
@@ -739,7 +749,7 @@ function permissionsToMeshPermissions(permissions, context) {
739
749
  const { values: assetValues, type } = assets;
740
750
  assetValues.sort(({ id: assetIdA }, { id: assetIdB }) => assetIdA.localeCompare(assetIdB));
741
751
  const tickers = assetValues.map(assetValue => assetToMeshAssetId(assetValue, context));
742
- if (type === types_2.PermissionType.Include) {
752
+ if (type === types_3.PermissionType.Include) {
743
753
  asset = {
744
754
  These: tickers,
745
755
  };
@@ -754,7 +764,7 @@ function permissionsToMeshPermissions(permissions, context) {
754
764
  if (portfolios) {
755
765
  const { values: portfolioValues, type } = portfolios;
756
766
  const portfolioIds = portfolioValues.map(pValue => portfolioIdToMeshPortfolioId(portfolioToPortfolioId(pValue), context));
757
- if (type === types_2.PermissionType.Include) {
767
+ if (type === types_3.PermissionType.Include) {
758
768
  portfolio = {
759
769
  These: portfolioIds,
760
770
  };
@@ -790,11 +800,11 @@ function extrinsicPermissionsToTransactionPermissions(permissions) {
790
800
  let extrinsicType;
791
801
  let pallets;
792
802
  if (permissions.isThese) {
793
- extrinsicType = types_2.PermissionType.Include;
803
+ extrinsicType = types_3.PermissionType.Include;
794
804
  pallets = permissions.asThese;
795
805
  }
796
806
  else if (permissions.isExcept) {
797
- extrinsicType = types_2.PermissionType.Exclude;
807
+ extrinsicType = types_3.PermissionType.Exclude;
798
808
  pallets = permissions.asExcept;
799
809
  }
800
810
  let txValues = [];
@@ -849,11 +859,11 @@ function meshPermissionsToPermissions(permissions, context) {
849
859
  let assetsType;
850
860
  let assetsPermissions;
851
861
  if (asset.isThese) {
852
- assetsType = types_2.PermissionType.Include;
862
+ assetsType = types_3.PermissionType.Include;
853
863
  assetsPermissions = asset.asThese;
854
864
  }
855
865
  else if (asset.isExcept) {
856
- assetsType = types_2.PermissionType.Exclude;
866
+ assetsType = types_3.PermissionType.Exclude;
857
867
  assetsPermissions = asset.asExcept;
858
868
  }
859
869
  if (assetsPermissions) {
@@ -868,11 +878,11 @@ function meshPermissionsToPermissions(permissions, context) {
868
878
  let portfoliosType;
869
879
  let portfolioIds;
870
880
  if (portfolio.isThese) {
871
- portfoliosType = types_2.PermissionType.Include;
881
+ portfoliosType = types_3.PermissionType.Include;
872
882
  portfolioIds = portfolio.asThese;
873
883
  }
874
884
  else if (portfolio.isExcept) {
875
- portfoliosType = types_2.PermissionType.Exclude;
885
+ portfoliosType = types_3.PermissionType.Exclude;
876
886
  portfolioIds = portfolio.asExcept;
877
887
  }
878
888
  if (portfolioIds) {
@@ -912,11 +922,11 @@ function meshPermissionsToPermissionsV2(account, context) {
912
922
  if (asset.isSome) {
913
923
  const rawAssetPermissions = asset.unwrap();
914
924
  if (rawAssetPermissions.isThese) {
915
- assetsType = types_2.PermissionType.Include;
925
+ assetsType = types_3.PermissionType.Include;
916
926
  assetsPermissions = rawAssetPermissions.asThese;
917
927
  }
918
928
  else if (rawAssetPermissions.isExcept) {
919
- assetsType = types_2.PermissionType.Exclude;
929
+ assetsType = types_3.PermissionType.Exclude;
920
930
  assetsPermissions = rawAssetPermissions.asExcept;
921
931
  }
922
932
  }
@@ -939,11 +949,11 @@ function meshPermissionsToPermissionsV2(account, context) {
939
949
  if (portfolio.isSome) {
940
950
  const rawPortfolioPermissions = portfolio.unwrap();
941
951
  if (rawPortfolioPermissions.isThese) {
942
- portfoliosType = types_2.PermissionType.Include;
952
+ portfoliosType = types_3.PermissionType.Include;
943
953
  portfolioIds = rawPortfolioPermissions.asThese;
944
954
  }
945
955
  else if (rawPortfolioPermissions.isExcept) {
946
- portfoliosType = types_2.PermissionType.Exclude;
956
+ portfoliosType = types_3.PermissionType.Exclude;
947
957
  portfolioIds = rawPortfolioPermissions.asExcept;
948
958
  }
949
959
  }
@@ -1028,16 +1038,16 @@ exports.permissionGroupIdentifierToAgentGroup = permissionGroupIdentifierToAgent
1028
1038
  */
1029
1039
  function agentGroupToPermissionGroupIdentifier(agentGroup) {
1030
1040
  if (agentGroup.isFull) {
1031
- return types_2.PermissionGroupType.Full;
1041
+ return types_3.PermissionGroupType.Full;
1032
1042
  }
1033
1043
  else if (agentGroup.isExceptMeta) {
1034
- return types_2.PermissionGroupType.ExceptMeta;
1044
+ return types_3.PermissionGroupType.ExceptMeta;
1035
1045
  }
1036
1046
  else if (agentGroup.isPolymeshV1CAA) {
1037
- return types_2.PermissionGroupType.PolymeshV1Caa;
1047
+ return types_3.PermissionGroupType.PolymeshV1Caa;
1038
1048
  }
1039
1049
  else if (agentGroup.isPolymeshV1PIA) {
1040
- return types_2.PermissionGroupType.PolymeshV1Pia;
1050
+ return types_3.PermissionGroupType.PolymeshV1Pia;
1041
1051
  }
1042
1052
  else {
1043
1053
  return { custom: u32ToBigNumber(agentGroup.asCustom) };
@@ -1050,28 +1060,28 @@ exports.agentGroupToPermissionGroupIdentifier = agentGroupToPermissionGroupIdent
1050
1060
  function authorizationToAuthorizationData(auth, context) {
1051
1061
  let value;
1052
1062
  const { type } = auth;
1053
- if (type === types_2.AuthorizationType.AttestPrimaryKeyRotation) {
1063
+ if (type === types_3.AuthorizationType.AttestPrimaryKeyRotation) {
1054
1064
  value = stringToIdentityId(auth.value.did, context);
1055
1065
  }
1056
- else if (type === types_2.AuthorizationType.RotatePrimaryKey) {
1066
+ else if (type === types_3.AuthorizationType.RotatePrimaryKey) {
1057
1067
  value = null;
1058
1068
  }
1059
- else if (type === types_2.AuthorizationType.JoinIdentity) {
1069
+ else if (type === types_3.AuthorizationType.JoinIdentity) {
1060
1070
  value = permissionsToMeshPermissions(auth.value, context);
1061
1071
  }
1062
- else if (type === types_2.AuthorizationType.PortfolioCustody) {
1072
+ else if (type === types_3.AuthorizationType.PortfolioCustody) {
1063
1073
  value = portfolioIdToMeshPortfolioId(portfolioToPortfolioId(auth.value), context);
1064
1074
  }
1065
- else if (auth.type === types_2.AuthorizationType.TransferAssetOwnership) {
1075
+ else if (auth.type === types_3.AuthorizationType.TransferAssetOwnership) {
1066
1076
  value = stringToAssetId(auth.value, context);
1067
1077
  }
1068
- else if (auth.type === types_2.AuthorizationType.TransferTicker) {
1078
+ else if (auth.type === types_3.AuthorizationType.TransferTicker) {
1069
1079
  value = stringToTicker(auth.value, context);
1070
1080
  }
1071
- else if (type === types_2.AuthorizationType.RotatePrimaryKeyToSecondary) {
1081
+ else if (type === types_3.AuthorizationType.RotatePrimaryKeyToSecondary) {
1072
1082
  value = permissionsToMeshPermissions(auth.value, context);
1073
1083
  }
1074
- else if (type === types_2.AuthorizationType.BecomeAgent) {
1084
+ else if (type === types_3.AuthorizationType.BecomeAgent) {
1075
1085
  const assetId = assetToMeshAssetId(auth.value.asset, context);
1076
1086
  if (auth.value instanceof internal_1.CustomPermissionGroup) {
1077
1087
  const { id } = auth.value;
@@ -1105,7 +1115,7 @@ function bigNumberToBalance(value, context, divisible = true) {
1105
1115
  (0, internal_3.assertIsPositive)(value);
1106
1116
  if (value.isGreaterThan(constants_1.MAX_BALANCE)) {
1107
1117
  throw new internal_1.PolymeshError({
1108
- code: types_2.ErrorCode.ValidationError,
1118
+ code: types_3.ErrorCode.ValidationError,
1109
1119
  message: 'The value exceeds the maximum possible balance',
1110
1120
  data: {
1111
1121
  currentValue: value,
@@ -1116,7 +1126,7 @@ function bigNumberToBalance(value, context, divisible = true) {
1116
1126
  if (divisible) {
1117
1127
  if (((_a = value.decimalPlaces()) !== null && _a !== void 0 ? _a : 0) > constants_1.MAX_DECIMALS) {
1118
1128
  throw new internal_1.PolymeshError({
1119
- code: types_2.ErrorCode.ValidationError,
1129
+ code: types_3.ErrorCode.ValidationError,
1120
1130
  message: 'The value has more decimal places than allowed',
1121
1131
  data: {
1122
1132
  currentValue: value,
@@ -1127,7 +1137,7 @@ function bigNumberToBalance(value, context, divisible = true) {
1127
1137
  }
1128
1138
  else if (value.decimalPlaces()) {
1129
1139
  throw new internal_1.PolymeshError({
1130
- code: types_2.ErrorCode.ValidationError,
1140
+ code: types_3.ErrorCode.ValidationError,
1131
1141
  message: 'The value has decimals but the Asset is indivisible',
1132
1142
  });
1133
1143
  }
@@ -1146,10 +1156,10 @@ exports.balanceToBigNumber = balanceToBigNumber;
1146
1156
  */
1147
1157
  function assemblePermissionGroup(permissionGroupIdentifier, assetId, context) {
1148
1158
  switch (permissionGroupIdentifier) {
1149
- case types_2.PermissionGroupType.ExceptMeta:
1150
- case types_2.PermissionGroupType.Full:
1151
- case types_2.PermissionGroupType.PolymeshV1Caa:
1152
- case types_2.PermissionGroupType.PolymeshV1Pia: {
1159
+ case types_3.PermissionGroupType.ExceptMeta:
1160
+ case types_3.PermissionGroupType.Full:
1161
+ case types_3.PermissionGroupType.PolymeshV1Caa:
1162
+ case types_3.PermissionGroupType.PolymeshV1Pia: {
1153
1163
  return new internal_1.KnownPermissionGroup({ type: permissionGroupIdentifier, assetId }, context);
1154
1164
  }
1155
1165
  default: {
@@ -1172,7 +1182,7 @@ exports.agentGroupToPermissionGroup = agentGroupToPermissionGroup;
1172
1182
  function authorizationDataToAuthorization(auth, context) {
1173
1183
  if (auth.isAttestPrimaryKeyRotation) {
1174
1184
  return {
1175
- type: types_2.AuthorizationType.AttestPrimaryKeyRotation,
1185
+ type: types_3.AuthorizationType.AttestPrimaryKeyRotation,
1176
1186
  value: new internal_1.Identity({
1177
1187
  did: identityIdToString(auth.asAttestPrimaryKeyRotation),
1178
1188
  }, context),
@@ -1180,43 +1190,43 @@ function authorizationDataToAuthorization(auth, context) {
1180
1190
  }
1181
1191
  if (auth.isRotatePrimaryKey) {
1182
1192
  return {
1183
- type: types_2.AuthorizationType.RotatePrimaryKey,
1193
+ type: types_3.AuthorizationType.RotatePrimaryKey,
1184
1194
  };
1185
1195
  }
1186
1196
  if (auth.isTransferTicker) {
1187
1197
  return {
1188
- type: types_2.AuthorizationType.TransferTicker,
1198
+ type: types_3.AuthorizationType.TransferTicker,
1189
1199
  value: tickerToString(auth.asTransferTicker),
1190
1200
  };
1191
1201
  }
1192
1202
  if (auth.isAddMultiSigSigner) {
1193
1203
  return {
1194
- type: types_2.AuthorizationType.AddMultiSigSigner,
1204
+ type: types_3.AuthorizationType.AddMultiSigSigner,
1195
1205
  value: accountIdToString(auth.asAddMultiSigSigner),
1196
1206
  };
1197
1207
  }
1198
1208
  if (auth.isTransferAssetOwnership) {
1199
1209
  return {
1200
- type: types_2.AuthorizationType.TransferAssetOwnership,
1210
+ type: types_3.AuthorizationType.TransferAssetOwnership,
1201
1211
  value: assetIdToString(auth.asTransferAssetOwnership),
1202
1212
  };
1203
1213
  }
1204
1214
  if (auth.isPortfolioCustody) {
1205
1215
  return {
1206
- type: types_2.AuthorizationType.PortfolioCustody,
1216
+ type: types_3.AuthorizationType.PortfolioCustody,
1207
1217
  value: meshPortfolioIdToPortfolio(auth.asPortfolioCustody, context),
1208
1218
  };
1209
1219
  }
1210
1220
  if (auth.isJoinIdentity) {
1211
1221
  return {
1212
- type: types_2.AuthorizationType.JoinIdentity,
1222
+ type: types_3.AuthorizationType.JoinIdentity,
1213
1223
  value: meshPermissionsToPermissions(auth.asJoinIdentity, context),
1214
1224
  };
1215
1225
  }
1216
1226
  if (auth.isAddRelayerPayingKey) {
1217
1227
  const [userKey, payingKey, polyxLimit] = auth.asAddRelayerPayingKey;
1218
1228
  return {
1219
- type: types_2.AuthorizationType.AddRelayerPayingKey,
1229
+ type: types_3.AuthorizationType.AddRelayerPayingKey,
1220
1230
  value: {
1221
1231
  beneficiary: new internal_1.Account({ address: accountIdToString(userKey) }, context),
1222
1232
  subsidizer: new internal_1.Account({ address: accountIdToString(payingKey) }, context),
@@ -1227,18 +1237,18 @@ function authorizationDataToAuthorization(auth, context) {
1227
1237
  if (auth.isBecomeAgent) {
1228
1238
  const [assetId, agentGroup] = auth.asBecomeAgent;
1229
1239
  return {
1230
- type: types_2.AuthorizationType.BecomeAgent,
1240
+ type: types_3.AuthorizationType.BecomeAgent,
1231
1241
  value: agentGroupToPermissionGroup(agentGroup, assetIdToString(assetId), context),
1232
1242
  };
1233
1243
  }
1234
1244
  if (auth.isRotatePrimaryKeyToSecondary) {
1235
1245
  return {
1236
- type: types_2.AuthorizationType.RotatePrimaryKeyToSecondary,
1246
+ type: types_3.AuthorizationType.RotatePrimaryKeyToSecondary,
1237
1247
  value: meshPermissionsToPermissions(auth.asRotatePrimaryKeyToSecondary, context),
1238
1248
  };
1239
1249
  }
1240
1250
  throw new internal_1.PolymeshError({
1241
- code: types_2.ErrorCode.UnexpectedError,
1251
+ code: types_3.ErrorCode.UnexpectedError,
1242
1252
  message: 'Unsupported Authorization Type. Please contact the Polymesh team',
1243
1253
  data: {
1244
1254
  auth: JSON.stringify(auth, null, 2),
@@ -1252,7 +1262,7 @@ exports.authorizationDataToAuthorization = authorizationDataToAuthorization;
1252
1262
  function assertMemoValid(value) {
1253
1263
  if (value.length > constants_1.MAX_MEMO_LENGTH) {
1254
1264
  throw new internal_1.PolymeshError({
1255
- code: types_2.ErrorCode.ValidationError,
1265
+ code: types_3.ErrorCode.ValidationError,
1256
1266
  message: 'Max memo length exceeded',
1257
1267
  data: {
1258
1268
  maxLength: constants_1.MAX_MEMO_LENGTH,
@@ -1275,71 +1285,71 @@ function u8ToTransferStatus(status) {
1275
1285
  const code = status.toNumber();
1276
1286
  switch (code) {
1277
1287
  case 81: {
1278
- return types_2.TransferStatus.Success;
1288
+ return types_3.TransferStatus.Success;
1279
1289
  }
1280
1290
  case 82: {
1281
- return types_2.TransferStatus.InsufficientBalance;
1291
+ return types_3.TransferStatus.InsufficientBalance;
1282
1292
  }
1283
1293
  case 83: {
1284
- return types_2.TransferStatus.InsufficientAllowance;
1294
+ return types_3.TransferStatus.InsufficientAllowance;
1285
1295
  }
1286
1296
  case 84: {
1287
- return types_2.TransferStatus.TransfersHalted;
1297
+ return types_3.TransferStatus.TransfersHalted;
1288
1298
  }
1289
1299
  case 85: {
1290
- return types_2.TransferStatus.FundsLocked;
1300
+ return types_3.TransferStatus.FundsLocked;
1291
1301
  }
1292
1302
  case 86: {
1293
- return types_2.TransferStatus.InvalidSenderAddress;
1303
+ return types_3.TransferStatus.InvalidSenderAddress;
1294
1304
  }
1295
1305
  case 87: {
1296
- return types_2.TransferStatus.InvalidReceiverAddress;
1306
+ return types_3.TransferStatus.InvalidReceiverAddress;
1297
1307
  }
1298
1308
  case 88: {
1299
- return types_2.TransferStatus.InvalidOperator;
1309
+ return types_3.TransferStatus.InvalidOperator;
1300
1310
  }
1301
1311
  case 160: {
1302
- return types_2.TransferStatus.InvalidSenderIdentity;
1312
+ return types_3.TransferStatus.InvalidSenderIdentity;
1303
1313
  }
1304
1314
  case 161: {
1305
- return types_2.TransferStatus.InvalidReceiverIdentity;
1315
+ return types_3.TransferStatus.InvalidReceiverIdentity;
1306
1316
  }
1307
1317
  case 162: {
1308
- return types_2.TransferStatus.ComplianceFailure;
1318
+ return types_3.TransferStatus.ComplianceFailure;
1309
1319
  }
1310
1320
  case 163: {
1311
- return types_2.TransferStatus.SmartExtensionFailure;
1321
+ return types_3.TransferStatus.SmartExtensionFailure;
1312
1322
  }
1313
1323
  case 164: {
1314
- return types_2.TransferStatus.InvalidGranularity;
1324
+ return types_3.TransferStatus.InvalidGranularity;
1315
1325
  }
1316
1326
  case 165: {
1317
- return types_2.TransferStatus.VolumeLimitReached;
1327
+ return types_3.TransferStatus.VolumeLimitReached;
1318
1328
  }
1319
1329
  case 166: {
1320
- return types_2.TransferStatus.BlockedTransaction;
1330
+ return types_3.TransferStatus.BlockedTransaction;
1321
1331
  }
1322
1332
  case 168: {
1323
- return types_2.TransferStatus.FundsLimitReached;
1333
+ return types_3.TransferStatus.FundsLimitReached;
1324
1334
  }
1325
1335
  case 169: {
1326
- return types_2.TransferStatus.PortfolioFailure;
1336
+ return types_3.TransferStatus.PortfolioFailure;
1327
1337
  }
1328
1338
  case 170: {
1329
- return types_2.TransferStatus.CustodianError;
1339
+ return types_3.TransferStatus.CustodianError;
1330
1340
  }
1331
1341
  case 171: {
1332
- return types_2.TransferStatus.ScopeClaimMissing;
1342
+ return types_3.TransferStatus.ScopeClaimMissing;
1333
1343
  }
1334
1344
  case 172: {
1335
- return types_2.TransferStatus.TransferRestrictionFailure;
1345
+ return types_3.TransferStatus.TransferRestrictionFailure;
1336
1346
  }
1337
1347
  case 80: {
1338
- return types_2.TransferStatus.Failure;
1348
+ return types_3.TransferStatus.Failure;
1339
1349
  }
1340
1350
  default: {
1341
1351
  throw new internal_1.PolymeshError({
1342
- code: types_2.ErrorCode.UnexpectedError,
1352
+ code: types_3.ErrorCode.UnexpectedError,
1343
1353
  message: `Unsupported status code "${status.toString()}". Please report this issue to the Polymesh team`,
1344
1354
  });
1345
1355
  }
@@ -1382,46 +1392,46 @@ function assetTypeToKnownOrId(assetType) {
1382
1392
  const type = 'NonFungible';
1383
1393
  const rawNftType = assetType.asNonFungible;
1384
1394
  if (rawNftType.isDerivative) {
1385
- return { type, value: types_2.KnownNftType.Derivative };
1395
+ return { type, value: types_3.KnownNftType.Derivative };
1386
1396
  }
1387
1397
  else if (rawNftType.isFixedIncome) {
1388
- return { type, value: types_2.KnownNftType.FixedIncome };
1398
+ return { type, value: types_3.KnownNftType.FixedIncome };
1389
1399
  }
1390
1400
  else if (rawNftType.isInvoice) {
1391
- return { type, value: types_2.KnownNftType.Invoice };
1401
+ return { type, value: types_3.KnownNftType.Invoice };
1392
1402
  }
1393
1403
  return { type, value: u32ToBigNumber(rawNftType.asCustom) };
1394
1404
  }
1395
1405
  const type = 'Fungible';
1396
1406
  if (assetType.isEquityCommon) {
1397
- return { type, value: types_2.KnownAssetType.EquityCommon };
1407
+ return { type, value: types_3.KnownAssetType.EquityCommon };
1398
1408
  }
1399
1409
  if (assetType.isEquityPreferred) {
1400
- return { type, value: types_2.KnownAssetType.EquityPreferred };
1410
+ return { type, value: types_3.KnownAssetType.EquityPreferred };
1401
1411
  }
1402
1412
  if (assetType.isCommodity) {
1403
- return { type, value: types_2.KnownAssetType.Commodity };
1413
+ return { type, value: types_3.KnownAssetType.Commodity };
1404
1414
  }
1405
1415
  if (assetType.isFixedIncome) {
1406
- return { type, value: types_2.KnownAssetType.FixedIncome };
1416
+ return { type, value: types_3.KnownAssetType.FixedIncome };
1407
1417
  }
1408
1418
  if (assetType.isReit) {
1409
- return { type, value: types_2.KnownAssetType.Reit };
1419
+ return { type, value: types_3.KnownAssetType.Reit };
1410
1420
  }
1411
1421
  if (assetType.isFund) {
1412
- return { type, value: types_2.KnownAssetType.Fund };
1422
+ return { type, value: types_3.KnownAssetType.Fund };
1413
1423
  }
1414
1424
  if (assetType.isRevenueShareAgreement) {
1415
- return { type, value: types_2.KnownAssetType.RevenueShareAgreement };
1425
+ return { type, value: types_3.KnownAssetType.RevenueShareAgreement };
1416
1426
  }
1417
1427
  if (assetType.isStructuredProduct) {
1418
- return { type, value: types_2.KnownAssetType.StructuredProduct };
1428
+ return { type, value: types_3.KnownAssetType.StructuredProduct };
1419
1429
  }
1420
1430
  if (assetType.isDerivative) {
1421
- return { type, value: types_2.KnownAssetType.Derivative };
1431
+ return { type, value: types_3.KnownAssetType.Derivative };
1422
1432
  }
1423
1433
  if (assetType.isStableCoin) {
1424
- return { type, value: types_2.KnownAssetType.StableCoin };
1434
+ return { type, value: types_3.KnownAssetType.StableCoin };
1425
1435
  }
1426
1436
  return { type, value: u32ToBigNumber(assetType.asCustom) };
1427
1437
  }
@@ -1442,7 +1452,7 @@ function nameToAssetName(value, context) {
1442
1452
  const nameMaxLength = u32ToBigNumber(assetNameMaxLength);
1443
1453
  if (nameMaxLength.lt(value.length)) {
1444
1454
  throw new internal_1.PolymeshError({
1445
- code: types_2.ErrorCode.ValidationError,
1455
+ code: types_3.ErrorCode.ValidationError,
1446
1456
  message: 'Asset name length exceeded',
1447
1457
  data: {
1448
1458
  maxLength: nameMaxLength,
@@ -1460,7 +1470,7 @@ function fundingRoundToAssetFundingRound(value, context) {
1460
1470
  const nameMaxLength = u32ToBigNumber(fundingRoundNameMaxLength);
1461
1471
  if (nameMaxLength.lt(value.length)) {
1462
1472
  throw new internal_1.PolymeshError({
1463
- code: types_2.ErrorCode.ValidationError,
1473
+ code: types_3.ErrorCode.ValidationError,
1464
1474
  message: 'Asset funding round name length exceeded',
1465
1475
  data: {
1466
1476
  maxLength: nameMaxLength,
@@ -1580,19 +1590,19 @@ function securityIdentifierToAssetIdentifier(identifier, context) {
1580
1590
  const { type, value } = identifier;
1581
1591
  let error = false;
1582
1592
  switch (type) {
1583
- case types_2.SecurityIdentifierType.Isin: {
1593
+ case types_3.SecurityIdentifierType.Isin: {
1584
1594
  if (!isIsinValid(value)) {
1585
1595
  error = true;
1586
1596
  }
1587
1597
  break;
1588
1598
  }
1589
- case types_2.SecurityIdentifierType.Lei: {
1599
+ case types_3.SecurityIdentifierType.Lei: {
1590
1600
  if (!isLeiValid(value)) {
1591
1601
  error = true;
1592
1602
  }
1593
1603
  break;
1594
1604
  }
1595
- case types_2.SecurityIdentifierType.Figi: {
1605
+ case types_3.SecurityIdentifierType.Figi: {
1596
1606
  if (!isFigiValid(value)) {
1597
1607
  error = true;
1598
1608
  }
@@ -1607,7 +1617,7 @@ function securityIdentifierToAssetIdentifier(identifier, context) {
1607
1617
  }
1608
1618
  if (error) {
1609
1619
  throw new internal_1.PolymeshError({
1610
- code: types_2.ErrorCode.ValidationError,
1620
+ code: types_3.ErrorCode.ValidationError,
1611
1621
  message: `Invalid security identifier ${value} of type ${type}`,
1612
1622
  });
1613
1623
  }
@@ -1620,30 +1630,30 @@ exports.securityIdentifierToAssetIdentifier = securityIdentifierToAssetIdentifie
1620
1630
  function assetIdentifierToSecurityIdentifier(identifier) {
1621
1631
  if (identifier.isCusip) {
1622
1632
  return {
1623
- type: types_2.SecurityIdentifierType.Cusip,
1633
+ type: types_3.SecurityIdentifierType.Cusip,
1624
1634
  value: (0, util_1.u8aToString)(identifier.asCusip),
1625
1635
  };
1626
1636
  }
1627
1637
  if (identifier.isIsin) {
1628
1638
  return {
1629
- type: types_2.SecurityIdentifierType.Isin,
1639
+ type: types_3.SecurityIdentifierType.Isin,
1630
1640
  value: (0, util_1.u8aToString)(identifier.asIsin),
1631
1641
  };
1632
1642
  }
1633
1643
  if (identifier.isCins) {
1634
1644
  return {
1635
- type: types_2.SecurityIdentifierType.Cins,
1645
+ type: types_3.SecurityIdentifierType.Cins,
1636
1646
  value: (0, util_1.u8aToString)(identifier.asCins),
1637
1647
  };
1638
1648
  }
1639
1649
  if (identifier.isFigi) {
1640
1650
  return {
1641
- type: types_2.SecurityIdentifierType.Figi,
1651
+ type: types_3.SecurityIdentifierType.Figi,
1642
1652
  value: (0, util_1.u8aToString)(identifier.asFigi),
1643
1653
  };
1644
1654
  }
1645
1655
  return {
1646
- type: types_2.SecurityIdentifierType.Lei,
1656
+ type: types_3.SecurityIdentifierType.Lei,
1647
1657
  value: (0, util_1.u8aToString)(identifier.asLei),
1648
1658
  };
1649
1659
  }
@@ -1657,7 +1667,7 @@ function stringToDocumentHash(docHash, context) {
1657
1667
  }
1658
1668
  if (!(0, util_1.isHex)(docHash, -1, true)) {
1659
1669
  throw new internal_1.PolymeshError({
1660
- code: types_2.ErrorCode.ValidationError,
1670
+ code: types_3.ErrorCode.ValidationError,
1661
1671
  message: 'Document hash must be a hexadecimal string prefixed by 0x',
1662
1672
  });
1663
1673
  }
@@ -1670,7 +1680,7 @@ function stringToDocumentHash(docHash, context) {
1670
1680
  const type = hashTypes.find(({ maxLength: max }) => length <= max);
1671
1681
  if (!type) {
1672
1682
  throw new internal_1.PolymeshError({
1673
- code: types_2.ErrorCode.ValidationError,
1683
+ code: types_3.ErrorCode.ValidationError,
1674
1684
  message: 'Document hash exceeds max length',
1675
1685
  });
1676
1686
  }
@@ -1767,11 +1777,11 @@ function scopeToMeshScope(scope, context) {
1767
1777
  let baseAsset;
1768
1778
  let scopeValue;
1769
1779
  switch (type) {
1770
- case types_2.ScopeType.Asset:
1780
+ case types_3.ScopeType.Asset:
1771
1781
  baseAsset = yield (0, internal_3.asBaseAsset)(value, context);
1772
1782
  scopeValue = assetToMeshAssetId(baseAsset, context);
1773
1783
  break;
1774
- case types_2.ScopeType.Identity:
1784
+ case types_3.ScopeType.Identity:
1775
1785
  scopeValue = stringToIdentityId(value, context);
1776
1786
  break;
1777
1787
  default:
@@ -1788,18 +1798,18 @@ exports.scopeToMeshScope = scopeToMeshScope;
1788
1798
  function meshScopeToScope(scope) {
1789
1799
  if (scope.isAsset) {
1790
1800
  return {
1791
- type: types_2.ScopeType.Asset,
1801
+ type: types_3.ScopeType.Asset,
1792
1802
  value: assetIdToString(scope.asAsset),
1793
1803
  };
1794
1804
  }
1795
1805
  if (scope.isIdentity) {
1796
1806
  return {
1797
- type: types_2.ScopeType.Identity,
1807
+ type: types_3.ScopeType.Identity,
1798
1808
  value: identityIdToString(scope.asIdentity),
1799
1809
  };
1800
1810
  }
1801
1811
  return {
1802
- type: types_2.ScopeType.Custom,
1812
+ type: types_3.ScopeType.Custom,
1803
1813
  value: (0, util_1.u8aToString)(scope.asCustom),
1804
1814
  };
1805
1815
  }
@@ -1825,16 +1835,16 @@ function claimToMeshClaim(claim, context) {
1825
1835
  return __awaiter(this, void 0, void 0, function* () {
1826
1836
  let value;
1827
1837
  switch (claim.type) {
1828
- case types_2.ClaimType.CustomerDueDiligence: {
1838
+ case types_3.ClaimType.CustomerDueDiligence: {
1829
1839
  value = stringToCddId(claim.id, context);
1830
1840
  break;
1831
1841
  }
1832
- case types_2.ClaimType.Jurisdiction: {
1842
+ case types_3.ClaimType.Jurisdiction: {
1833
1843
  const { code, scope } = claim;
1834
1844
  value = (0, utils_3.tuple)(code, yield scopeToMeshScope(scope, context));
1835
1845
  break;
1836
1846
  }
1837
- case types_2.ClaimType.Custom: {
1847
+ case types_3.ClaimType.Custom: {
1838
1848
  const { customClaimTypeId } = claim;
1839
1849
  if (claim.scope) {
1840
1850
  const { scope } = claim;
@@ -1861,7 +1871,7 @@ function middlewareScopeToScope(scope) {
1861
1871
  switch (type) {
1862
1872
  case typesV1_1.ClaimScopeTypeEnum.Asset:
1863
1873
  return {
1864
- type: types_2.ScopeType.Asset,
1874
+ type: types_3.ScopeType.Asset,
1865
1875
  value: (0, internal_3.getAssetIdFromMiddleware)({ id: assetId }),
1866
1876
  };
1867
1877
  case typesV1_1.ClaimScopeTypeEnum.Identity:
@@ -1872,7 +1882,7 @@ function middlewareScopeToScope(scope) {
1872
1882
  return;
1873
1883
  }
1874
1884
  throw new internal_1.PolymeshError({
1875
- code: types_2.ErrorCode.UnexpectedError,
1885
+ code: types_3.ErrorCode.UnexpectedError,
1876
1886
  message: 'Unsupported Scope Type. Please contact the Polymesh team',
1877
1887
  data: {
1878
1888
  scope,
@@ -1887,13 +1897,13 @@ function scopeToMiddlewareScope(scope, context) {
1887
1897
  return __awaiter(this, void 0, void 0, function* () {
1888
1898
  const { type, value } = scope;
1889
1899
  switch (type) {
1890
- case types_2.ScopeType.Asset:
1900
+ case types_3.ScopeType.Asset:
1891
1901
  return {
1892
1902
  type: typesV1_1.ClaimScopeTypeEnum.Asset,
1893
1903
  assetId: yield (0, internal_3.getAssetIdForMiddleware)(value, context),
1894
1904
  };
1895
- case types_2.ScopeType.Identity:
1896
- case types_2.ScopeType.Custom:
1905
+ case types_3.ScopeType.Identity:
1906
+ case types_3.ScopeType.Custom:
1897
1907
  return { type: typesV1_1.ClaimScopeTypeEnum[scope.type], value };
1898
1908
  }
1899
1909
  });
@@ -1920,64 +1930,64 @@ function meshClaimToClaim(claim) {
1920
1930
  if (type === 'Jurisdiction') {
1921
1931
  const [code, scope] = claim.asJurisdiction;
1922
1932
  return {
1923
- type: types_2.ClaimType.Jurisdiction,
1933
+ type: types_3.ClaimType.Jurisdiction,
1924
1934
  code: (0, utils_2.meshCountryCodeToCountryCode)(code),
1925
1935
  scope: meshScopeToScope(scope),
1926
1936
  };
1927
1937
  }
1928
1938
  if (type === 'Accredited') {
1929
1939
  return {
1930
- type: types_2.ClaimType.Accredited,
1940
+ type: types_3.ClaimType.Accredited,
1931
1941
  scope: meshScopeToScope(claim.asAccredited),
1932
1942
  };
1933
1943
  }
1934
1944
  if (type === 'Affiliate') {
1935
1945
  return {
1936
- type: types_2.ClaimType.Affiliate,
1946
+ type: types_3.ClaimType.Affiliate,
1937
1947
  scope: meshScopeToScope(claim.asAffiliate),
1938
1948
  };
1939
1949
  }
1940
1950
  if (type === 'BuyLockup') {
1941
1951
  return {
1942
- type: types_2.ClaimType.BuyLockup,
1952
+ type: types_3.ClaimType.BuyLockup,
1943
1953
  scope: meshScopeToScope(claim.asBuyLockup),
1944
1954
  };
1945
1955
  }
1946
1956
  if (type === 'SellLockup') {
1947
1957
  return {
1948
- type: types_2.ClaimType.SellLockup,
1958
+ type: types_3.ClaimType.SellLockup,
1949
1959
  scope: meshScopeToScope(claim.asSellLockup),
1950
1960
  };
1951
1961
  }
1952
1962
  if (type === 'CustomerDueDiligence') {
1953
1963
  return {
1954
- type: types_2.ClaimType.CustomerDueDiligence,
1964
+ type: types_3.ClaimType.CustomerDueDiligence,
1955
1965
  id: cddIdToString(claim.asCustomerDueDiligence),
1956
1966
  };
1957
1967
  }
1958
1968
  if (type === 'KnowYourCustomer') {
1959
1969
  return {
1960
- type: types_2.ClaimType.KnowYourCustomer,
1970
+ type: types_3.ClaimType.KnowYourCustomer,
1961
1971
  scope: meshScopeToScope(claim.asKnowYourCustomer),
1962
1972
  };
1963
1973
  }
1964
1974
  if (type === 'Exempted') {
1965
1975
  return {
1966
- type: types_2.ClaimType.Exempted,
1976
+ type: types_3.ClaimType.Exempted,
1967
1977
  scope: meshScopeToScope(claim.asExempted),
1968
1978
  };
1969
1979
  }
1970
1980
  if (type === 'Custom') {
1971
1981
  const [rawId, scope] = claim.asCustom;
1972
1982
  return {
1973
- type: types_2.ClaimType.Custom,
1983
+ type: types_3.ClaimType.Custom,
1974
1984
  scope: meshScopeToScope(scope.unwrapOrDefault()),
1975
1985
  customClaimTypeId: u32ToBigNumber(rawId),
1976
1986
  };
1977
1987
  }
1978
1988
  if (type === 'Blocked') {
1979
1989
  return {
1980
- type: types_2.ClaimType.Blocked,
1990
+ type: types_3.ClaimType.Blocked,
1981
1991
  scope: meshScopeToScope(claim.asBlocked),
1982
1992
  };
1983
1993
  }
@@ -1990,14 +2000,14 @@ exports.meshClaimToClaim = meshClaimToClaim;
1990
2000
  function statsClaimToStatClaimInputType(claim) {
1991
2001
  if (claim.isJurisdiction) {
1992
2002
  return {
1993
- type: types_2.ClaimType.Jurisdiction,
2003
+ type: types_3.ClaimType.Jurisdiction,
1994
2004
  };
1995
2005
  }
1996
2006
  else if (claim.isAccredited) {
1997
- return { type: types_2.ClaimType.Accredited };
2007
+ return { type: types_3.ClaimType.Accredited };
1998
2008
  }
1999
2009
  else {
2000
- return { type: types_2.ClaimType.Affiliate };
2010
+ return { type: types_3.ClaimType.Affiliate };
2001
2011
  }
2002
2012
  }
2003
2013
  exports.statsClaimToStatClaimInputType = statsClaimToStatClaimInputType;
@@ -2016,34 +2026,34 @@ exports.stringToTargetIdentity = stringToTargetIdentity;
2016
2026
  function meshClaimTypeToClaimType(claimType) {
2017
2027
  const type = claimType.type;
2018
2028
  if (type === 'Jurisdiction') {
2019
- return types_2.ClaimType.Jurisdiction;
2029
+ return types_3.ClaimType.Jurisdiction;
2020
2030
  }
2021
2031
  if (type === 'Accredited') {
2022
- return types_2.ClaimType.Accredited;
2032
+ return types_3.ClaimType.Accredited;
2023
2033
  }
2024
2034
  if (type === 'Affiliate') {
2025
- return types_2.ClaimType.Affiliate;
2035
+ return types_3.ClaimType.Affiliate;
2026
2036
  }
2027
2037
  if (type === 'BuyLockup') {
2028
- return types_2.ClaimType.BuyLockup;
2038
+ return types_3.ClaimType.BuyLockup;
2029
2039
  }
2030
2040
  if (type === 'SellLockup') {
2031
- return types_2.ClaimType.SellLockup;
2041
+ return types_3.ClaimType.SellLockup;
2032
2042
  }
2033
2043
  if (type === 'CustomerDueDiligence') {
2034
- return types_2.ClaimType.CustomerDueDiligence;
2044
+ return types_3.ClaimType.CustomerDueDiligence;
2035
2045
  }
2036
2046
  if (type === 'KnowYourCustomer') {
2037
- return types_2.ClaimType.KnowYourCustomer;
2047
+ return types_3.ClaimType.KnowYourCustomer;
2038
2048
  }
2039
2049
  if (type === 'Exempted') {
2040
- return types_2.ClaimType.Exempted;
2050
+ return types_3.ClaimType.Exempted;
2041
2051
  }
2042
2052
  if (type === 'Custom') {
2043
- return types_2.ClaimType.Custom;
2053
+ return types_3.ClaimType.Custom;
2044
2054
  }
2045
2055
  if (type === 'Blocked') {
2046
- return types_2.ClaimType.Blocked;
2056
+ return types_3.ClaimType.Blocked;
2047
2057
  }
2048
2058
  throw new utils_1.UnreachableCaseError(type);
2049
2059
  }
@@ -2107,7 +2117,7 @@ function requirementToComplianceRequirement(requirement, context) {
2107
2117
  }
2108
2118
  else {
2109
2119
  // IsExternalAgent does not exist as a condition type in Polymesh, it's SDK sugar
2110
- type = types_2.ConditionType.IsIdentity;
2120
+ type = types_3.ConditionType.IsIdentity;
2111
2121
  conditionContent = stringToTargetIdentity(null, context);
2112
2122
  }
2113
2123
  const { target, trustedClaimIssuers = [] } = condition;
@@ -2117,10 +2127,10 @@ function requirementToComplianceRequirement(requirement, context) {
2117
2127
  },
2118
2128
  issuers: trustedClaimIssuers.map(issuer => trustedClaimIssuerToTrustedIssuer(issuer, context)),
2119
2129
  });
2120
- if ([types_2.ConditionTarget.Both, types_2.ConditionTarget.Receiver].includes(target)) {
2130
+ if ([types_3.ConditionTarget.Both, types_3.ConditionTarget.Receiver].includes(target)) {
2121
2131
  receiverConditions.push(meshCondition);
2122
2132
  }
2123
- if ([types_2.ConditionTarget.Both, types_2.ConditionTarget.Sender].includes(target)) {
2133
+ if ([types_3.ConditionTarget.Both, types_3.ConditionTarget.Sender].includes(target)) {
2124
2134
  senderConditions.push(meshCondition);
2125
2135
  }
2126
2136
  }
@@ -2138,19 +2148,19 @@ exports.requirementToComplianceRequirement = requirementToComplianceRequirement;
2138
2148
  function meshConditionTypeToCondition(meshConditionType, context) {
2139
2149
  if (meshConditionType.isIsPresent) {
2140
2150
  return {
2141
- type: types_2.ConditionType.IsPresent,
2151
+ type: types_3.ConditionType.IsPresent,
2142
2152
  claim: meshClaimToClaim(meshConditionType.asIsPresent),
2143
2153
  };
2144
2154
  }
2145
2155
  if (meshConditionType.isIsAbsent) {
2146
2156
  return {
2147
- type: types_2.ConditionType.IsAbsent,
2157
+ type: types_3.ConditionType.IsAbsent,
2148
2158
  claim: meshClaimToClaim(meshConditionType.asIsAbsent),
2149
2159
  };
2150
2160
  }
2151
2161
  if (meshConditionType.isIsAnyOf) {
2152
2162
  return {
2153
- type: types_2.ConditionType.IsAnyOf,
2163
+ type: types_3.ConditionType.IsAnyOf,
2154
2164
  claims: meshConditionType.asIsAnyOf.map(claim => meshClaimToClaim(claim)),
2155
2165
  };
2156
2166
  }
@@ -2158,16 +2168,16 @@ function meshConditionTypeToCondition(meshConditionType, context) {
2158
2168
  const target = meshConditionType.asIsIdentity;
2159
2169
  if (target.isExternalAgent) {
2160
2170
  return {
2161
- type: types_2.ConditionType.IsExternalAgent,
2171
+ type: types_3.ConditionType.IsExternalAgent,
2162
2172
  };
2163
2173
  }
2164
2174
  return {
2165
- type: types_2.ConditionType.IsIdentity,
2175
+ type: types_3.ConditionType.IsIdentity,
2166
2176
  identity: new internal_1.Identity({ did: identityIdToString(target.asSpecific) }, context),
2167
2177
  };
2168
2178
  }
2169
2179
  return {
2170
- type: types_2.ConditionType.IsNoneOf,
2180
+ type: types_3.ConditionType.IsNoneOf,
2171
2181
  claims: meshConditionType.asIsNoneOf.map(claim => meshClaimToClaim(claim)),
2172
2182
  };
2173
2183
  }
@@ -2180,7 +2190,7 @@ function complianceRequirementResultToRequirementCompliance(complianceRequiremen
2180
2190
  const conditionCompliancesAreEqual = ({ condition: aCondition, complies: aComplies }, { condition: bCondition, complies: bComplies }) => (0, internal_3.conditionsAreEqual)(aCondition, bCondition) && aComplies === bComplies;
2181
2191
  complianceRequirement.senderConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
2182
2192
  const newCondition = {
2183
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2193
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2184
2194
  complies: boolToBoolean(result),
2185
2195
  };
2186
2196
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
@@ -2190,12 +2200,12 @@ function complianceRequirementResultToRequirementCompliance(complianceRequiremen
2190
2200
  });
2191
2201
  complianceRequirement.receiverConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
2192
2202
  const newCondition = {
2193
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2203
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2194
2204
  complies: boolToBoolean(result),
2195
2205
  };
2196
2206
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
2197
- if (existingCondition && existingCondition.condition.target === types_2.ConditionTarget.Sender) {
2198
- existingCondition.condition.target = types_2.ConditionTarget.Both;
2207
+ if (existingCondition && existingCondition.condition.target === types_3.ConditionTarget.Sender) {
2208
+ existingCondition.condition.target = types_3.ConditionTarget.Both;
2199
2209
  }
2200
2210
  else {
2201
2211
  conditions.push(newCondition);
@@ -2216,7 +2226,7 @@ function complianceRequirementReportToRequirementCompliance(complianceRequiremen
2216
2226
  const conditionCompliancesAreEqual = ({ condition: aCondition, complies: aComplies }, { condition: bCondition, complies: bComplies }) => (0, internal_3.conditionsAreEqual)(aCondition, bCondition) && aComplies === bComplies;
2217
2227
  complianceRequirement.senderConditions.forEach(({ condition: { conditionType, issuers }, satisfied }) => {
2218
2228
  const newCondition = {
2219
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2229
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2220
2230
  complies: boolToBoolean(satisfied),
2221
2231
  };
2222
2232
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
@@ -2226,12 +2236,12 @@ function complianceRequirementReportToRequirementCompliance(complianceRequiremen
2226
2236
  });
2227
2237
  complianceRequirement.receiverConditions.forEach(({ condition: { conditionType, issuers }, satisfied }) => {
2228
2238
  const newCondition = {
2229
- condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2239
+ condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
2230
2240
  complies: boolToBoolean(satisfied),
2231
2241
  };
2232
2242
  const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
2233
- if (existingCondition && existingCondition.condition.target === types_2.ConditionTarget.Sender) {
2234
- existingCondition.condition.target = types_2.ConditionTarget.Both;
2243
+ if (existingCondition && existingCondition.condition.target === types_3.ConditionTarget.Sender) {
2244
+ existingCondition.condition.target = types_3.ConditionTarget.Both;
2235
2245
  }
2236
2246
  else {
2237
2247
  conditions.push(newCondition);
@@ -2250,7 +2260,7 @@ exports.complianceRequirementReportToRequirementCompliance = complianceRequireme
2250
2260
  function complianceRequirementToRequirement(complianceRequirement, context) {
2251
2261
  const conditions = [];
2252
2262
  complianceRequirement.senderConditions.forEach(({ conditionType, issuers }) => {
2253
- const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Sender });
2263
+ const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Sender });
2254
2264
  if (issuers.length) {
2255
2265
  newCondition.trustedClaimIssuers = issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context));
2256
2266
  }
@@ -2260,13 +2270,13 @@ function complianceRequirementToRequirement(complianceRequirement, context) {
2260
2270
  }
2261
2271
  });
2262
2272
  complianceRequirement.receiverConditions.forEach(({ conditionType, issuers }) => {
2263
- const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_2.ConditionTarget.Receiver });
2273
+ const newCondition = Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Receiver });
2264
2274
  if (issuers.length) {
2265
2275
  newCondition.trustedClaimIssuers = issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context));
2266
2276
  }
2267
2277
  const existingCondition = conditions.find(condition => (0, internal_3.conditionsAreEqual)(condition, newCondition));
2268
- if (existingCondition && existingCondition.target === types_2.ConditionTarget.Sender) {
2269
- existingCondition.target = types_2.ConditionTarget.Both;
2278
+ if (existingCondition && existingCondition.target === types_3.ConditionTarget.Sender) {
2279
+ existingCondition.target = types_3.ConditionTarget.Both;
2270
2280
  }
2271
2281
  else {
2272
2282
  conditions.push(newCondition);
@@ -2283,26 +2293,26 @@ exports.complianceRequirementToRequirement = complianceRequirementToRequirement;
2283
2293
  */
2284
2294
  function txTagToProtocolOp(tag, context) {
2285
2295
  const protocolOpTags = [
2286
- types_2.TxTags.asset.RegisterUniqueTicker,
2287
- types_2.TxTags.asset.RegisterUniqueTicker,
2288
- types_2.TxTags.asset.Issue,
2289
- types_2.TxTags.asset.AddDocuments,
2290
- types_2.TxTags.asset.CreateAsset,
2291
- types_2.TxTags.capitalDistribution.Distribute,
2292
- types_2.TxTags.checkpoint.CreateSchedule,
2293
- types_2.TxTags.complianceManager.AddComplianceRequirement,
2294
- types_2.TxTags.identity.CddRegisterDid,
2295
- types_2.TxTags.identity.AddClaim,
2296
- types_2.TxTags.identity.AddSecondaryKeysWithAuthorization,
2297
- types_2.TxTags.pips.Propose,
2298
- types_2.TxTags.corporateBallot.AttachBallot,
2299
- types_2.TxTags.capitalDistribution.Distribute,
2296
+ types_3.TxTags.asset.RegisterUniqueTicker,
2297
+ types_3.TxTags.asset.RegisterUniqueTicker,
2298
+ types_3.TxTags.asset.Issue,
2299
+ types_3.TxTags.asset.AddDocuments,
2300
+ types_3.TxTags.asset.CreateAsset,
2301
+ types_3.TxTags.capitalDistribution.Distribute,
2302
+ types_3.TxTags.checkpoint.CreateSchedule,
2303
+ types_3.TxTags.complianceManager.AddComplianceRequirement,
2304
+ types_3.TxTags.identity.CddRegisterDid,
2305
+ types_3.TxTags.identity.AddClaim,
2306
+ types_3.TxTags.identity.AddSecondaryKeysWithAuthorization,
2307
+ types_3.TxTags.pips.Propose,
2308
+ types_3.TxTags.corporateBallot.AttachBallot,
2309
+ types_3.TxTags.capitalDistribution.Distribute,
2300
2310
  ];
2301
2311
  const [moduleName, extrinsicName] = tag.split('.');
2302
2312
  const value = `${(0, util_1.stringUpperFirst)(moduleName)}${(0, util_1.stringUpperFirst)(extrinsicName)}`;
2303
2313
  if (!(0, lodash_1.includes)(protocolOpTags, tag)) {
2304
2314
  throw new internal_1.PolymeshError({
2305
- code: types_2.ErrorCode.ValidationError,
2315
+ code: types_3.ErrorCode.ValidationError,
2306
2316
  message: `${value} does not match any PolymeshCommonUtilitiesProtocolFeeProtocolOp`,
2307
2317
  });
2308
2318
  }
@@ -2315,7 +2325,7 @@ exports.txTagToProtocolOp = txTagToProtocolOp;
2315
2325
  function extrinsicIdentifierToTxTag(extrinsicIdentifier) {
2316
2326
  const { moduleId, callId } = extrinsicIdentifier;
2317
2327
  let moduleName;
2318
- for (const txTagItem in types_2.TxTags) {
2328
+ for (const txTagItem in types_3.TxTags) {
2319
2329
  if (txTagItem.toLowerCase() === moduleId) {
2320
2330
  moduleName = txTagItem;
2321
2331
  }
@@ -2427,15 +2437,15 @@ exports.secondaryAccountToMeshSecondaryKey = secondaryAccountToMeshSecondaryKey;
2427
2437
  */
2428
2438
  function meshVenueTypeToVenueType(type) {
2429
2439
  if (type.isOther) {
2430
- return types_2.VenueType.Other;
2440
+ return types_3.VenueType.Other;
2431
2441
  }
2432
2442
  if (type.isDistribution) {
2433
- return types_2.VenueType.Distribution;
2443
+ return types_3.VenueType.Distribution;
2434
2444
  }
2435
2445
  if (type.isSto) {
2436
- return types_2.VenueType.Sto;
2446
+ return types_3.VenueType.Sto;
2437
2447
  }
2438
- return types_2.VenueType.Exchange;
2448
+ return types_3.VenueType.Exchange;
2439
2449
  }
2440
2450
  exports.meshVenueTypeToVenueType = meshVenueTypeToVenueType;
2441
2451
  /**
@@ -2469,12 +2479,12 @@ exports.meshInstructionStatusToInstructionStatus = meshInstructionStatusToInstru
2469
2479
  */
2470
2480
  function meshAffirmationStatusToAffirmationStatus(status) {
2471
2481
  if (status.isUnknown) {
2472
- return types_2.AffirmationStatus.Unknown;
2482
+ return types_3.AffirmationStatus.Unknown;
2473
2483
  }
2474
2484
  if (status.isPending) {
2475
- return types_2.AffirmationStatus.Pending;
2485
+ return types_3.AffirmationStatus.Pending;
2476
2486
  }
2477
- return types_2.AffirmationStatus.Affirmed;
2487
+ return types_3.AffirmationStatus.Affirmed;
2478
2488
  }
2479
2489
  exports.meshAffirmationStatusToAffirmationStatus = meshAffirmationStatusToAffirmationStatus;
2480
2490
  /**
@@ -2482,15 +2492,15 @@ exports.meshAffirmationStatusToAffirmationStatus = meshAffirmationStatusToAffirm
2482
2492
  */
2483
2493
  function meshSettlementTypeToEndCondition(type) {
2484
2494
  if (type.isSettleOnBlock) {
2485
- return { type: types_2.InstructionType.SettleOnBlock, endBlock: u32ToBigNumber(type.asSettleOnBlock) };
2495
+ return { type: types_3.InstructionType.SettleOnBlock, endBlock: u32ToBigNumber(type.asSettleOnBlock) };
2486
2496
  }
2487
2497
  if (type.isSettleManual) {
2488
2498
  return {
2489
- type: types_2.InstructionType.SettleManual,
2499
+ type: types_3.InstructionType.SettleManual,
2490
2500
  endAfterBlock: u32ToBigNumber(type.asSettleManual),
2491
2501
  };
2492
2502
  }
2493
- return { type: types_2.InstructionType.SettleOnAffirmation };
2503
+ return { type: types_3.InstructionType.SettleOnAffirmation };
2494
2504
  }
2495
2505
  exports.meshSettlementTypeToEndCondition = meshSettlementTypeToEndCondition;
2496
2506
  /**
@@ -2500,16 +2510,16 @@ function endConditionToSettlementType(endCondition, context) {
2500
2510
  let value;
2501
2511
  const { type } = endCondition;
2502
2512
  switch (type) {
2503
- case types_2.InstructionType.SettleOnBlock:
2504
- value = { [types_2.InstructionType.SettleOnBlock]: bigNumberToU32(endCondition.endBlock, context) };
2513
+ case types_3.InstructionType.SettleOnBlock:
2514
+ value = { [types_3.InstructionType.SettleOnBlock]: bigNumberToU32(endCondition.endBlock, context) };
2505
2515
  break;
2506
- case types_2.InstructionType.SettleManual:
2516
+ case types_3.InstructionType.SettleManual:
2507
2517
  value = {
2508
- [types_2.InstructionType.SettleManual]: bigNumberToU32(endCondition.endAfterBlock, context),
2518
+ [types_3.InstructionType.SettleManual]: bigNumberToU32(endCondition.endAfterBlock, context),
2509
2519
  };
2510
2520
  break;
2511
2521
  default:
2512
- value = types_2.InstructionType.SettleOnAffirmation;
2522
+ value = types_3.InstructionType.SettleOnAffirmation;
2513
2523
  }
2514
2524
  return context.createType('PolymeshPrimitivesSettlementSettlementType', value);
2515
2525
  }
@@ -2612,30 +2622,30 @@ function transferRestrictionToPolymeshTransferCondition(restriction, context) {
2612
2622
  let restrictionType;
2613
2623
  let restrictionValue;
2614
2624
  const extractClaimValue = (claim) => {
2615
- if (claim.type === types_2.ClaimType.Accredited) {
2625
+ if (claim.type === types_3.ClaimType.Accredited) {
2616
2626
  return booleanToBool(claim.accredited, context);
2617
2627
  }
2618
- else if (claim.type === types_2.ClaimType.Affiliate) {
2628
+ else if (claim.type === types_3.ClaimType.Affiliate) {
2619
2629
  return booleanToBool(claim.affiliate, context);
2620
2630
  }
2621
2631
  else {
2622
2632
  return (0, internal_3.optionize)(utils_2.countryCodeToMeshCountryCode)(claim.countryCode, context);
2623
2633
  }
2624
2634
  };
2625
- if (type === types_2.TransferRestrictionType.Count) {
2635
+ if (type === types_3.TransferRestrictionType.Count) {
2626
2636
  restrictionType = 'MaxInvestorCount';
2627
2637
  restrictionValue = bigNumberToU64(value, context);
2628
2638
  }
2629
- else if (type === types_2.TransferRestrictionType.Percentage) {
2639
+ else if (type === types_3.TransferRestrictionType.Percentage) {
2630
2640
  restrictionType = 'MaxInvestorOwnership';
2631
2641
  restrictionValue = percentageToPermill(value, context);
2632
2642
  }
2633
- else if (type === types_2.TransferRestrictionType.ClaimCount ||
2634
- type === types_2.TransferRestrictionType.ClaimPercentage) {
2643
+ else if (type === types_3.TransferRestrictionType.ClaimCount ||
2644
+ type === types_3.TransferRestrictionType.ClaimPercentage) {
2635
2645
  let rawMin;
2636
2646
  let rawMax;
2637
2647
  const { min, max, claim, issuer } = value;
2638
- if (type === types_2.TransferRestrictionType.ClaimCount) {
2648
+ if (type === types_3.TransferRestrictionType.ClaimCount) {
2639
2649
  restrictionType = 'ClaimCount';
2640
2650
  rawMin = bigNumberToU64(min, context);
2641
2651
  rawMax = (0, internal_3.optionize)(bigNumberToU64)(max, context);
@@ -2655,7 +2665,7 @@ function transferRestrictionToPolymeshTransferCondition(restriction, context) {
2655
2665
  }
2656
2666
  else {
2657
2667
  throw new internal_1.PolymeshError({
2658
- code: types_2.ErrorCode.UnexpectedError,
2668
+ code: types_3.ErrorCode.UnexpectedError,
2659
2669
  message: `Unexpected transfer restriction type: "${type}". Please report this to the Polymesh team`,
2660
2670
  });
2661
2671
  }
@@ -2692,31 +2702,31 @@ exports.identitiesSetToIdentities = identitiesSetToIdentities;
2692
2702
  function transferConditionToTransferRestriction(transferCondition, context) {
2693
2703
  if (transferCondition.isMaxInvestorCount) {
2694
2704
  return {
2695
- type: types_2.TransferRestrictionType.Count,
2705
+ type: types_3.TransferRestrictionType.Count,
2696
2706
  value: u64ToBigNumber(transferCondition.asMaxInvestorCount),
2697
2707
  };
2698
2708
  }
2699
2709
  else if (transferCondition.isMaxInvestorOwnership) {
2700
2710
  return {
2701
- type: types_2.TransferRestrictionType.Percentage,
2711
+ type: types_3.TransferRestrictionType.Percentage,
2702
2712
  value: permillToBigNumber(transferCondition.asMaxInvestorOwnership),
2703
2713
  };
2704
2714
  }
2705
2715
  else if (transferCondition.isClaimCount) {
2706
2716
  return {
2707
- type: types_2.TransferRestrictionType.ClaimCount,
2717
+ type: types_3.TransferRestrictionType.ClaimCount,
2708
2718
  value: claimCountToClaimCountRestrictionValue(transferCondition.asClaimCount, context),
2709
2719
  };
2710
2720
  }
2711
2721
  else if (transferCondition.isClaimOwnership) {
2712
2722
  return {
2713
- type: types_2.TransferRestrictionType.ClaimPercentage,
2723
+ type: types_3.TransferRestrictionType.ClaimPercentage,
2714
2724
  value: claimPercentageToClaimPercentageRestrictionValue(transferCondition.asClaimOwnership, context),
2715
2725
  };
2716
2726
  }
2717
2727
  else {
2718
2728
  throw new internal_1.PolymeshError({
2719
- code: types_2.ErrorCode.FatalError,
2729
+ code: types_3.ErrorCode.FatalError,
2720
2730
  message: 'Unexpected transfer condition type',
2721
2731
  });
2722
2732
  }
@@ -2728,20 +2738,20 @@ exports.transferConditionToTransferRestriction = transferConditionToTransferRest
2728
2738
  function assetDispatchErrorToTransferError(error, context) {
2729
2739
  const { asset: assetErrors, portfolio: portfolioErrors, statistics: statisticsError, } = context.polymeshApi.errors;
2730
2740
  const record = [
2731
- [assetErrors.NoSuchAsset, types_2.TransferError.AssetDoesNotExists],
2732
- [assetErrors.InvalidGranularity, types_2.TransferError.InvalidGranularity],
2733
- [assetErrors.SenderSameAsReceiver, types_2.TransferError.SelfTransfer],
2734
- [portfolioErrors.InvalidTransferSenderIdMatchesReceiverId, types_2.TransferError.SelfTransfer],
2735
- [assetErrors.BalanceOverflow, types_2.TransferError.BalanceOverflow],
2736
- [assetErrors.InvalidTransferInvalidReceiverCDD, types_2.TransferError.InvalidReceiverCdd],
2737
- [assetErrors.InvalidTransferInvalidSenderCDD, types_2.TransferError.InvalidSenderCdd],
2738
- [assetErrors.InsufficientBalance, types_2.TransferError.InsufficientBalance],
2739
- [assetErrors.InvalidTransferFrozenAsset, types_2.TransferError.TransfersFrozen],
2740
- [portfolioErrors.PortfolioDoesNotExist, types_2.TransferError.InvalidSenderPortfolio],
2741
- [portfolioErrors.InsufficientPortfolioBalance, types_2.TransferError.InsufficientPortfolioBalance],
2742
- [assetErrors.InvalidTransferComplianceFailure, types_2.TransferError.ComplianceFailure],
2743
- [assetErrors.InvalidTransfer, types_2.TransferError.ComplianceFailure],
2744
- [statisticsError.InvalidTransferStatisticsFailure, types_2.TransferError.TransferNotAllowed],
2741
+ [assetErrors.NoSuchAsset, types_3.TransferError.AssetDoesNotExists],
2742
+ [assetErrors.InvalidGranularity, types_3.TransferError.InvalidGranularity],
2743
+ [assetErrors.SenderSameAsReceiver, types_3.TransferError.SelfTransfer],
2744
+ [portfolioErrors.InvalidTransferSenderIdMatchesReceiverId, types_3.TransferError.SelfTransfer],
2745
+ [assetErrors.BalanceOverflow, types_3.TransferError.BalanceOverflow],
2746
+ [assetErrors.InvalidTransferInvalidReceiverCDD, types_3.TransferError.InvalidReceiverCdd],
2747
+ [assetErrors.InvalidTransferInvalidSenderCDD, types_3.TransferError.InvalidSenderCdd],
2748
+ [assetErrors.InsufficientBalance, types_3.TransferError.InsufficientBalance],
2749
+ [assetErrors.InvalidTransferFrozenAsset, types_3.TransferError.TransfersFrozen],
2750
+ [portfolioErrors.PortfolioDoesNotExist, types_3.TransferError.InvalidSenderPortfolio],
2751
+ [portfolioErrors.InsufficientPortfolioBalance, types_3.TransferError.InsufficientPortfolioBalance],
2752
+ [assetErrors.InvalidTransferComplianceFailure, types_3.TransferError.ComplianceFailure],
2753
+ [assetErrors.InvalidTransfer, types_3.TransferError.ComplianceFailure],
2754
+ [statisticsError.InvalidTransferStatisticsFailure, types_3.TransferError.TransferNotAllowed],
2745
2755
  ];
2746
2756
  if (error.isModule) {
2747
2757
  const moduleErr = error.asModule;
@@ -2751,7 +2761,7 @@ function assetDispatchErrorToTransferError(error, context) {
2751
2761
  }
2752
2762
  }
2753
2763
  throw new internal_1.PolymeshError({
2754
- code: types_2.ErrorCode.UnexpectedError,
2764
+ code: types_3.ErrorCode.UnexpectedError,
2755
2765
  message: 'Received unknown Asset can transfer status',
2756
2766
  });
2757
2767
  }
@@ -2764,20 +2774,20 @@ function nftDispatchErrorToTransferError(error, context) {
2764
2774
  if (error.isModule) {
2765
2775
  const moduleErr = error.asModule;
2766
2776
  if ([notOwnedErr, notFoundErr, insufficientErr, duplicateErr, nftLockedErr].some(err => err.is(moduleErr))) {
2767
- return types_2.TransferError.InsufficientPortfolioBalance;
2777
+ return types_3.TransferError.InsufficientPortfolioBalance;
2768
2778
  }
2769
2779
  else if (frozenErr.is(moduleErr)) {
2770
- return types_2.TransferError.TransfersFrozen;
2780
+ return types_3.TransferError.TransfersFrozen;
2771
2781
  }
2772
2782
  else if (complianceErr.is(moduleErr)) {
2773
- return types_2.TransferError.ComplianceFailure;
2783
+ return types_3.TransferError.ComplianceFailure;
2774
2784
  }
2775
2785
  else if (samePortfolioErr.is(moduleErr)) {
2776
- return types_2.TransferError.SelfTransfer;
2786
+ return types_3.TransferError.SelfTransfer;
2777
2787
  }
2778
2788
  }
2779
2789
  throw new internal_1.PolymeshError({
2780
- code: types_2.ErrorCode.UnexpectedError,
2790
+ code: types_3.ErrorCode.UnexpectedError,
2781
2791
  message: 'Received unknown NFT can transfer status',
2782
2792
  });
2783
2793
  }
@@ -2789,31 +2799,31 @@ function granularCanTransferResultToTransferBreakdown(result, validateNftResult,
2789
2799
  const { invalid_granularity: invalidGranularity, self_transfer: selfTransfer, invalid_receiver_cdd: invalidReceiverCdd, invalid_sender_cdd: invalidSenderCdd, 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;
2790
2800
  const general = [];
2791
2801
  if (boolToBoolean(invalidGranularity)) {
2792
- general.push(types_2.TransferError.InvalidGranularity);
2802
+ general.push(types_3.TransferError.InvalidGranularity);
2793
2803
  }
2794
2804
  if (boolToBoolean(selfTransfer)) {
2795
- general.push(types_2.TransferError.SelfTransfer);
2805
+ general.push(types_3.TransferError.SelfTransfer);
2796
2806
  }
2797
2807
  if (boolToBoolean(invalidReceiverCdd)) {
2798
- general.push(types_2.TransferError.InvalidReceiverCdd);
2808
+ general.push(types_3.TransferError.InvalidReceiverCdd);
2799
2809
  }
2800
2810
  if (boolToBoolean(invalidSenderCdd)) {
2801
- general.push(types_2.TransferError.InvalidSenderCdd);
2811
+ general.push(types_3.TransferError.InvalidSenderCdd);
2802
2812
  }
2803
2813
  if (boolToBoolean(insufficientBalance)) {
2804
- general.push(types_2.TransferError.InsufficientBalance);
2814
+ general.push(types_3.TransferError.InsufficientBalance);
2805
2815
  }
2806
2816
  if (boolToBoolean(assetFrozen)) {
2807
- general.push(types_2.TransferError.TransfersFrozen);
2817
+ general.push(types_3.TransferError.TransfersFrozen);
2808
2818
  }
2809
2819
  if (boolToBoolean(senderPortfolioNotExists)) {
2810
- general.push(types_2.TransferError.InvalidSenderPortfolio);
2820
+ general.push(types_3.TransferError.InvalidSenderPortfolio);
2811
2821
  }
2812
2822
  if (boolToBoolean(receiverPortfolioNotExists)) {
2813
- general.push(types_2.TransferError.InvalidReceiverPortfolio);
2823
+ general.push(types_3.TransferError.InvalidReceiverPortfolio);
2814
2824
  }
2815
2825
  if (boolToBoolean(senderInsufficientBalance)) {
2816
- general.push(types_2.TransferError.InsufficientPortfolioBalance);
2826
+ general.push(types_3.TransferError.InsufficientPortfolioBalance);
2817
2827
  }
2818
2828
  const restrictions = transferConditionResult.map(({ condition, result: tmResult }) => {
2819
2829
  return {
@@ -2888,16 +2898,16 @@ exports.offeringTierToPriceTier = offeringTierToPriceTier;
2888
2898
  function permissionsLikeToPermissions(permissionsLike, context) {
2889
2899
  let assetPermissions = {
2890
2900
  values: [],
2891
- type: types_2.PermissionType.Include,
2901
+ type: types_3.PermissionType.Include,
2892
2902
  };
2893
2903
  let transactionPermissions = {
2894
2904
  values: [],
2895
- type: types_2.PermissionType.Include,
2905
+ type: types_3.PermissionType.Include,
2896
2906
  };
2897
2907
  let transactionGroupPermissions = [];
2898
2908
  let portfolioPermissions = {
2899
2909
  values: [],
2900
- type: types_2.PermissionType.Include,
2910
+ type: types_3.PermissionType.Include,
2901
2911
  };
2902
2912
  let transactions;
2903
2913
  let transactionGroups;
@@ -2982,29 +2992,29 @@ function fundraiserToOfferingDetails(fundraiser, name, context) {
2982
2992
  const isStarted = now > start;
2983
2993
  const isExpired = end && now > end;
2984
2994
  const minInvestment = balanceToBigNumber(rawMinInvestment);
2985
- let timing = types_2.OfferingTimingStatus.NotStarted;
2986
- let balance = types_2.OfferingBalanceStatus.Available;
2987
- let sale = types_2.OfferingSaleStatus.Live;
2995
+ let timing = types_3.OfferingTimingStatus.NotStarted;
2996
+ let balance = types_3.OfferingBalanceStatus.Available;
2997
+ let sale = types_3.OfferingSaleStatus.Live;
2988
2998
  if (isExpired) {
2989
- timing = types_2.OfferingTimingStatus.Expired;
2999
+ timing = types_3.OfferingTimingStatus.Expired;
2990
3000
  }
2991
3001
  else if (isStarted) {
2992
- timing = types_2.OfferingTimingStatus.Started;
3002
+ timing = types_3.OfferingTimingStatus.Started;
2993
3003
  }
2994
3004
  if (totalRemainingValue.isZero()) {
2995
- balance = types_2.OfferingBalanceStatus.SoldOut;
3005
+ balance = types_3.OfferingBalanceStatus.SoldOut;
2996
3006
  }
2997
3007
  else if (totalRemainingValue.lt(minInvestment)) {
2998
- balance = types_2.OfferingBalanceStatus.Residual;
3008
+ balance = types_3.OfferingBalanceStatus.Residual;
2999
3009
  }
3000
3010
  if (rawStatus.isClosedEarly) {
3001
- sale = types_2.OfferingSaleStatus.ClosedEarly;
3011
+ sale = types_3.OfferingSaleStatus.ClosedEarly;
3002
3012
  }
3003
3013
  else if (rawStatus.isClosed) {
3004
- sale = types_2.OfferingSaleStatus.Closed;
3014
+ sale = types_3.OfferingSaleStatus.Closed;
3005
3015
  }
3006
3016
  else if (rawStatus.isFrozen) {
3007
- sale = types_2.OfferingSaleStatus.Frozen;
3017
+ sale = types_3.OfferingSaleStatus.Frozen;
3008
3018
  }
3009
3019
  return {
3010
3020
  creator: new internal_1.Identity({ did: identityIdToString(creator) }, context),
@@ -3034,23 +3044,23 @@ function meshCorporateActionToCorporateActionParams(corporateAction, details, co
3034
3044
  const { kind: rawKind, declDate, targets: { identities, treatment }, defaultWithholdingTax, withholdingTax, } = corporateAction;
3035
3045
  let kind;
3036
3046
  if (rawKind.isIssuerNotice) {
3037
- kind = types_2.CorporateActionKind.IssuerNotice;
3047
+ kind = types_3.CorporateActionKind.IssuerNotice;
3038
3048
  }
3039
3049
  else if (rawKind.isPredictableBenefit) {
3040
- kind = types_2.CorporateActionKind.PredictableBenefit;
3050
+ kind = types_3.CorporateActionKind.PredictableBenefit;
3041
3051
  }
3042
3052
  else if (rawKind.isUnpredictableBenefit) {
3043
- kind = types_2.CorporateActionKind.UnpredictableBenefit;
3053
+ kind = types_3.CorporateActionKind.UnpredictableBenefit;
3044
3054
  }
3045
3055
  else if (rawKind.isReorganization) {
3046
- kind = types_2.CorporateActionKind.Reorganization;
3056
+ kind = types_3.CorporateActionKind.Reorganization;
3047
3057
  }
3048
3058
  else {
3049
- kind = types_2.CorporateActionKind.Other;
3059
+ kind = types_3.CorporateActionKind.Other;
3050
3060
  }
3051
3061
  const targets = {
3052
3062
  identities: identities.map(identityId => new internal_1.Identity({ did: identityIdToString(identityId) }, context)),
3053
- treatment: treatment.isExclude ? types_2.TargetTreatment.Exclude : types_2.TargetTreatment.Include,
3063
+ treatment: treatment.isExclude ? types_3.TargetTreatment.Exclude : types_3.TargetTreatment.Include,
3054
3064
  };
3055
3065
  const taxWithholdings = withholdingTax.map(([identityId, tax]) => ({
3056
3066
  identity: new internal_1.Identity({ did: identityIdToString(identityId) }, context),
@@ -3077,6 +3087,9 @@ exports.corporateActionKindToCaKind = corporateActionKindToCaKind;
3077
3087
  * @hidden
3078
3088
  */
3079
3089
  function checkpointToRecordDateSpec(checkpoint, context) {
3090
+ if (checkpoint === null) {
3091
+ return null;
3092
+ }
3080
3093
  let value;
3081
3094
  if (checkpoint instanceof internal_1.Checkpoint) {
3082
3095
  /* eslint-disable @typescript-eslint/naming-convention */
@@ -3099,7 +3112,7 @@ function targetIdentitiesToCorporateActionTargets(targetIdentities, context) {
3099
3112
  const { identities, treatment } = targetIdentities;
3100
3113
  return {
3101
3114
  identities: identities.map(identity => new internal_1.Identity({ did: identityIdToString(identity) }, context)),
3102
- treatment: treatment.isInclude ? types_2.TargetTreatment.Include : types_2.TargetTreatment.Exclude,
3115
+ treatment: treatment.isInclude ? types_3.TargetTreatment.Include : types_3.TargetTreatment.Exclude,
3103
3116
  };
3104
3117
  }
3105
3118
  exports.targetIdentitiesToCorporateActionTargets = targetIdentitiesToCorporateActionTargets;
@@ -3112,7 +3125,7 @@ function targetsToTargetIdentities(targets, context) {
3112
3125
  const maxTargets = u32ToBigNumber(maxTargetIds);
3113
3126
  if (maxTargets.lt(targets.identities.length)) {
3114
3127
  throw new internal_1.PolymeshError({
3115
- code: types_2.ErrorCode.ValidationError,
3128
+ code: types_3.ErrorCode.ValidationError,
3116
3129
  message: 'Too many target Identities',
3117
3130
  data: {
3118
3131
  maxTargets,
@@ -3255,17 +3268,17 @@ function meshStatToStatType(rawStat) {
3255
3268
  const type = rawStat.operationType.type;
3256
3269
  if (claimIssuer.isNone) {
3257
3270
  if (type === 'Count') {
3258
- return types_2.StatType.Count;
3271
+ return types_3.StatType.Count;
3259
3272
  }
3260
3273
  else {
3261
- return types_2.StatType.Balance;
3274
+ return types_3.StatType.Balance;
3262
3275
  }
3263
3276
  }
3264
3277
  if (type === 'Count') {
3265
- return types_2.StatType.ScopedCount;
3278
+ return types_3.StatType.ScopedCount;
3266
3279
  }
3267
3280
  else {
3268
- return types_2.StatType.ScopedBalance;
3281
+ return types_3.StatType.ScopedBalance;
3269
3282
  }
3270
3283
  }
3271
3284
  exports.meshStatToStatType = meshStatToStatType;
@@ -3273,20 +3286,20 @@ exports.meshStatToStatType = meshStatToStatType;
3273
3286
  * @hidden
3274
3287
  */
3275
3288
  function statTypeToStatOpType(type, context) {
3276
- if (type === types_2.StatType.Count || type === types_2.StatType.ScopedCount) {
3277
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Count);
3289
+ if (type === types_3.StatType.Count || type === types_3.StatType.ScopedCount) {
3290
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_3.StatType.Count);
3278
3291
  }
3279
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Balance);
3292
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_3.StatType.Balance);
3280
3293
  }
3281
3294
  exports.statTypeToStatOpType = statTypeToStatOpType;
3282
3295
  /**
3283
3296
  * @hidden
3284
3297
  */
3285
3298
  function transferRestrictionTypeToStatOpType(type, context) {
3286
- if (type === types_2.TransferRestrictionType.Count || type === types_2.TransferRestrictionType.ClaimCount) {
3287
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Count);
3299
+ if (type === types_3.TransferRestrictionType.Count || type === types_3.TransferRestrictionType.ClaimCount) {
3300
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_3.StatType.Count);
3288
3301
  }
3289
- return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_2.StatType.Balance);
3302
+ return context.createType('PolymeshPrimitivesStatisticsStatOpType', types_3.StatType.Balance);
3290
3303
  }
3291
3304
  exports.transferRestrictionTypeToStatOpType = transferRestrictionTypeToStatOpType;
3292
3305
  /**
@@ -3361,7 +3374,7 @@ function sortTransferRestrictionByClaimValue(conditions) {
3361
3374
  }
3362
3375
  const aCode = (0, utils_2.meshCountryCodeToCountryCode)(aClaim.unwrap());
3363
3376
  const bCode = (0, utils_2.meshCountryCodeToCountryCode)(bClaim.unwrap());
3364
- const countryOrder = Object.values(types_2.CountryCode);
3377
+ const countryOrder = Object.values(types_3.CountryCode);
3365
3378
  return countryOrder.indexOf(aCode) - countryOrder.indexOf(bCode);
3366
3379
  });
3367
3380
  }
@@ -3387,7 +3400,7 @@ exports.toExemptKey = toExemptKey;
3387
3400
  function claimCountStatInputToStatUpdates(args, context) {
3388
3401
  const { value, claimType: type } = args;
3389
3402
  let updateArgs;
3390
- if (type === types_2.ClaimType.Jurisdiction) {
3403
+ if (type === types_3.ClaimType.Jurisdiction) {
3391
3404
  updateArgs = value.map(({ countryCode, count }) => {
3392
3405
  const rawSecondKey = createStat2ndKey(type, context, countryCode);
3393
3406
  return keyAndValueToStatUpdate(rawSecondKey, bigNumberToU128(count, context), context);
@@ -3395,7 +3408,7 @@ function claimCountStatInputToStatUpdates(args, context) {
3395
3408
  }
3396
3409
  else {
3397
3410
  let yes, no;
3398
- if (type === types_2.ClaimType.Accredited) {
3411
+ if (type === types_3.ClaimType.Accredited) {
3399
3412
  ({ accredited: yes, nonAccredited: no } = value);
3400
3413
  }
3401
3414
  else {
@@ -3431,7 +3444,7 @@ function inputStatTypeToMeshStatType(input, context) {
3431
3444
  const { type } = input;
3432
3445
  const op = statTypeToStatOpType(type, context);
3433
3446
  let claimIssuer;
3434
- if (type === types_2.StatType.ScopedCount || type === types_2.StatType.ScopedBalance) {
3447
+ if (type === types_3.StatType.ScopedCount || type === types_3.StatType.ScopedBalance) {
3435
3448
  claimIssuer = claimIssuerToMeshClaimIssuer(input.claimIssuer, context);
3436
3449
  }
3437
3450
  return statisticsOpTypeToStatType({ operationType: op, claimIssuer }, context);
@@ -3447,17 +3460,17 @@ function meshProposalStateToProposalStatus(status) {
3447
3460
  case 'Active':
3448
3461
  expiry = (0, internal_3.optionize)(momentToDate)(status.asActive.until.unwrapOr(null));
3449
3462
  if (!expiry || expiry > new Date()) {
3450
- return types_2.ProposalStatus.Active;
3463
+ return types_3.ProposalStatus.Active;
3451
3464
  }
3452
3465
  else {
3453
- return types_2.ProposalStatus.Expired;
3466
+ return types_3.ProposalStatus.Expired;
3454
3467
  }
3455
3468
  case 'ExecutionSuccessful':
3456
- return types_2.ProposalStatus.Successful;
3469
+ return types_3.ProposalStatus.Successful;
3457
3470
  case 'ExecutionFailed':
3458
- return types_2.ProposalStatus.Failed;
3471
+ return types_3.ProposalStatus.Failed;
3459
3472
  case 'Rejected':
3460
- return types_2.ProposalStatus.Rejected;
3473
+ return types_3.ProposalStatus.Rejected;
3461
3474
  default:
3462
3475
  throw new utils_1.UnreachableCaseError(type);
3463
3476
  }
@@ -3472,7 +3485,7 @@ function metadataSpecToMeshMetadataSpec(specs, context) {
3472
3485
  const metadataTypeDefMaxLength = u32ToBigNumber(assetMetadataTypeDefMaxLength);
3473
3486
  if (typeDef && metadataTypeDefMaxLength.lt(typeDef.length)) {
3474
3487
  throw new internal_1.PolymeshError({
3475
- code: types_2.ErrorCode.ValidationError,
3488
+ code: types_3.ErrorCode.ValidationError,
3476
3489
  message: '"typeDef" length exceeded for given Asset Metadata spec',
3477
3490
  data: {
3478
3491
  maxLength: metadataTypeDefMaxLength,
@@ -3512,7 +3525,7 @@ exports.meshMetadataSpecToMetadataSpec = meshMetadataSpecToMetadataSpec;
3512
3525
  function metadataToMeshMetadataKey(type, id, context) {
3513
3526
  const rawId = bigNumberToU64(id, context);
3514
3527
  let metadataKey;
3515
- if (type === types_2.MetadataType.Local) {
3528
+ if (type === types_3.MetadataType.Local) {
3516
3529
  metadataKey = { Local: rawId };
3517
3530
  }
3518
3531
  else {
@@ -3530,17 +3543,17 @@ function meshMetadataValueToMetadataValue(rawValue, rawDetails) {
3530
3543
  }
3531
3544
  let metadataValue = {
3532
3545
  value: bytesToString(rawValue.unwrap()),
3533
- lockStatus: types_2.MetadataLockStatus.Unlocked,
3546
+ lockStatus: types_3.MetadataLockStatus.Unlocked,
3534
3547
  expiry: null,
3535
3548
  };
3536
3549
  if (rawDetails.isSome) {
3537
3550
  const { lockStatus: rawLockStatus, expire } = rawDetails.unwrap();
3538
3551
  metadataValue = Object.assign(Object.assign({}, metadataValue), { expiry: (0, internal_3.optionize)(momentToDate)(expire.unwrapOr(null)) });
3539
3552
  if (rawLockStatus.isLocked) {
3540
- metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_2.MetadataLockStatus.Locked });
3553
+ metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_3.MetadataLockStatus.Locked });
3541
3554
  }
3542
3555
  if (rawLockStatus.isLockedUntil) {
3543
- metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_2.MetadataLockStatus.LockedUntil, lockedUntil: momentToDate(rawLockStatus.asLockedUntil) });
3556
+ metadataValue = Object.assign(Object.assign({}, metadataValue), { lockStatus: types_3.MetadataLockStatus.LockedUntil, lockedUntil: momentToDate(rawLockStatus.asLockedUntil) });
3544
3557
  }
3545
3558
  }
3546
3559
  return metadataValue;
@@ -3554,7 +3567,7 @@ function metadataValueToMeshMetadataValue(value, context) {
3554
3567
  const metadataValueMaxLength = u32ToBigNumber(assetMetadataValueMaxLength);
3555
3568
  if (metadataValueMaxLength.lt(value.length)) {
3556
3569
  throw new internal_1.PolymeshError({
3557
- code: types_2.ErrorCode.ValidationError,
3570
+ code: types_3.ErrorCode.ValidationError,
3558
3571
  message: 'Asset Metadata value length exceeded',
3559
3572
  data: {
3560
3573
  maxLength: metadataValueMaxLength,
@@ -3570,11 +3583,11 @@ exports.metadataValueToMeshMetadataValue = metadataValueToMeshMetadataValue;
3570
3583
  function metadataValueDetailToMeshMetadataValueDetail(details, context) {
3571
3584
  const { lockStatus, expiry } = details;
3572
3585
  let meshLockStatus;
3573
- if (lockStatus === types_2.MetadataLockStatus.LockedUntil) {
3586
+ if (lockStatus === types_3.MetadataLockStatus.LockedUntil) {
3574
3587
  const { lockedUntil } = details;
3575
3588
  if (lockedUntil < new Date()) {
3576
3589
  throw new internal_1.PolymeshError({
3577
- code: types_2.ErrorCode.UnmetPrerequisite,
3590
+ code: types_3.ErrorCode.UnmetPrerequisite,
3578
3591
  message: 'Locked until date must be in the future',
3579
3592
  });
3580
3593
  }
@@ -3585,7 +3598,7 @@ function metadataValueDetailToMeshMetadataValueDetail(details, context) {
3585
3598
  }
3586
3599
  if (expiry && expiry < new Date()) {
3587
3600
  throw new internal_1.PolymeshError({
3588
- code: types_2.ErrorCode.UnmetPrerequisite,
3601
+ code: types_3.ErrorCode.UnmetPrerequisite,
3589
3602
  message: 'Expiry date must be in the future',
3590
3603
  });
3591
3604
  }
@@ -3615,7 +3628,7 @@ exports.portfolioIdStringToPortfolio = portfolioIdStringToPortfolio;
3615
3628
  */
3616
3629
  function middlewareLegToLeg(leg, context) {
3617
3630
  const { legType, from, fromPortfolio, to, toPortfolio, assetId, ticker, nftIds, amount } = leg;
3618
- if (legType === types_1.LegTypeEnum.Fungible) {
3631
+ if (legType === types_2.LegTypeEnum.Fungible) {
3619
3632
  return {
3620
3633
  asset: new internal_1.FungibleAsset({ assetId: (0, internal_3.getAssetIdFromMiddleware)({ id: assetId, ticker }) }, context),
3621
3634
  amount: new bignumber_js_1.default(amount).shiftedBy(-6),
@@ -3623,7 +3636,7 @@ function middlewareLegToLeg(leg, context) {
3623
3636
  to: middlewarePortfolioToPortfolio({ identityId: to, number: toPortfolio }, context),
3624
3637
  };
3625
3638
  }
3626
- if (legType === types_1.LegTypeEnum.NonFungible) {
3639
+ if (legType === types_2.LegTypeEnum.NonFungible) {
3627
3640
  const id = (0, internal_3.getAssetIdFromMiddleware)({ id: assetId, ticker });
3628
3641
  return {
3629
3642
  from: middlewarePortfolioToPortfolio({ identityId: from, number: fromPortfolio }, context),
@@ -3646,8 +3659,8 @@ exports.middlewareLegToLeg = middlewareLegToLeg;
3646
3659
  */
3647
3660
  function middlewareAffirmStatusToAffirmationStatus(status) {
3648
3661
  const affirmStatusMap = {
3649
- [types_1.AffirmStatusEnum.Affirmed]: types_2.AffirmationStatus.Affirmed,
3650
- [types_1.AffirmStatusEnum.Rejected]: types_2.AffirmationStatus.Rejected,
3662
+ [types_2.AffirmStatusEnum.Affirmed]: types_3.AffirmationStatus.Affirmed,
3663
+ [types_2.AffirmStatusEnum.Rejected]: types_3.AffirmationStatus.Rejected,
3651
3664
  };
3652
3665
  return affirmStatusMap[status];
3653
3666
  }
@@ -3657,10 +3670,10 @@ exports.middlewareAffirmStatusToAffirmationStatus = middlewareAffirmStatusToAffi
3657
3670
  */
3658
3671
  function middlewareInstructionStatusToInstructionStatus(status) {
3659
3672
  const middlewareStatusToInstructionStatusMap = {
3660
- [types_1.InstructionStatusEnum.Created]: types_2.InstructionStatus.Pending,
3661
- [types_1.InstructionStatusEnum.Executed]: types_2.InstructionStatus.Success,
3662
- [types_1.InstructionStatusEnum.Rejected]: types_2.InstructionStatus.Rejected,
3663
- [types_1.InstructionStatusEnum.Failed]: types_2.InstructionStatus.Failed,
3673
+ [types_2.InstructionStatusEnum.Created]: types_3.InstructionStatus.Pending,
3674
+ [types_2.InstructionStatusEnum.Executed]: types_3.InstructionStatus.Success,
3675
+ [types_2.InstructionStatusEnum.Rejected]: types_3.InstructionStatus.Rejected,
3676
+ [types_2.InstructionStatusEnum.Failed]: types_3.InstructionStatus.Failed,
3664
3677
  };
3665
3678
  return middlewareStatusToInstructionStatusMap[status];
3666
3679
  }
@@ -3671,21 +3684,21 @@ exports.middlewareInstructionStatusToInstructionStatus = middlewareInstructionSt
3671
3684
  function middlewareInstructionToInstructionEndCondition(instruction) {
3672
3685
  const { type, endBlock, endAfterBlock } = instruction;
3673
3686
  let typeDetails;
3674
- if (type === types_1.InstructionTypeEnum.SettleManual) {
3687
+ if (type === types_2.InstructionTypeEnum.SettleManual) {
3675
3688
  typeDetails = {
3676
- type: types_2.InstructionType.SettleManual,
3689
+ type: types_3.InstructionType.SettleManual,
3677
3690
  endAfterBlock: new bignumber_js_1.default(endAfterBlock),
3678
3691
  };
3679
3692
  }
3680
- else if (type === types_1.InstructionTypeEnum.SettleOnBlock) {
3693
+ else if (type === types_2.InstructionTypeEnum.SettleOnBlock) {
3681
3694
  typeDetails = {
3682
- type: types_2.InstructionType.SettleOnBlock,
3695
+ type: types_3.InstructionType.SettleOnBlock,
3683
3696
  endBlock: new bignumber_js_1.default(endBlock),
3684
3697
  };
3685
3698
  }
3686
3699
  else {
3687
3700
  typeDetails = {
3688
- type: types_2.InstructionType.SettleOnAffirmation,
3701
+ type: types_3.InstructionType.SettleOnAffirmation,
3689
3702
  };
3690
3703
  }
3691
3704
  return typeDetails;
@@ -3710,7 +3723,7 @@ exports.middlewareInstructionToHistoricInstruction = middlewareInstructionToHist
3710
3723
  function expiryToMoment(expiry, context) {
3711
3724
  if (expiry && expiry <= new Date()) {
3712
3725
  throw new internal_1.PolymeshError({
3713
- code: types_2.ErrorCode.UnmetPrerequisite,
3726
+ code: types_3.ErrorCode.UnmetPrerequisite,
3714
3727
  message: 'Expiry date must be in the future',
3715
3728
  });
3716
3729
  }
@@ -3758,16 +3771,16 @@ function middlewareAgentGroupDataToPermissionGroup(agentGroupData, context) {
3758
3771
  const agentGroup = agentGroupData[asset];
3759
3772
  let permissionGroupIdentifier;
3760
3773
  if ('full' in agentGroup) {
3761
- permissionGroupIdentifier = types_2.PermissionGroupType.Full;
3774
+ permissionGroupIdentifier = types_3.PermissionGroupType.Full;
3762
3775
  }
3763
3776
  else if ('exceptMeta' in agentGroup) {
3764
- permissionGroupIdentifier = types_2.PermissionGroupType.ExceptMeta;
3777
+ permissionGroupIdentifier = types_3.PermissionGroupType.ExceptMeta;
3765
3778
  }
3766
3779
  else if ('polymeshV1CAA' in agentGroup) {
3767
- permissionGroupIdentifier = types_2.PermissionGroupType.PolymeshV1Caa;
3780
+ permissionGroupIdentifier = types_3.PermissionGroupType.PolymeshV1Caa;
3768
3781
  }
3769
3782
  else if ('polymeshV1PIA' in agentGroup) {
3770
- permissionGroupIdentifier = types_2.PermissionGroupType.PolymeshV1Pia;
3783
+ permissionGroupIdentifier = types_3.PermissionGroupType.PolymeshV1Pia;
3771
3784
  }
3772
3785
  else {
3773
3786
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -3784,11 +3797,11 @@ function middlewareExtrinsicPermissionsDataToTransactionPermissions(permissions)
3784
3797
  let extrinsicType = 'nullish';
3785
3798
  let rawPallets;
3786
3799
  if ('these' in permissions) {
3787
- extrinsicType = types_2.PermissionType.Include;
3800
+ extrinsicType = types_3.PermissionType.Include;
3788
3801
  rawPallets = permissions.these;
3789
3802
  }
3790
3803
  else if ('except' in permissions) {
3791
- extrinsicType = types_2.PermissionType.Exclude;
3804
+ extrinsicType = types_3.PermissionType.Exclude;
3792
3805
  rawPallets = permissions.except;
3793
3806
  }
3794
3807
  if (!rawPallets) {
@@ -3855,11 +3868,11 @@ function middlewarePermissionsDataToPermissions(permissionsData, context) {
3855
3868
  let assetsType;
3856
3869
  let assetsPermissions;
3857
3870
  if ('these' in asset) {
3858
- assetsType = types_2.PermissionType.Include;
3871
+ assetsType = types_3.PermissionType.Include;
3859
3872
  assetsPermissions = asset.these;
3860
3873
  }
3861
3874
  else if ('except' in asset) {
3862
- assetsType = types_2.PermissionType.Exclude;
3875
+ assetsType = types_3.PermissionType.Exclude;
3863
3876
  assetsPermissions = asset.except;
3864
3877
  }
3865
3878
  if (assetsPermissions) {
@@ -3872,11 +3885,11 @@ function middlewarePermissionsDataToPermissions(permissionsData, context) {
3872
3885
  let portfoliosType;
3873
3886
  let portfolioIds;
3874
3887
  if ('these' in portfolio) {
3875
- portfoliosType = types_2.PermissionType.Include;
3888
+ portfoliosType = types_3.PermissionType.Include;
3876
3889
  portfolioIds = portfolio.these;
3877
3890
  }
3878
3891
  else if ('except' in portfolio) {
3879
- portfoliosType = types_2.PermissionType.Exclude;
3892
+ portfoliosType = types_3.PermissionType.Exclude;
3880
3893
  portfolioIds = portfolio.except;
3881
3894
  }
3882
3895
  if (portfolioIds) {
@@ -3900,41 +3913,41 @@ exports.middlewarePermissionsDataToPermissions = middlewarePermissionsDataToPerm
3900
3913
  */
3901
3914
  function middlewareAuthorizationDataToAuthorization(context, type, data) {
3902
3915
  switch (type) {
3903
- case types_1.AuthTypeEnum.AttestPrimaryKeyRotation:
3916
+ case types_2.AuthTypeEnum.AttestPrimaryKeyRotation:
3904
3917
  return {
3905
- type: types_2.AuthorizationType.AttestPrimaryKeyRotation,
3918
+ type: types_3.AuthorizationType.AttestPrimaryKeyRotation,
3906
3919
  value: new internal_1.Identity({ did: data }, context),
3907
3920
  };
3908
- case types_1.AuthTypeEnum.RotatePrimaryKey: {
3921
+ case types_2.AuthTypeEnum.RotatePrimaryKey: {
3909
3922
  return {
3910
- type: types_2.AuthorizationType.RotatePrimaryKey,
3923
+ type: types_3.AuthorizationType.RotatePrimaryKey,
3911
3924
  };
3912
3925
  }
3913
- case types_1.AuthTypeEnum.RotatePrimaryKeyToSecondary: {
3926
+ case types_2.AuthTypeEnum.RotatePrimaryKeyToSecondary: {
3914
3927
  return {
3915
- type: types_2.AuthorizationType.RotatePrimaryKeyToSecondary,
3928
+ type: types_3.AuthorizationType.RotatePrimaryKeyToSecondary,
3916
3929
  value: middlewarePermissionsDataToPermissions(data, context),
3917
3930
  };
3918
3931
  }
3919
- case types_1.AuthTypeEnum.JoinIdentity: {
3932
+ case types_2.AuthTypeEnum.JoinIdentity: {
3920
3933
  return {
3921
- type: types_2.AuthorizationType.JoinIdentity,
3934
+ type: types_3.AuthorizationType.JoinIdentity,
3922
3935
  value: middlewarePermissionsDataToPermissions(data, context),
3923
3936
  };
3924
3937
  }
3925
- case types_1.AuthTypeEnum.AddMultiSigSigner:
3938
+ case types_2.AuthTypeEnum.AddMultiSigSigner:
3926
3939
  return {
3927
- type: types_2.AuthorizationType.AddMultiSigSigner,
3940
+ type: types_3.AuthorizationType.AddMultiSigSigner,
3928
3941
  value: data,
3929
3942
  };
3930
- case types_1.AuthTypeEnum.AddRelayerPayingKey: {
3943
+ case types_2.AuthTypeEnum.AddRelayerPayingKey: {
3931
3944
  // data is received in the format - {"5Ci94GCJC2JBM8U1PCkpHX6HkscWmucN9XwUrjb7o4TDgVns","5DZp1QYH49MKZhCtDupNaAeHp8xtqetuSzgf2p2cUWoxW3iu","1000000000"}
3932
3945
  const [beneficiary, subsidizer, allowance] = data
3933
3946
  .substring(1, data.length - 1)
3934
3947
  .replace(/"/g, '')
3935
3948
  .split(',');
3936
3949
  return {
3937
- type: types_2.AuthorizationType.AddRelayerPayingKey,
3950
+ type: types_3.AuthorizationType.AddRelayerPayingKey,
3938
3951
  value: {
3939
3952
  beneficiary: new internal_1.Account({ address: beneficiary }, context),
3940
3953
  subsidizer: new internal_1.Account({ address: subsidizer }, context),
@@ -3942,33 +3955,33 @@ function middlewareAuthorizationDataToAuthorization(context, type, data) {
3942
3955
  },
3943
3956
  };
3944
3957
  }
3945
- case types_1.AuthTypeEnum.BecomeAgent: {
3958
+ case types_2.AuthTypeEnum.BecomeAgent: {
3946
3959
  const becomeAgentData = JSON.parse(data.replace(',', ':'));
3947
3960
  return {
3948
- type: types_2.AuthorizationType.BecomeAgent,
3961
+ type: types_3.AuthorizationType.BecomeAgent,
3949
3962
  value: middlewareAgentGroupDataToPermissionGroup(becomeAgentData, context),
3950
3963
  };
3951
3964
  }
3952
- case types_1.AuthTypeEnum.TransferTicker:
3965
+ case types_2.AuthTypeEnum.TransferTicker:
3953
3966
  return {
3954
- type: types_2.AuthorizationType.TransferTicker,
3967
+ type: types_3.AuthorizationType.TransferTicker,
3955
3968
  value: (0, exports.coerceHexToString)(data),
3956
3969
  };
3957
- case types_1.AuthTypeEnum.TransferAssetOwnership: {
3970
+ case types_2.AuthTypeEnum.TransferAssetOwnership: {
3958
3971
  return {
3959
- type: types_2.AuthorizationType.TransferAssetOwnership,
3972
+ type: types_3.AuthorizationType.TransferAssetOwnership,
3960
3973
  value: data,
3961
3974
  };
3962
3975
  }
3963
- case types_1.AuthTypeEnum.PortfolioCustody: {
3976
+ case types_2.AuthTypeEnum.PortfolioCustody: {
3964
3977
  return {
3965
- type: types_2.AuthorizationType.PortfolioCustody,
3978
+ type: types_3.AuthorizationType.PortfolioCustody,
3966
3979
  value: middlewarePortfolioDataToPortfolio(JSON.parse(data), context),
3967
3980
  };
3968
3981
  }
3969
3982
  }
3970
3983
  throw new internal_1.PolymeshError({
3971
- code: types_2.ErrorCode.UnexpectedError,
3984
+ code: types_3.ErrorCode.UnexpectedError,
3972
3985
  message: 'Unsupported Authorization Type. Please contact the Polymesh team',
3973
3986
  data: {
3974
3987
  auth: data,
@@ -3993,11 +4006,11 @@ exports.collectionKeysToMetadataKeys = collectionKeysToMetadataKeys;
3993
4006
  function meshMetadataKeyToMetadataKey(rawKey, asset, context) {
3994
4007
  return __awaiter(this, void 0, void 0, function* () {
3995
4008
  if (rawKey.isGlobal) {
3996
- return { type: types_2.MetadataType.Global, id: u64ToBigNumber(rawKey.asGlobal) };
4009
+ return { type: types_3.MetadataType.Global, id: u64ToBigNumber(rawKey.asGlobal) };
3997
4010
  }
3998
4011
  else {
3999
4012
  const assetIdParams = yield (0, internal_3.getAssetIdAndTicker)(asset.id, context);
4000
- return Object.assign({ type: types_2.MetadataType.Local, id: u64ToBigNumber(rawKey.asLocal) }, assetIdParams);
4013
+ return Object.assign({ type: types_3.MetadataType.Local, id: u64ToBigNumber(rawKey.asLocal) }, assetIdParams);
4001
4014
  }
4002
4015
  });
4003
4016
  }
@@ -4054,7 +4067,7 @@ function portfolioMovementsToHistoricSettlements(portfolioMovements, context, ha
4054
4067
  return {
4055
4068
  blockNumber: new bignumber_js_1.default(blockId),
4056
4069
  blockHash: hash,
4057
- status: types_1.InstructionStatusEnum.Executed,
4070
+ status: types_2.InstructionStatusEnum.Executed,
4058
4071
  accounts: [handleMiddlewareAddress(accountAddress, context)],
4059
4072
  legs: [
4060
4073
  {
@@ -4119,13 +4132,13 @@ exports.toHistoricalSettlements = toHistoricalSettlements;
4119
4132
  function mediatorAffirmationStatusToStatus(rawStatus) {
4120
4133
  switch (rawStatus.type) {
4121
4134
  case 'Unknown':
4122
- return { status: types_2.AffirmationStatus.Unknown };
4135
+ return { status: types_3.AffirmationStatus.Unknown };
4123
4136
  case 'Pending':
4124
- return { status: types_2.AffirmationStatus.Pending };
4137
+ return { status: types_3.AffirmationStatus.Pending };
4125
4138
  case 'Affirmed': {
4126
4139
  const rawExpiry = rawStatus.asAffirmed.expiry;
4127
4140
  const expiry = rawExpiry.isSome ? momentToDate(rawExpiry.unwrap()) : undefined;
4128
- return { status: types_2.AffirmationStatus.Affirmed, expiry };
4141
+ return { status: types_3.AffirmationStatus.Affirmed, expiry };
4129
4142
  }
4130
4143
  default:
4131
4144
  throw new utils_1.UnreachableCaseError(rawStatus.type);
@@ -4151,10 +4164,10 @@ exports.createRawExtrinsicStatus = createRawExtrinsicStatus;
4151
4164
  */
4152
4165
  function signatureToMeshRuntimeMultiSignature(type, value, context) {
4153
4166
  let rawValue;
4154
- if (type === types_2.SignerKeyRingType.Ecdsa) {
4167
+ if (type === types_3.SignerKeyRingType.Ecdsa) {
4155
4168
  rawValue = context.createType('SpCoreEcdsaSignature', value);
4156
4169
  }
4157
- else if (type === types_2.SignerKeyRingType.Ed25519) {
4170
+ else if (type === types_3.SignerKeyRingType.Ed25519) {
4158
4171
  rawValue = context.createType('SpCoreEd25519Signature', value);
4159
4172
  }
4160
4173
  else {
@@ -4172,7 +4185,7 @@ exports.signatureToMeshRuntimeMultiSignature = signatureToMeshRuntimeMultiSignat
4172
4185
  function offChainMetadataToMeshReceiptMetadata(metadata, context) {
4173
4186
  if (metadata.length > constants_1.MAX_OFF_CHAIN_METADATA_LENGTH) {
4174
4187
  throw new internal_1.PolymeshError({
4175
- code: types_2.ErrorCode.ValidationError,
4188
+ code: types_3.ErrorCode.ValidationError,
4176
4189
  message: 'Max metadata length exceeded',
4177
4190
  data: {
4178
4191
  maxLength: constants_1.MAX_OFF_CHAIN_METADATA_LENGTH,
@@ -4235,14 +4248,14 @@ exports.childKeysWithAuthToCreateChildIdentitiesWithAuth = childKeysWithAuthToCr
4235
4248
  */
4236
4249
  function middlewareProposalStateToProposalStatus(state) {
4237
4250
  const stateToStatusMap = {
4238
- [typesV1_1.MultiSigProposalStatusEnum.Active]: types_2.ProposalStatus.Active,
4239
- [typesV1_1.MultiSigProposalStatusEnum.Deleted]: types_2.ProposalStatus.Expired,
4240
- [typesV1_1.MultiSigProposalStatusEnum.Failed]: types_2.ProposalStatus.Failed,
4241
- [typesV1_1.MultiSigProposalStatusEnum.Success]: types_2.ProposalStatus.Successful,
4242
- [typesV1_1.MultiSigProposalStatusEnum.Rejected]: types_2.ProposalStatus.Rejected,
4243
- [typesV1_1.MultiSigProposalStatusEnum.Approved]: types_2.ProposalStatus.Active,
4251
+ [typesV1_1.MultiSigProposalStatusEnum.Active]: types_3.ProposalStatus.Active,
4252
+ [typesV1_1.MultiSigProposalStatusEnum.Deleted]: types_3.ProposalStatus.Expired,
4253
+ [typesV1_1.MultiSigProposalStatusEnum.Failed]: types_3.ProposalStatus.Failed,
4254
+ [typesV1_1.MultiSigProposalStatusEnum.Success]: types_3.ProposalStatus.Successful,
4255
+ [typesV1_1.MultiSigProposalStatusEnum.Rejected]: types_3.ProposalStatus.Rejected,
4256
+ [typesV1_1.MultiSigProposalStatusEnum.Approved]: types_3.ProposalStatus.Active,
4244
4257
  };
4245
- return stateToStatusMap[state] || types_2.ProposalStatus.Invalid;
4258
+ return stateToStatusMap[state] || types_3.ProposalStatus.Invalid;
4246
4259
  }
4247
4260
  exports.middlewareProposalStateToProposalStatus = middlewareProposalStateToProposalStatus;
4248
4261
  /**
@@ -4355,4 +4368,140 @@ function rawValidatorPrefToCommission(rawValidator) {
4355
4368
  };
4356
4369
  }
4357
4370
  exports.rawValidatorPrefToCommission = rawValidatorPrefToCommission;
4371
+ /**
4372
+ * @hidden
4373
+ */
4374
+ function meshCorporateBallotMotionToCorporateBallotMotion(rawMotion) {
4375
+ const title = bytesToString(rawMotion.title);
4376
+ const infoLink = bytesToString(rawMotion.infoLink);
4377
+ const choices = rawMotion.choices.map(bytesToString);
4378
+ return {
4379
+ title,
4380
+ infoLink,
4381
+ choices,
4382
+ };
4383
+ }
4384
+ exports.meshCorporateBallotMotionToCorporateBallotMotion = meshCorporateBallotMotionToCorporateBallotMotion;
4385
+ /**
4386
+ * @hidden
4387
+ */
4388
+ function meshCorporateBallotMetaToCorporateBallotMeta(rawMeta) {
4389
+ const title = bytesToString(rawMeta.title);
4390
+ return {
4391
+ title,
4392
+ motions: rawMeta.motions.map(meshCorporateBallotMotionToCorporateBallotMotion),
4393
+ };
4394
+ }
4395
+ exports.meshCorporateBallotMetaToCorporateBallotMeta = meshCorporateBallotMetaToCorporateBallotMeta;
4396
+ /**
4397
+ * @hidden
4398
+ * Ensure that `start <= end`, `now <= end`, and `record_date <= voting start`
4399
+ */
4400
+ function corporateBallotTimeRangeToMeshCorporateBallotTimeRange(declarationDate, startDate, endDate, context) {
4401
+ const now = new Date();
4402
+ if (startDate < declarationDate) {
4403
+ throw new internal_1.PolymeshError({
4404
+ code: types_3.ErrorCode.ValidationError,
4405
+ message: 'Voting start date must be after declaration date',
4406
+ data: {
4407
+ recordDate: declarationDate,
4408
+ startDate,
4409
+ },
4410
+ });
4411
+ }
4412
+ if (endDate < startDate) {
4413
+ throw new internal_1.PolymeshError({
4414
+ code: types_3.ErrorCode.ValidationError,
4415
+ message: 'End date must be after or same as start date',
4416
+ data: {
4417
+ startDate,
4418
+ endDate,
4419
+ },
4420
+ });
4421
+ }
4422
+ if (endDate <= now) {
4423
+ throw new internal_1.PolymeshError({
4424
+ code: types_3.ErrorCode.ValidationError,
4425
+ message: 'End date must be in the future',
4426
+ data: {
4427
+ now,
4428
+ endDate,
4429
+ },
4430
+ });
4431
+ }
4432
+ const start = dateToMoment(startDate, context);
4433
+ const end = dateToMoment(endDate, context);
4434
+ return context.createType('PalletCorporateActionsBallotBallotTimeRange', {
4435
+ start,
4436
+ end,
4437
+ });
4438
+ }
4439
+ exports.corporateBallotTimeRangeToMeshCorporateBallotTimeRange = corporateBallotTimeRangeToMeshCorporateBallotTimeRange;
4440
+ /**
4441
+ * @hidden
4442
+ */
4443
+ function corporateMotionToMeshCorporateMotion(motion, context) {
4444
+ const { title, infoLink, choices } = motion;
4445
+ (0, internal_3.assertMetaLength)(title);
4446
+ (0, internal_3.assertMetaLength)(infoLink);
4447
+ choices.forEach(choice => {
4448
+ (0, internal_3.assertMetaLength)(choice);
4449
+ });
4450
+ return context.createType('PalletCorporateActionsBallotMotion', {
4451
+ title: stringToBytes(title, context),
4452
+ infoLink: stringToBytes(infoLink, context),
4453
+ choices: choices.map(choice => stringToBytes(choice, context)),
4454
+ });
4455
+ }
4456
+ exports.corporateMotionToMeshCorporateMotion = corporateMotionToMeshCorporateMotion;
4457
+ /**
4458
+ * @hidden
4459
+ */
4460
+ function corporateBallotMetaToMeshCorporateBallotMeta(meta, context) {
4461
+ (0, internal_3.assertMetaLength)(meta.title);
4462
+ const title = stringToBytes(meta.title, context);
4463
+ const motions = meta.motions.map(motion => corporateMotionToMeshCorporateMotion(motion, context));
4464
+ return context.createType('PalletCorporateActionsBallotBallotMeta', {
4465
+ title,
4466
+ motions,
4467
+ });
4468
+ }
4469
+ exports.corporateBallotMetaToMeshCorporateBallotMeta = corporateBallotMetaToMeshCorporateBallotMeta;
4470
+ /**
4471
+ * @hidden
4472
+ */
4473
+ function ballotDetailsToBallotStatus(details) {
4474
+ const { startDate, endDate } = details;
4475
+ const now = new Date();
4476
+ if (now < startDate) {
4477
+ return types_1.CorporateBallotStatus.Pending;
4478
+ }
4479
+ if (now < endDate) {
4480
+ return types_1.CorporateBallotStatus.Active;
4481
+ }
4482
+ return types_1.CorporateBallotStatus.Closed;
4483
+ }
4484
+ exports.ballotDetailsToBallotStatus = ballotDetailsToBallotStatus;
4485
+ /**
4486
+ * @hidden
4487
+ */
4488
+ function ballotVoteToMeshBallotVote(power, fallback, context) {
4489
+ return context.createType('PalletCorporateActionsBallotBallotVote', {
4490
+ power: bigNumberToU128(power, context),
4491
+ fallback: fallback ? bigNumberToU16(new bignumber_js_1.default(fallback), context) : undefined,
4492
+ });
4493
+ }
4494
+ exports.ballotVoteToMeshBallotVote = ballotVoteToMeshBallotVote;
4495
+ /**
4496
+ * @hidden
4497
+ */
4498
+ function meshBallotDetailsToCorporateBallotDetails(rawTimeRange, rawMeta, rawRcv) {
4499
+ return {
4500
+ startDate: momentToDate(rawTimeRange.start),
4501
+ endDate: momentToDate(rawTimeRange.end),
4502
+ meta: meshCorporateBallotMetaToCorporateBallotMeta(rawMeta),
4503
+ rcv: boolToBoolean(rawRcv),
4504
+ };
4505
+ }
4506
+ exports.meshBallotDetailsToCorporateBallotDetails = meshBallotDetailsToCorporateBallotDetails;
4358
4507
  //# sourceMappingURL=conversion.js.map