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