@polymeshassociation/polymesh-sdk 30.2.0 → 31.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -12
- package/README.md +4 -4
- package/api/client/AccountManagement.d.ts +1 -15
- package/api/client/AccountManagement.d.ts.map +1 -1
- package/api/client/AccountManagement.js +1 -2
- package/api/client/AccountManagement.js.map +1 -1
- package/api/client/Assets.d.ts +1 -1
- package/api/client/Claims.d.ts +4 -17
- package/api/client/Claims.d.ts.map +1 -1
- package/api/client/Claims.js +3 -47
- package/api/client/Claims.js.map +1 -1
- package/api/client/Identities.d.ts +10 -45
- package/api/client/Identities.d.ts.map +1 -1
- package/api/client/Identities.js +3 -18
- package/api/client/Identities.js.map +1 -1
- package/api/client/Staking.d.ts +3 -4
- package/api/client/Staking.d.ts.map +1 -1
- package/api/client/Staking.js +2 -1
- package/api/client/Staking.js.map +1 -1
- package/api/entities/Account/Staking/index.d.ts.map +1 -1
- package/api/entities/Account/Staking/index.js +2 -9
- package/api/entities/Account/Staking/index.js.map +1 -1
- package/api/entities/Account/helpers.js +1 -1
- package/api/entities/Account/helpers.js.map +1 -1
- package/api/entities/Account/index.d.ts.map +1 -1
- package/api/entities/Account/index.js +0 -6
- package/api/entities/Account/index.js.map +1 -1
- package/api/entities/Account/types.d.ts +0 -2
- package/api/entities/Account/types.d.ts.map +1 -1
- package/api/entities/Account/types.js.map +1 -1
- package/api/entities/Asset/Base/Settlements/index.js +2 -2
- package/api/entities/Asset/Base/Settlements/index.js.map +1 -1
- package/api/entities/Asset/NonFungible/Nft.d.ts.map +1 -1
- package/api/entities/Asset/NonFungible/Nft.js +1 -11
- package/api/entities/Asset/NonFungible/Nft.js.map +1 -1
- package/api/entities/Asset/types.d.ts +3 -66
- package/api/entities/Asset/types.d.ts.map +1 -1
- package/api/entities/Asset/types.js +4 -68
- package/api/entities/Asset/types.js.map +1 -1
- package/api/entities/AuthorizationRequest.d.ts.map +1 -1
- package/api/entities/AuthorizationRequest.js +5 -8
- package/api/entities/AuthorizationRequest.js.map +1 -1
- package/api/entities/Identity/index.d.ts +4 -30
- package/api/entities/Identity/index.d.ts.map +1 -1
- package/api/entities/Identity/index.js +8 -70
- package/api/entities/Identity/index.js.map +1 -1
- package/api/entities/Instruction/index.d.ts +2 -14
- package/api/entities/Instruction/index.d.ts.map +1 -1
- package/api/entities/Instruction/index.js +19 -49
- package/api/entities/Instruction/index.js.map +1 -1
- package/api/entities/Instruction/types.d.ts +2 -2
- package/api/entities/Portfolio/index.d.ts.map +1 -1
- package/api/entities/Portfolio/index.js +4 -9
- package/api/entities/Portfolio/index.js.map +1 -1
- package/api/entities/Subsidies.d.ts +0 -2
- package/api/entities/Subsidies.d.ts.map +1 -1
- package/api/entities/Subsidies.js +0 -9
- package/api/entities/Subsidies.js.map +1 -1
- package/api/entities/common/namespaces/Authorizations.d.ts.map +1 -1
- package/api/entities/common/namespaces/Authorizations.js +0 -8
- package/api/entities/common/namespaces/Authorizations.js.map +1 -1
- package/api/entities/types.d.ts +5 -17
- package/api/entities/types.d.ts.map +1 -1
- package/api/entities/types.js +0 -4
- package/api/entities/types.js.map +1 -1
- package/api/procedures/acceptPrimaryKeyRotation.d.ts +1 -2
- package/api/procedures/acceptPrimaryKeyRotation.d.ts.map +1 -1
- package/api/procedures/acceptPrimaryKeyRotation.js +4 -33
- package/api/procedures/acceptPrimaryKeyRotation.js.map +1 -1
- package/api/procedures/acceptSubsidy.d.ts.map +1 -1
- package/api/procedures/acceptSubsidy.js +0 -6
- package/api/procedures/acceptSubsidy.js.map +1 -1
- package/api/procedures/addInstruction.d.ts.map +1 -1
- package/api/procedures/addInstruction.js +7 -31
- package/api/procedures/addInstruction.js.map +1 -1
- package/api/procedures/attestPrimaryKeyRotation.js +1 -1
- package/api/procedures/attestPrimaryKeyRotation.js.map +1 -1
- package/api/procedures/bondPolyx.d.ts.map +1 -1
- package/api/procedures/bondPolyx.js +7 -28
- package/api/procedures/bondPolyx.js.map +1 -1
- package/api/procedures/configureDividendDistribution.js +1 -1
- package/api/procedures/configureDividendDistribution.js.map +1 -1
- package/api/procedures/consumeAddMultiSigSignerAuthorization.js +1 -1
- package/api/procedures/consumeAddMultiSigSignerAuthorization.js.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.d.ts.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.js +0 -9
- package/api/procedures/consumeJoinOrRotateAuthorization.js.map +1 -1
- package/api/procedures/controllerTransfer.js +1 -1
- package/api/procedures/controllerTransfer.js.map +1 -1
- package/api/procedures/createAsset.d.ts +1 -1
- package/api/procedures/createAsset.d.ts.map +1 -1
- package/api/procedures/createAsset.js +44 -38
- package/api/procedures/createAsset.js.map +1 -1
- package/api/procedures/createMultiSig.js +1 -1
- package/api/procedures/createMultiSig.js.map +1 -1
- package/api/procedures/createNftCollection.js +1 -1
- package/api/procedures/createNftCollection.js.map +1 -1
- package/api/procedures/createVenue.d.ts.map +1 -1
- package/api/procedures/createVenue.js +1 -5
- package/api/procedures/createVenue.js.map +1 -1
- package/api/procedures/executeManualInstruction.d.ts.map +1 -1
- package/api/procedures/executeManualInstruction.js +1 -1
- package/api/procedures/executeManualInstruction.js.map +1 -1
- package/api/procedures/inviteExternalAgent.d.ts +23 -5
- package/api/procedures/inviteExternalAgent.d.ts.map +1 -1
- package/api/procedures/inviteExternalAgent.js +47 -36
- package/api/procedures/inviteExternalAgent.js.map +1 -1
- package/api/procedures/issueNft.d.ts.map +1 -1
- package/api/procedures/issueNft.js +1 -8
- package/api/procedures/issueNft.js.map +1 -1
- package/api/procedures/modifyClaims.d.ts.map +1 -1
- package/api/procedures/modifyClaims.js +8 -3
- package/api/procedures/modifyClaims.js.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.d.ts +1 -1
- package/api/procedures/modifyInstructionAffirmation.d.ts.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.js +13 -77
- package/api/procedures/modifyInstructionAffirmation.js.map +1 -1
- package/api/procedures/modifyMultiSig.js +3 -3
- package/api/procedures/modifyMultiSig.js.map +1 -1
- package/api/procedures/nftControllerTransfer.d.ts +1 -2
- package/api/procedures/nftControllerTransfer.d.ts.map +1 -1
- package/api/procedures/nftControllerTransfer.js +4 -9
- package/api/procedures/nftControllerTransfer.js.map +1 -1
- package/api/procedures/quitSubsidy.d.ts.map +1 -1
- package/api/procedures/quitSubsidy.js +1 -9
- package/api/procedures/quitSubsidy.js.map +1 -1
- package/api/procedures/registerDid.d.ts.map +1 -1
- package/api/procedures/registerDid.js +0 -6
- package/api/procedures/registerDid.js.map +1 -1
- package/api/procedures/registerIdentity.d.ts +5 -1
- package/api/procedures/registerIdentity.d.ts.map +1 -1
- package/api/procedures/registerIdentity.js +17 -8
- package/api/procedures/registerIdentity.js.map +1 -1
- package/api/procedures/revokeIdentityToCreatePortfolios.d.ts +1 -1
- package/api/procedures/revokeIdentityToCreatePortfolios.d.ts.map +1 -1
- package/api/procedures/revokeIdentityToCreatePortfolios.js.map +1 -1
- package/api/procedures/revokeSubsidy.d.ts.map +1 -1
- package/api/procedures/revokeSubsidy.js +0 -6
- package/api/procedures/revokeSubsidy.js.map +1 -1
- package/api/procedures/selfRegisterDid.d.ts.map +1 -1
- package/api/procedures/selfRegisterDid.js +0 -6
- package/api/procedures/selfRegisterDid.js.map +1 -1
- package/api/procedures/setMandatoryReceiverAffirmation.d.ts.map +1 -1
- package/api/procedures/setMandatoryReceiverAffirmation.js +0 -6
- package/api/procedures/setMandatoryReceiverAffirmation.js.map +1 -1
- package/api/procedures/setPermissionGroup.d.ts +11 -2
- package/api/procedures/setPermissionGroup.d.ts.map +1 -1
- package/api/procedures/setPermissionGroup.js +34 -30
- package/api/procedures/setPermissionGroup.js.map +1 -1
- package/api/procedures/setStakingController.d.ts +5 -10
- package/api/procedures/setStakingController.d.ts.map +1 -1
- package/api/procedures/setStakingController.js +10 -41
- package/api/procedures/setStakingController.js.map +1 -1
- package/api/procedures/setStakingPayee.d.ts.map +1 -1
- package/api/procedures/setStakingPayee.js +2 -2
- package/api/procedures/setStakingPayee.js.map +1 -1
- package/api/procedures/subsidizeAccount.d.ts +5 -7
- package/api/procedures/subsidizeAccount.d.ts.map +1 -1
- package/api/procedures/subsidizeAccount.js +2 -51
- package/api/procedures/subsidizeAccount.js.map +1 -1
- package/api/procedures/toggleAssetPreApproval.js +1 -1
- package/api/procedures/toggleAssetPreApproval.js.map +1 -1
- package/api/procedures/transferFunds.d.ts.map +1 -1
- package/api/procedures/transferFunds.js +2 -2
- package/api/procedures/transferFunds.js.map +1 -1
- package/api/procedures/transferPolyx.d.ts.map +1 -1
- package/api/procedures/transferPolyx.js +6 -30
- package/api/procedures/transferPolyx.js.map +1 -1
- package/api/procedures/types.d.ts +24 -110
- package/api/procedures/types.d.ts.map +1 -1
- package/api/procedures/types.js +13 -17
- package/api/procedures/types.js.map +1 -1
- package/api/procedures/updateVenueSigners.d.ts.map +1 -1
- package/api/procedures/updateVenueSigners.js +1 -5
- package/api/procedures/updateVenueSigners.js.map +1 -1
- package/api/procedures/utils.d.ts +1 -11
- package/api/procedures/utils.d.ts.map +1 -1
- package/api/procedures/utils.js +8 -70
- package/api/procedures/utils.js.map +1 -1
- package/base/Context.d.ts +1 -10
- package/base/Context.d.ts.map +1 -1
- package/base/Context.js +4 -55
- package/base/Context.js.map +1 -1
- package/base/PolymeshTransaction.js +1 -1
- package/base/PolymeshTransaction.js.map +1 -1
- package/internal.d.ts +0 -4
- package/internal.d.ts.map +1 -1
- package/internal.js +4 -12
- package/internal.js.map +1 -1
- package/npm-package/{polymeshassociation-polymesh-sdk-30.2.0.tgz → polymeshassociation-polymesh-sdk-31.0.0-beta.1.tgz} +0 -0
- package/package.json +1 -1
- package/types/txGroupConstants.d.ts +52 -21
- package/types/txGroupConstants.d.ts.map +1 -1
- package/types/txGroupConstants.js +84 -28
- package/types/txGroupConstants.js.map +1 -1
- package/utils/constants.d.ts +1 -1
- package/utils/constants.d.ts.map +1 -1
- package/utils/constants.js +1 -1
- package/utils/constants.js.map +1 -1
- package/utils/conversion.d.ts +8 -45
- package/utils/conversion.d.ts.map +1 -1
- package/utils/conversion.js +98 -336
- package/utils/conversion.js.map +1 -1
- package/utils/internal.d.ts +2 -11
- package/utils/internal.d.ts.map +1 -1
- package/utils/internal.js +3 -24
- package/utils/internal.js.map +1 -1
- package/utils/typeguards.d.ts +1 -5
- package/utils/typeguards.d.ts.map +1 -1
- package/utils/typeguards.js +0 -7
- package/utils/typeguards.js.map +1 -1
- package/api/entities/Identity/ChildIdentity.d.ts +0 -44
- package/api/entities/Identity/ChildIdentity.d.ts.map +0 -1
- package/api/entities/Identity/ChildIdentity.js +0 -80
- package/api/entities/Identity/ChildIdentity.js.map +0 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.d.ts +0 -35
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.d.ts.map +0 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.js +0 -116
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.js.map +0 -1
- package/api/procedures/createChildIdentities.d.ts +0 -35
- package/api/procedures/createChildIdentities.d.ts.map +0 -1
- package/api/procedures/createChildIdentities.js +0 -123
- package/api/procedures/createChildIdentities.js.map +0 -1
- package/api/procedures/createChildIdentity.d.ts +0 -37
- package/api/procedures/createChildIdentity.d.ts.map +0 -1
- package/api/procedures/createChildIdentity.js +0 -128
- package/api/procedures/createChildIdentity.js.map +0 -1
- package/api/procedures/unlinkChildIdentity.d.ts +0 -27
- package/api/procedures/unlinkChildIdentity.d.ts.map +0 -1
- package/api/procedures/unlinkChildIdentity.js +0 -101
- package/api/procedures/unlinkChildIdentity.js.map +0 -1
package/utils/conversion.js
CHANGED
|
@@ -76,7 +76,6 @@ exports.portfolioLikeToPortfolio = portfolioLikeToPortfolio;
|
|
|
76
76
|
exports.assetHolderLikeToAssetHolder = assetHolderLikeToAssetHolder;
|
|
77
77
|
exports.portfolioIdToMeshPortfolioId = portfolioIdToMeshPortfolioId;
|
|
78
78
|
exports.assetHolderIdToMeshAssetHolder = assetHolderIdToMeshAssetHolder;
|
|
79
|
-
exports.portfolioToPortfolioKind = portfolioToPortfolioKind;
|
|
80
79
|
exports.assetHolderToAssetHolderKind = assetHolderToAssetHolderKind;
|
|
81
80
|
exports.stringToText = stringToText;
|
|
82
81
|
exports.textToString = textToString;
|
|
@@ -100,7 +99,6 @@ exports.balanceToBigNumber = balanceToBigNumber;
|
|
|
100
99
|
exports.agentGroupToPermissionGroup = agentGroupToPermissionGroup;
|
|
101
100
|
exports.authorizationDataToAuthorization = authorizationDataToAuthorization;
|
|
102
101
|
exports.stringToMemo = stringToMemo;
|
|
103
|
-
exports.u8ToTransferStatus = u8ToTransferStatus;
|
|
104
102
|
exports.internalAssetTypeToAssetType = internalAssetTypeToAssetType;
|
|
105
103
|
exports.internalNftTypeToNftType = internalNftTypeToNftType;
|
|
106
104
|
exports.getInternalNftType = getInternalNftType;
|
|
@@ -120,7 +118,6 @@ exports.documentHashToString = documentHashToString;
|
|
|
120
118
|
exports.assetDocumentToDocument = assetDocumentToDocument;
|
|
121
119
|
exports.documentToAssetDocument = documentToAssetDocument;
|
|
122
120
|
exports.documentToAssetDocumentWithId = documentToAssetDocumentWithId;
|
|
123
|
-
exports.cddStatusToBoolean = cddStatusToBoolean;
|
|
124
121
|
exports.scopeToMeshScope = scopeToMeshScope;
|
|
125
122
|
exports.meshScopeToScope = meshScopeToScope;
|
|
126
123
|
exports.stringToCddId = stringToCddId;
|
|
@@ -136,13 +133,11 @@ exports.meshClaimTypeToClaimType = meshClaimTypeToClaimType;
|
|
|
136
133
|
exports.trustedIssuerToTrustedClaimIssuer = trustedIssuerToTrustedClaimIssuer;
|
|
137
134
|
exports.trustedClaimIssuerToTrustedIssuer = trustedClaimIssuerToTrustedIssuer;
|
|
138
135
|
exports.requirementToComplianceRequirement = requirementToComplianceRequirement;
|
|
139
|
-
exports.complianceRequirementResultToRequirementCompliance = complianceRequirementResultToRequirementCompliance;
|
|
140
136
|
exports.complianceRequirementReportToRequirementCompliance = complianceRequirementReportToRequirementCompliance;
|
|
141
137
|
exports.complianceRequirementToRequirement = complianceRequirementToRequirement;
|
|
142
138
|
exports.txTagToProtocolOp = txTagToProtocolOp;
|
|
143
139
|
exports.extrinsicIdentifierToTxTag = extrinsicIdentifierToTxTag;
|
|
144
140
|
exports.txTagToExtrinsicIdentifier = txTagToExtrinsicIdentifier;
|
|
145
|
-
exports.assetComplianceResultToCompliance = assetComplianceResultToCompliance;
|
|
146
141
|
exports.assetComplianceReportToCompliance = assetComplianceReportToCompliance;
|
|
147
142
|
exports.moduleAddressToString = moduleAddressToString;
|
|
148
143
|
exports.keyToAddress = keyToAddress;
|
|
@@ -168,7 +163,6 @@ exports.claimIssuerToMeshClaimIssuer = claimIssuerToMeshClaimIssuer;
|
|
|
168
163
|
exports.transferRestrictionToPolymeshTransferCondition = transferRestrictionToPolymeshTransferCondition;
|
|
169
164
|
exports.identitiesToBtreeSet = identitiesToBtreeSet;
|
|
170
165
|
exports.addressesToBtreeSet = addressesToBtreeSet;
|
|
171
|
-
exports.portfolioIdsToBtreeSet = portfolioIdsToBtreeSet;
|
|
172
166
|
exports.assetHolderIdsToBtreeSet = assetHolderIdsToBtreeSet;
|
|
173
167
|
exports.identitiesSetToIdentities = identitiesSetToIdentities;
|
|
174
168
|
exports.assetDispatchErrorToTransferError = assetDispatchErrorToTransferError;
|
|
@@ -244,7 +238,6 @@ exports.signatureToMeshRuntimeMultiSignature = signatureToMeshRuntimeMultiSignat
|
|
|
244
238
|
exports.offChainMetadataToMeshReceiptMetadata = offChainMetadataToMeshReceiptMetadata;
|
|
245
239
|
exports.receiptDetailsToMeshReceiptDetails = receiptDetailsToMeshReceiptDetails;
|
|
246
240
|
exports.secondaryAccountWithAuthToSecondaryKeyWithAuth = secondaryAccountWithAuthToSecondaryKeyWithAuth;
|
|
247
|
-
exports.childKeysWithAuthToCreateChildIdentitiesWithAuth = childKeysWithAuthToCreateChildIdentitiesWithAuth;
|
|
248
241
|
exports.middlewareProposalStateToProposalStatus = middlewareProposalStateToProposalStatus;
|
|
249
242
|
exports.stakingRewardDestinationToRaw = stakingRewardDestinationToRaw;
|
|
250
243
|
exports.activeEraStakingToActiveEraInfo = activeEraStakingToActiveEraInfo;
|
|
@@ -267,7 +260,6 @@ exports.assetComplianceToTransferRestrictions = assetComplianceToTransferRestric
|
|
|
267
260
|
exports.assetStatToStat = assetStatToStat;
|
|
268
261
|
exports.exemptionToTransferExemption = exemptionToTransferExemption;
|
|
269
262
|
exports.transferReportToTransferBreakdown = transferReportToTransferBreakdown;
|
|
270
|
-
exports.granularCanTransferResultToTransferBreakdown = granularCanTransferResultToTransferBreakdown;
|
|
271
263
|
exports.fundingToRawFunding = fundingToRawFunding;
|
|
272
264
|
exports.offChainFundingReceiptDetailsToMeshReceiptDetails = offChainFundingReceiptDetailsToMeshReceiptDetails;
|
|
273
265
|
exports.claimTypeInputToMiddlewareClaimTypeDetails = claimTypeInputToMiddlewareClaimTypeDetails;
|
|
@@ -718,71 +710,24 @@ function portfolioIdToMeshPortfolioId(portfolioId, context) {
|
|
|
718
710
|
* @hidden
|
|
719
711
|
*/
|
|
720
712
|
function assetHolderIdToMeshAssetHolder(assetHolderId, context) {
|
|
721
|
-
|
|
722
|
-
if (
|
|
723
|
-
if ((0, util_1.hexHasPrefix)(assetHolderId)) {
|
|
724
|
-
if (context.isV7) {
|
|
725
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
726
|
-
return portfolioIdToMeshPortfolioId({ did: assetHolderId }, context);
|
|
727
|
-
}
|
|
728
|
-
return context.createType('PolymeshPrimitivesAssetAssetHolder', {
|
|
729
|
-
Portfolio: portfolioIdToMeshPortfolioId({ did: assetHolderId }, context),
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
if (context.isV7) {
|
|
733
|
-
const account = new internal_1.Account({ address: assetHolderId }, context);
|
|
734
|
-
const identity = yield account.getIdentity();
|
|
735
|
-
if (!identity) {
|
|
736
|
-
throw new internal_1.PolymeshError({
|
|
737
|
-
code: types_3.ErrorCode.UnmetPrerequisite,
|
|
738
|
-
message: 'Invalid string value',
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
return context.createType('PolymeshPrimitivesIdentityIdPortfolioId', {
|
|
742
|
-
did: stringToIdentityId(identity.did, context),
|
|
743
|
-
kind: { AccountId: stringToAccountId(assetHolderId, context) },
|
|
744
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
745
|
-
});
|
|
746
|
-
}
|
|
713
|
+
if (typeof assetHolderId === 'string') {
|
|
714
|
+
if ((0, util_1.hexHasPrefix)(assetHolderId)) {
|
|
747
715
|
return context.createType('PolymeshPrimitivesAssetAssetHolder', {
|
|
748
|
-
|
|
716
|
+
Portfolio: portfolioIdToMeshPortfolioId({ did: assetHolderId }, context),
|
|
749
717
|
});
|
|
750
718
|
}
|
|
751
|
-
if (context.isV7) {
|
|
752
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
753
|
-
return portfolioIdToMeshPortfolioId(assetHolderId, context);
|
|
754
|
-
}
|
|
755
719
|
return context.createType('PolymeshPrimitivesAssetAssetHolder', {
|
|
756
|
-
|
|
720
|
+
Account: stringToAccountId(assetHolderId, context),
|
|
757
721
|
});
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* @hidden
|
|
762
|
-
*/
|
|
763
|
-
function portfolioToPortfolioKind(portfolio, context) {
|
|
764
|
-
let portfolioKind;
|
|
765
|
-
if ((0, typeguards_1.isNumberedPortfolio)(portfolio)) {
|
|
766
|
-
portfolioKind = { User: bigNumberToU64(portfolio.id, context) };
|
|
767
|
-
}
|
|
768
|
-
else {
|
|
769
|
-
portfolioKind = 'Default';
|
|
770
722
|
}
|
|
771
|
-
return context.createType('
|
|
723
|
+
return context.createType('PolymeshPrimitivesAssetAssetHolder', {
|
|
724
|
+
Portfolio: portfolioIdToMeshPortfolioId(assetHolderId, context),
|
|
725
|
+
});
|
|
772
726
|
}
|
|
773
727
|
/**
|
|
774
728
|
* @hidden
|
|
775
729
|
*/
|
|
776
730
|
function assetHolderToAssetHolderKind(assetHolder, context) {
|
|
777
|
-
if (context.isV7) {
|
|
778
|
-
if (assetHolder instanceof internal_1.Account) {
|
|
779
|
-
return context.createType('PolymeshPrimitivesIdentityIdPortfolioKind', {
|
|
780
|
-
AccountId: stringToAccountId(assetHolder.address, context),
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
784
|
-
return portfolioToPortfolioKind(assetHolder, context);
|
|
785
|
-
}
|
|
786
731
|
if (assetHolder instanceof internal_1.Account) {
|
|
787
732
|
return context.createType('PolymeshPrimitivesAssetAssetHolderKind', 'Account');
|
|
788
733
|
}
|
|
@@ -832,8 +777,8 @@ function transactionPermissionsToTxGroups(permissions) {
|
|
|
832
777
|
includedTags = exceptions;
|
|
833
778
|
excludedTags = transactionValues;
|
|
834
779
|
}
|
|
835
|
-
return
|
|
836
|
-
.sort()
|
|
780
|
+
return Object.values(types_3.TxGroup)
|
|
781
|
+
.sort((a, b) => a.localeCompare(b))
|
|
837
782
|
.filter(group => {
|
|
838
783
|
const tagsInGroup = txGroupToTxTags(group);
|
|
839
784
|
return tagsInGroup.every(tag => {
|
|
@@ -859,8 +804,8 @@ function splitTag(tag) {
|
|
|
859
804
|
*/
|
|
860
805
|
function initExtrinsicDict(txValues, message) {
|
|
861
806
|
const extrinsicDict = {};
|
|
862
|
-
|
|
863
|
-
.sort()
|
|
807
|
+
[...new Set(txValues)]
|
|
808
|
+
.sort((a, b) => a.localeCompare(b))
|
|
864
809
|
.forEach(tag => {
|
|
865
810
|
if (tag.includes('.')) {
|
|
866
811
|
const { palletName, dispatchableName } = splitTag(tag);
|
|
@@ -1427,20 +1372,13 @@ function authorizationDataToAuthorization(auth, context) {
|
|
|
1427
1372
|
value: meshPermissionsToPermissions(auth.asJoinIdentity, context),
|
|
1428
1373
|
};
|
|
1429
1374
|
}
|
|
1430
|
-
|
|
1431
|
-
if (auth.isAddRelayerPayingKey || auth.isOldAddRelayerPayingKey) {
|
|
1375
|
+
if (auth.isOldAddRelayerPayingKey) {
|
|
1432
1376
|
const [userKey, payingKey, polyxLimit] = auth.asOldAddRelayerPayingKey;
|
|
1433
1377
|
const value = {
|
|
1434
1378
|
beneficiary: new internal_1.Account({ address: accountIdToString(userKey) }, context),
|
|
1435
1379
|
subsidizer: new internal_1.Account({ address: accountIdToString(payingKey) }, context),
|
|
1436
1380
|
allowance: balanceToBigNumber(polyxLimit),
|
|
1437
1381
|
};
|
|
1438
|
-
if (context.isV7) {
|
|
1439
|
-
return {
|
|
1440
|
-
type: types_3.AuthorizationType.AddRelayerPayingKey, // NOSONAR
|
|
1441
|
-
value,
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1444
1382
|
return {
|
|
1445
1383
|
type: types_3.AuthorizationType.OldAddRelayerPayingKey,
|
|
1446
1384
|
value,
|
|
@@ -1488,42 +1426,6 @@ function stringToMemo(value, context) {
|
|
|
1488
1426
|
assertMemoValid(value);
|
|
1489
1427
|
return context.createType('PolymeshPrimitivesMemo', (0, internal_3.padString)(value, constants_1.MAX_MEMO_LENGTH));
|
|
1490
1428
|
}
|
|
1491
|
-
/**
|
|
1492
|
-
* @hidden
|
|
1493
|
-
*/
|
|
1494
|
-
function u8ToTransferStatus(status) {
|
|
1495
|
-
const code = status.toNumber();
|
|
1496
|
-
const transferStatusMap = new Map([
|
|
1497
|
-
[81, types_3.TransferStatus.Success],
|
|
1498
|
-
[82, types_3.TransferStatus.InsufficientBalance],
|
|
1499
|
-
[83, types_3.TransferStatus.InsufficientAllowance],
|
|
1500
|
-
[84, types_3.TransferStatus.TransfersHalted],
|
|
1501
|
-
[85, types_3.TransferStatus.FundsLocked],
|
|
1502
|
-
[86, types_3.TransferStatus.InvalidSenderAddress],
|
|
1503
|
-
[87, types_3.TransferStatus.InvalidReceiverAddress],
|
|
1504
|
-
[88, types_3.TransferStatus.InvalidOperator],
|
|
1505
|
-
[160, types_3.TransferStatus.InvalidSenderIdentity],
|
|
1506
|
-
[161, types_3.TransferStatus.InvalidReceiverIdentity],
|
|
1507
|
-
[162, types_3.TransferStatus.ComplianceFailure],
|
|
1508
|
-
[163, types_3.TransferStatus.SmartExtensionFailure],
|
|
1509
|
-
[164, types_3.TransferStatus.InvalidGranularity],
|
|
1510
|
-
[165, types_3.TransferStatus.VolumeLimitReached],
|
|
1511
|
-
[166, types_3.TransferStatus.BlockedTransaction],
|
|
1512
|
-
[168, types_3.TransferStatus.FundsLimitReached],
|
|
1513
|
-
[169, types_3.TransferStatus.PortfolioFailure],
|
|
1514
|
-
[170, types_3.TransferStatus.CustodianError],
|
|
1515
|
-
[171, types_3.TransferStatus.ScopeClaimMissing],
|
|
1516
|
-
[172, types_3.TransferStatus.TransferRestrictionFailure],
|
|
1517
|
-
[80, types_3.TransferStatus.Failure],
|
|
1518
|
-
]);
|
|
1519
|
-
if (transferStatusMap.has(code)) {
|
|
1520
|
-
return transferStatusMap.get(code);
|
|
1521
|
-
}
|
|
1522
|
-
throw new internal_1.PolymeshError({
|
|
1523
|
-
code: types_3.ErrorCode.UnexpectedError,
|
|
1524
|
-
message: `Unsupported status code "${status.toString()}". Please report this issue to the Polymesh team`,
|
|
1525
|
-
});
|
|
1526
|
-
}
|
|
1527
1429
|
/**
|
|
1528
1430
|
* @hidden
|
|
1529
1431
|
*/
|
|
@@ -1915,15 +1817,6 @@ function documentToAssetDocumentWithId({ document, id, }) {
|
|
|
1915
1817
|
const assetDoc = documentToAssetDocument(document);
|
|
1916
1818
|
return Object.assign(Object.assign({}, assetDoc), { id: u32ToBigNumber(id) });
|
|
1917
1819
|
}
|
|
1918
|
-
/**
|
|
1919
|
-
* @hidden
|
|
1920
|
-
*/
|
|
1921
|
-
function cddStatusToBoolean(cddStatus) {
|
|
1922
|
-
if (cddStatus.isOk) {
|
|
1923
|
-
return true;
|
|
1924
|
-
}
|
|
1925
|
-
return false;
|
|
1926
|
-
}
|
|
1927
1820
|
/**
|
|
1928
1821
|
* @hidden
|
|
1929
1822
|
*/
|
|
@@ -2335,42 +2228,6 @@ function meshConditionTypeToCondition(meshConditionType, context) {
|
|
|
2335
2228
|
claims: meshConditionType.asIsNoneOf.map(claim => meshClaimToClaim(claim)),
|
|
2336
2229
|
};
|
|
2337
2230
|
}
|
|
2338
|
-
/**
|
|
2339
|
-
* @hidden
|
|
2340
|
-
* @note - the data for this method comes from an RPC call, which hasn't been updated to the camelCase types
|
|
2341
|
-
*/
|
|
2342
|
-
function complianceRequirementResultToRequirementCompliance(complianceRequirement, context) {
|
|
2343
|
-
const conditions = [];
|
|
2344
|
-
const conditionCompliancesAreEqual = ({ condition: aCondition, complies: aComplies }, { condition: bCondition, complies: bComplies }) => (0, internal_3.conditionsAreEqual)(aCondition, bCondition) && aComplies === bComplies;
|
|
2345
|
-
complianceRequirement.senderConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
|
|
2346
|
-
const newCondition = {
|
|
2347
|
-
condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
|
|
2348
|
-
complies: boolToBoolean(result),
|
|
2349
|
-
};
|
|
2350
|
-
const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
|
|
2351
|
-
if (!existingCondition) {
|
|
2352
|
-
conditions.push(newCondition);
|
|
2353
|
-
}
|
|
2354
|
-
});
|
|
2355
|
-
complianceRequirement.receiverConditions.forEach(({ condition: { conditionType, issuers }, result }) => {
|
|
2356
|
-
const newCondition = {
|
|
2357
|
-
condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Receiver, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
|
|
2358
|
-
complies: boolToBoolean(result),
|
|
2359
|
-
};
|
|
2360
|
-
const existingCondition = conditions.find(condition => conditionCompliancesAreEqual(condition, newCondition));
|
|
2361
|
-
if (existingCondition && existingCondition.condition.target === types_3.ConditionTarget.Sender) {
|
|
2362
|
-
existingCondition.condition.target = types_3.ConditionTarget.Both;
|
|
2363
|
-
}
|
|
2364
|
-
else {
|
|
2365
|
-
conditions.push(newCondition);
|
|
2366
|
-
}
|
|
2367
|
-
});
|
|
2368
|
-
return {
|
|
2369
|
-
id: u32ToBigNumber(complianceRequirement.id),
|
|
2370
|
-
conditions,
|
|
2371
|
-
complies: boolToBoolean(complianceRequirement.result),
|
|
2372
|
-
};
|
|
2373
|
-
}
|
|
2374
2231
|
/**
|
|
2375
2232
|
* @hidden
|
|
2376
2233
|
*/
|
|
@@ -2382,7 +2239,7 @@ function complianceRequirementReportToRequirementCompliance(complianceRequiremen
|
|
|
2382
2239
|
condition: Object.assign(Object.assign({}, meshConditionTypeToCondition(conditionType, context)), { target: types_3.ConditionTarget.Sender, trustedClaimIssuers: issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context)) }),
|
|
2383
2240
|
complies: boolToBoolean(satisfied),
|
|
2384
2241
|
};
|
|
2385
|
-
const existingCondition = conditions.
|
|
2242
|
+
const existingCondition = conditions.some(condition => conditionCompliancesAreEqual(condition, newCondition));
|
|
2386
2243
|
if (!existingCondition) {
|
|
2387
2244
|
conditions.push(newCondition);
|
|
2388
2245
|
}
|
|
@@ -2416,7 +2273,7 @@ function complianceRequirementToRequirement(complianceRequirement, context) {
|
|
|
2416
2273
|
if (issuers.length) {
|
|
2417
2274
|
newCondition.trustedClaimIssuers = issuers.map(trustedIssuer => trustedIssuerToTrustedClaimIssuer(trustedIssuer, context));
|
|
2418
2275
|
}
|
|
2419
|
-
const existingCondition = conditions.
|
|
2276
|
+
const existingCondition = conditions.some(condition => (0, internal_3.conditionsAreEqual)(condition, newCondition));
|
|
2420
2277
|
if (!existingCondition) {
|
|
2421
2278
|
conditions.push(newCondition);
|
|
2422
2279
|
}
|
|
@@ -2443,35 +2300,57 @@ function complianceRequirementToRequirement(complianceRequirement, context) {
|
|
|
2443
2300
|
* @hidden
|
|
2444
2301
|
*/
|
|
2445
2302
|
function txTagToProtocolOp(tag, context) {
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
types_3.TxTags.
|
|
2462
|
-
types_3.TxTags.
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2303
|
+
/*
|
|
2304
|
+
* NOTE: a tag cannot be translated into a `ProtocolOp` mechanically, for two reasons:
|
|
2305
|
+
*
|
|
2306
|
+
* - the variant names do not always match the extrinsic they bill for. Several kept their pre-v8
|
|
2307
|
+
* names through extrinsic renames, so `asset.registerUniqueTicker` is still billed as
|
|
2308
|
+
* `AssetRegisterTicker`. Deriving the variant from the tag string produces names the runtime
|
|
2309
|
+
* does not know.
|
|
2310
|
+
* - several extrinsics bill under a variant named after a *different* extrinsic, because they
|
|
2311
|
+
* delegate to it. `corporateAction.initiateCorporateActionAndDistribute` charges
|
|
2312
|
+
* `CapitalDistributionDistribute`, and every DID registration variant charges
|
|
2313
|
+
* `IdentityRegisterDid`.
|
|
2314
|
+
*
|
|
2315
|
+
* The mapping is therefore explicit, and mirrors the runtime's `charge_fee` call sites.
|
|
2316
|
+
*/
|
|
2317
|
+
const protocolOpTags = new Map([
|
|
2318
|
+
[types_3.TxTags.asset.RegisterUniqueTicker, 'AssetRegisterTicker'],
|
|
2319
|
+
[types_3.TxTags.asset.Issue, 'AssetIssue'],
|
|
2320
|
+
[types_3.TxTags.asset.AddDocuments, 'AssetAddDocuments'],
|
|
2321
|
+
[types_3.TxTags.asset.CreateAsset, 'AssetCreateAsset'],
|
|
2322
|
+
// registers the custom type inline, and bills only the one asset creation fee
|
|
2323
|
+
[types_3.TxTags.asset.CreateAssetWithCustomType, 'AssetCreateAsset'],
|
|
2324
|
+
[types_3.TxTags.capitalDistribution.Distribute, 'CapitalDistributionDistribute'],
|
|
2325
|
+
[types_3.TxTags.corporateAction.InitiateCorporateActionAndDistribute, 'CapitalDistributionDistribute'],
|
|
2326
|
+
[types_3.TxTags.checkpoint.CreateSchedule, 'CheckpointCreateSchedule'],
|
|
2327
|
+
[
|
|
2328
|
+
types_3.TxTags.complianceManager.AddComplianceRequirement,
|
|
2329
|
+
'ComplianceManagerAddComplianceRequirement',
|
|
2330
|
+
],
|
|
2331
|
+
[types_3.TxTags.identity.CddRegisterDid, 'IdentityRegisterDid'],
|
|
2332
|
+
[types_3.TxTags.identity.CddRegisterDidWithCdd, 'IdentityRegisterDid'],
|
|
2333
|
+
[types_3.TxTags.identity.RegisterDid, 'IdentityRegisterDid'],
|
|
2334
|
+
[types_3.TxTags.identity.SelfRegisterDid, 'IdentityRegisterDid'],
|
|
2335
|
+
[types_3.TxTags.identity.AddClaim, 'IdentityAddClaim'],
|
|
2336
|
+
[
|
|
2337
|
+
types_3.TxTags.identity.AddSecondaryKeysWithAuthorization,
|
|
2338
|
+
'IdentityAddSecondaryKeysWithAuthorization',
|
|
2339
|
+
],
|
|
2340
|
+
[types_3.TxTags.pips.Propose, 'PipsPropose'],
|
|
2341
|
+
[types_3.TxTags.corporateBallot.AttachBallot, 'CorporateBallotAttachBallot'],
|
|
2342
|
+
[types_3.TxTags.corporateAction.InitiateCorporateActionAndBallot, 'CorporateBallotAttachBallot'],
|
|
2343
|
+
[types_3.TxTags.nft.CreateNftCollection, 'NFTCreateCollection'],
|
|
2344
|
+
[types_3.TxTags.nft.IssueNft, 'NFTMint'],
|
|
2345
|
+
]);
|
|
2346
|
+
const value = protocolOpTags.get(tag);
|
|
2347
|
+
if (!value) {
|
|
2348
|
+
const [moduleName, extrinsicName] = tag.split('.');
|
|
2467
2349
|
throw new internal_1.PolymeshError({
|
|
2468
2350
|
code: types_3.ErrorCode.ValidationError,
|
|
2469
|
-
message: `${
|
|
2351
|
+
message: `${(0, util_1.stringUpperFirst)(moduleName)}${(0, util_1.stringUpperFirst)(extrinsicName)} does not match any PolymeshPrimitivesProtocolFeeProtocolOp`,
|
|
2470
2352
|
});
|
|
2471
2353
|
}
|
|
2472
|
-
if (context.isV7) {
|
|
2473
|
-
return context.createType('PolymeshCommonUtilitiesProtocolFeeProtocolOp', value);
|
|
2474
|
-
}
|
|
2475
2354
|
return context.createType('PolymeshPrimitivesProtocolFeeProtocolOp', value);
|
|
2476
2355
|
}
|
|
2477
2356
|
/**
|
|
@@ -2497,17 +2376,6 @@ function txTagToExtrinsicIdentifier(tag) {
|
|
|
2497
2376
|
callId: (0, lodash_1.snakeCase)(extrinsicName),
|
|
2498
2377
|
};
|
|
2499
2378
|
}
|
|
2500
|
-
/**
|
|
2501
|
-
* @hidden
|
|
2502
|
-
*/
|
|
2503
|
-
function assetComplianceResultToCompliance(assetComplianceResult, context) {
|
|
2504
|
-
const { requirements: rawRequirements, result, paused } = assetComplianceResult;
|
|
2505
|
-
const requirements = rawRequirements.map(requirement => complianceRequirementResultToRequirementCompliance(requirement, context));
|
|
2506
|
-
return {
|
|
2507
|
-
requirements,
|
|
2508
|
-
complies: boolToBoolean(paused) || boolToBoolean(result),
|
|
2509
|
-
};
|
|
2510
|
-
}
|
|
2511
2379
|
/**
|
|
2512
2380
|
* @hidden
|
|
2513
2381
|
*/
|
|
@@ -2859,22 +2727,10 @@ function addressesToBtreeSet(addresses, context) {
|
|
|
2859
2727
|
const rawIds = addresses.map(address => stringToAccountId(address, context));
|
|
2860
2728
|
return context.createType('BTreeSet<AccountId32>', rawIds);
|
|
2861
2729
|
}
|
|
2862
|
-
/**
|
|
2863
|
-
* @hidden
|
|
2864
|
-
*/
|
|
2865
|
-
function portfolioIdsToBtreeSet(rawPortfolioIds, context) {
|
|
2866
|
-
return context.createType('BTreeSet<PolymeshPrimitivesIdentityIdPortfolioId>', (0, lodash_1.uniqWith)(rawPortfolioIds, lodash_1.isEqual));
|
|
2867
|
-
}
|
|
2868
2730
|
/**
|
|
2869
2731
|
* @hidden
|
|
2870
2732
|
*/
|
|
2871
2733
|
function assetHolderIdsToBtreeSet(rawAssetHolderIds, context) {
|
|
2872
|
-
if (context.isV7) {
|
|
2873
|
-
return portfolioIdsToBtreeSet(rawAssetHolderIds, // NOSONAR
|
|
2874
|
-
context
|
|
2875
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2876
|
-
);
|
|
2877
|
-
}
|
|
2878
2734
|
return context.createType('BTreeSet<PolymeshPrimitivesAssetAssetHolder>', (0, lodash_1.uniqWith)(rawAssetHolderIds, lodash_1.isEqual));
|
|
2879
2735
|
}
|
|
2880
2736
|
/**
|
|
@@ -2889,7 +2745,7 @@ function identitiesSetToIdentities(identitySet, context) {
|
|
|
2889
2745
|
function assetDispatchErrorToTransferError(error, context) {
|
|
2890
2746
|
var _a;
|
|
2891
2747
|
const { asset: assetErrors, portfolio: portfolioErrors, statistics: statisticsError, } = context.polymeshApi.errors;
|
|
2892
|
-
|
|
2748
|
+
const record = [
|
|
2893
2749
|
[assetErrors.NoSuchAsset, types_3.TransferError.AssetDoesNotExists],
|
|
2894
2750
|
[assetErrors.InvalidGranularity, types_3.TransferError.InvalidGranularity],
|
|
2895
2751
|
[assetErrors.SenderSameAsReceiver, types_3.TransferError.SelfTransfer],
|
|
@@ -2898,24 +2754,11 @@ function assetDispatchErrorToTransferError(error, context) {
|
|
|
2898
2754
|
[assetErrors.InvalidTransferFrozenAsset, types_3.TransferError.TransfersFrozen],
|
|
2899
2755
|
[portfolioErrors.PortfolioDoesNotExist, types_3.TransferError.InvalidSenderPortfolio],
|
|
2900
2756
|
[portfolioErrors.InsufficientPortfolioBalance, types_3.TransferError.InsufficientPortfolioBalance],
|
|
2757
|
+
[assetErrors.InvalidTransferInvalidReceiverDID, types_3.TransferError.InvalidReceiverIdentity],
|
|
2901
2758
|
[assetErrors.InvalidTransferComplianceFailure, types_3.TransferError.ComplianceFailure],
|
|
2902
2759
|
[assetErrors.InvalidTransfer, types_3.TransferError.ComplianceFailure],
|
|
2903
2760
|
[statisticsError.InvalidTransferStatisticsFailure, types_3.TransferError.TransferNotAllowed],
|
|
2904
2761
|
];
|
|
2905
|
-
if (context.isV7) {
|
|
2906
|
-
record = [
|
|
2907
|
-
...record,
|
|
2908
|
-
[
|
|
2909
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2910
|
-
portfolioErrors.InvalidTransferSenderIdMatchesReceiverId,
|
|
2911
|
-
types_3.TransferError.SelfTransfer,
|
|
2912
|
-
],
|
|
2913
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2914
|
-
[assetErrors.InvalidTransferInvalidReceiverCDD, types_3.TransferError.InvalidReceiverCdd],
|
|
2915
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2916
|
-
[assetErrors.InvalidTransferInvalidSenderCDD, types_3.TransferError.InvalidSenderCdd],
|
|
2917
|
-
];
|
|
2918
|
-
}
|
|
2919
2762
|
if (error.isModule) {
|
|
2920
2763
|
const moduleErr = error.asModule;
|
|
2921
2764
|
const errorCase = record.find(([augmentedError]) => augmentedError === null || augmentedError === void 0 ? void 0 : augmentedError.is(moduleErr));
|
|
@@ -2940,7 +2783,8 @@ function assetDispatchErrorToTransferError(error, context) {
|
|
|
2940
2783
|
* @hidden
|
|
2941
2784
|
*/
|
|
2942
2785
|
function nftDispatchErrorToTransferError(error, context) {
|
|
2943
|
-
|
|
2786
|
+
var _a;
|
|
2787
|
+
const { DuplicatedNFTId: duplicateErr, InvalidNFTTransferCollectionNotFound: collectionNotFoundErr, InvalidNFTTransferComplianceFailure: complianceErr, InvalidNFTTransferCountOverflow: countOverflowErr, InvalidNFTTransferFrozenAsset: frozenErr, InvalidNFTTransferInsufficientCount: insufficientErr, InvalidNFTTransferInvalidReceiverDID: invalidReceiverErr, NFTNotFound: notFoundErr, InvalidNFTTransferNFTNotOwned: notOwnedErr, InvalidNFTTransferSamePortfolio: samePortfolioErr, InvalidNFTTransferSenderDidMatchesReceiverDid: sameIdentityErr, InvalidNFTTransferNFTIsLocked: nftLockedErr, } = context.polymeshApi.errors.nft;
|
|
2944
2788
|
if (error.isModule) {
|
|
2945
2789
|
const moduleErr = error.asModule;
|
|
2946
2790
|
if ([notOwnedErr, notFoundErr, insufficientErr, duplicateErr, nftLockedErr].some(err => err.is(moduleErr))) {
|
|
@@ -2952,9 +2796,24 @@ function nftDispatchErrorToTransferError(error, context) {
|
|
|
2952
2796
|
else if (complianceErr.is(moduleErr)) {
|
|
2953
2797
|
return types_3.TransferError.ComplianceFailure;
|
|
2954
2798
|
}
|
|
2955
|
-
else if (samePortfolioErr.is(moduleErr)) {
|
|
2799
|
+
else if ([samePortfolioErr, sameIdentityErr].some(err => err.is(moduleErr))) {
|
|
2956
2800
|
return types_3.TransferError.SelfTransfer;
|
|
2957
2801
|
}
|
|
2802
|
+
else if (collectionNotFoundErr.is(moduleErr)) {
|
|
2803
|
+
return types_3.TransferError.AssetDoesNotExists;
|
|
2804
|
+
}
|
|
2805
|
+
else if (countOverflowErr.is(moduleErr)) {
|
|
2806
|
+
return types_3.TransferError.BalanceOverflow;
|
|
2807
|
+
}
|
|
2808
|
+
else if (invalidReceiverErr.is(moduleErr)) {
|
|
2809
|
+
return types_3.TransferError.InvalidReceiverIdentity;
|
|
2810
|
+
}
|
|
2811
|
+
// report the chain's own name for errors with no `TransferError` equivalent
|
|
2812
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2813
|
+
const errorMeta = (_a = moduleErr.registry) === null || _a === void 0 ? void 0 : _a.findMetaError(moduleErr);
|
|
2814
|
+
if (errorMeta) {
|
|
2815
|
+
return errorMeta.name;
|
|
2816
|
+
}
|
|
2958
2817
|
}
|
|
2959
2818
|
throw new internal_1.PolymeshError({
|
|
2960
2819
|
code: types_3.ErrorCode.UnexpectedError,
|
|
@@ -3007,8 +2866,8 @@ function permissionsLikeToPermissions(permissionsLike, context) {
|
|
|
3007
2866
|
transactionPermissions = transactions;
|
|
3008
2867
|
}
|
|
3009
2868
|
else if (transactionGroups !== undefined) {
|
|
3010
|
-
transactionGroupPermissions =
|
|
3011
|
-
const groupTags =
|
|
2869
|
+
transactionGroupPermissions = [...new Set(transactionGroups)];
|
|
2870
|
+
const groupTags = transactionGroups.map(txGroupToTxTags).flat();
|
|
3012
2871
|
transactionPermissions = Object.assign(Object.assign({}, transactionPermissions), { values: groupTags });
|
|
3013
2872
|
}
|
|
3014
2873
|
if (portfolios === null) {
|
|
@@ -3859,7 +3718,7 @@ function expiryToMoment(expiry, context) {
|
|
|
3859
3718
|
}
|
|
3860
3719
|
/**
|
|
3861
3720
|
* @hidden
|
|
3862
|
-
* Note: currently only supports fungible legs
|
|
3721
|
+
* Note: currently only supports fungible legs
|
|
3863
3722
|
*/
|
|
3864
3723
|
function middlewarePortfolioDataToPortfolio(data, context) {
|
|
3865
3724
|
const { did, kind } = data;
|
|
@@ -4076,7 +3935,7 @@ function middlewareAuthorizationDataToAuthorization(context, type, data) {
|
|
|
4076
3935
|
});
|
|
4077
3936
|
}
|
|
4078
3937
|
return {
|
|
4079
|
-
type: types_3.AuthorizationType.
|
|
3938
|
+
type: types_3.AuthorizationType.OldAddRelayerPayingKey,
|
|
4080
3939
|
value: {
|
|
4081
3940
|
beneficiary: new internal_1.Account({ address: beneficiary }, context),
|
|
4082
3941
|
subsidizer: new internal_1.Account({ address: subsidizer }, context),
|
|
@@ -4284,19 +4143,7 @@ function createRawExtrinsicStatus(status, value, context) {
|
|
|
4284
4143
|
*/
|
|
4285
4144
|
function signatureToMeshRuntimeMultiSignature(type, value, context) {
|
|
4286
4145
|
let rawValue;
|
|
4287
|
-
if (
|
|
4288
|
-
if (type === types_3.SignerKeyRingType.Ecdsa) {
|
|
4289
|
-
rawValue = context.createType('SpCoreEcdsaSignature', value);
|
|
4290
|
-
}
|
|
4291
|
-
else if (type === types_3.SignerKeyRingType.Ed25519) {
|
|
4292
|
-
rawValue = context.createType('SpCoreEd25519Signature', value);
|
|
4293
|
-
}
|
|
4294
|
-
else {
|
|
4295
|
-
// assume sr 25519
|
|
4296
|
-
rawValue = context.createType('SpCoreSr25519Signature', value);
|
|
4297
|
-
}
|
|
4298
|
-
}
|
|
4299
|
-
else if (type === types_3.SignerKeyRingType.Ecdsa) {
|
|
4146
|
+
if (type === types_3.SignerKeyRingType.Ecdsa) {
|
|
4300
4147
|
// Ecdsa signatures are 65 bytes (64 byte signature + 1 byte recovery ID)
|
|
4301
4148
|
rawValue = context.createType('[u8;65]', value);
|
|
4302
4149
|
}
|
|
@@ -4331,13 +4178,21 @@ function receiptDetailsToMeshReceiptDetails(receiptDetails, instructionId, conte
|
|
|
4331
4178
|
const rawInstructionId = bigNumberToU64(instructionId, context);
|
|
4332
4179
|
const rawReceiptDetails = receiptDetails.map(({ legId, uid, signer, signature, metadata, expiresAt }) => {
|
|
4333
4180
|
const { address: signerAddress } = (0, internal_3.asAccount)(signer, context);
|
|
4334
|
-
if (!expiresAt
|
|
4181
|
+
if (!expiresAt) {
|
|
4335
4182
|
throw new internal_1.PolymeshError({
|
|
4336
4183
|
code: types_3.ErrorCode.UnmetPrerequisite,
|
|
4337
|
-
message: '`expiresAt` is
|
|
4184
|
+
message: '`expiresAt` is required',
|
|
4338
4185
|
});
|
|
4339
4186
|
}
|
|
4340
|
-
return context.createType('PolymeshPrimitivesSettlementReceiptDetails',
|
|
4187
|
+
return context.createType('PolymeshPrimitivesSettlementReceiptDetails', {
|
|
4188
|
+
uid: bigNumberToU64(uid, context),
|
|
4189
|
+
instructionId: rawInstructionId,
|
|
4190
|
+
legId: bigNumberToU64(legId, context),
|
|
4191
|
+
signer: stringToAccountId(signerAddress, context),
|
|
4192
|
+
signature: signatureToMeshRuntimeMultiSignature(signature.type, signature.value, context),
|
|
4193
|
+
expiresAt: dateToMoment(expiresAt, context),
|
|
4194
|
+
metadata: (0, internal_3.optionize)(offChainMetadataToMeshReceiptMetadata)(metadata, context),
|
|
4195
|
+
});
|
|
4341
4196
|
});
|
|
4342
4197
|
return context.createType('Vec<PolymeshPrimitivesSettlementReceiptDetails>', rawReceiptDetails);
|
|
4343
4198
|
}
|
|
@@ -4356,23 +4211,8 @@ function secondaryAccountWithAuthToSecondaryKeyWithAuth(accounts, context) {
|
|
|
4356
4211
|
authSignature: stringToH512(authSignature, context),
|
|
4357
4212
|
};
|
|
4358
4213
|
});
|
|
4359
|
-
if (context.isV7) {
|
|
4360
|
-
return context.createType('Vec<PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth>', keyWithAuths);
|
|
4361
|
-
}
|
|
4362
4214
|
return context.createType('Vec<PolymeshPrimitivesIdentitySecondaryKeyWithAuth>', keyWithAuths);
|
|
4363
4215
|
}
|
|
4364
|
-
/**
|
|
4365
|
-
* @hidden
|
|
4366
|
-
*
|
|
4367
|
-
* @deprecated no longer supported in chain v8
|
|
4368
|
-
*/
|
|
4369
|
-
function childKeysWithAuthToCreateChildIdentitiesWithAuth(childKeyAuths, context) {
|
|
4370
|
-
const keyWithAuths = childKeyAuths.map(({ key, authSignature }) => ({
|
|
4371
|
-
key: stringToAccountId((0, internal_3.asAccount)(key, context).address, context),
|
|
4372
|
-
authSignature: stringToH512(authSignature, context),
|
|
4373
|
-
}));
|
|
4374
|
-
return context.createType('Vec<PolymeshCommonUtilitiesIdentityCreateChildIdentityWithAuth>', keyWithAuths);
|
|
4375
|
-
}
|
|
4376
4216
|
/**
|
|
4377
4217
|
* @hidden
|
|
4378
4218
|
*/
|
|
@@ -4397,9 +4237,6 @@ function stakingRewardDestinationToRaw(destination, context) {
|
|
|
4397
4237
|
else if ('stash' in destination) {
|
|
4398
4238
|
return context.createType('RewardDestination', { Stash: true });
|
|
4399
4239
|
}
|
|
4400
|
-
else if ('controller' in destination) {
|
|
4401
|
-
return context.createType('RewardDestination', { Controller: true });
|
|
4402
|
-
}
|
|
4403
4240
|
else {
|
|
4404
4241
|
const rawId = stringToAccountId(destination.account.address, context);
|
|
4405
4242
|
return context.createType('RewardDestination', { Account: rawId });
|
|
@@ -4462,30 +4299,7 @@ function rewardDestinationToPayee(destination, stash, controller, context) {
|
|
|
4462
4299
|
* @hidden
|
|
4463
4300
|
*/
|
|
4464
4301
|
function rawStakingLedgerToStakingLedgerEntry(ledger, context) {
|
|
4465
|
-
|
|
4466
|
-
let rawActive;
|
|
4467
|
-
let rawClaimedRewards;
|
|
4468
|
-
let rawUnlocking;
|
|
4469
|
-
let rawStash;
|
|
4470
|
-
if (context.isV7) {
|
|
4471
|
-
({
|
|
4472
|
-
total: rawTotal,
|
|
4473
|
-
active: rawActive,
|
|
4474
|
-
unlocking: rawUnlocking,
|
|
4475
|
-
claimedRewards: rawClaimedRewards,
|
|
4476
|
-
stash: rawStash,
|
|
4477
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4478
|
-
} = ledger);
|
|
4479
|
-
}
|
|
4480
|
-
else {
|
|
4481
|
-
({
|
|
4482
|
-
total: rawTotal,
|
|
4483
|
-
active: rawActive,
|
|
4484
|
-
unlocking: rawUnlocking,
|
|
4485
|
-
legacyClaimedRewards: rawClaimedRewards,
|
|
4486
|
-
stash: rawStash,
|
|
4487
|
-
} = ledger);
|
|
4488
|
-
}
|
|
4302
|
+
const { total: rawTotal, active: rawActive, unlocking: rawUnlocking, legacyClaimedRewards: rawClaimedRewards, stash: rawStash, } = ledger;
|
|
4489
4303
|
const total = balanceToBigNumber(rawTotal.unwrap());
|
|
4490
4304
|
const active = balanceToBigNumber(rawActive.unwrap());
|
|
4491
4305
|
const unlocking = rawUnlocking.map(unlock => ({
|
|
@@ -4769,58 +4583,6 @@ function transferReportToTransferBreakdown(result, validateNftResult, compliance
|
|
|
4769
4583
|
result: canTransfer,
|
|
4770
4584
|
};
|
|
4771
4585
|
}
|
|
4772
|
-
/**
|
|
4773
|
-
* @hidden
|
|
4774
|
-
*/
|
|
4775
|
-
function granularCanTransferResultToTransferBreakdown(result, validateNftResult, context) {
|
|
4776
|
-
const { invalidGranularity, selfTransfer, invalidReceiverCdd, invalidSenderCdd, senderInsufficientBalance: insufficientBalance, assetFrozen, portfolioValidityResult: { senderPortfolioDoesNotExist, receiverPortfolioDoesNotExist, senderInsufficientBalance, }, transferConditionResult, complianceResult, result: finalResult, } = result;
|
|
4777
|
-
const general = [];
|
|
4778
|
-
if (boolToBoolean(invalidGranularity)) {
|
|
4779
|
-
general.push(types_3.TransferError.InvalidGranularity);
|
|
4780
|
-
}
|
|
4781
|
-
if (boolToBoolean(selfTransfer)) {
|
|
4782
|
-
general.push(types_3.TransferError.SelfTransfer);
|
|
4783
|
-
}
|
|
4784
|
-
if (boolToBoolean(invalidReceiverCdd)) {
|
|
4785
|
-
general.push(types_3.TransferError.InvalidReceiverCdd);
|
|
4786
|
-
}
|
|
4787
|
-
if (boolToBoolean(invalidSenderCdd)) {
|
|
4788
|
-
general.push(types_3.TransferError.InvalidSenderCdd);
|
|
4789
|
-
}
|
|
4790
|
-
if (boolToBoolean(insufficientBalance)) {
|
|
4791
|
-
general.push(types_3.TransferError.InsufficientBalance);
|
|
4792
|
-
}
|
|
4793
|
-
if (boolToBoolean(assetFrozen)) {
|
|
4794
|
-
general.push(types_3.TransferError.TransfersFrozen);
|
|
4795
|
-
}
|
|
4796
|
-
if (boolToBoolean(senderPortfolioDoesNotExist)) {
|
|
4797
|
-
general.push(types_3.TransferError.InvalidSenderPortfolio);
|
|
4798
|
-
}
|
|
4799
|
-
if (boolToBoolean(receiverPortfolioDoesNotExist)) {
|
|
4800
|
-
general.push(types_3.TransferError.InvalidReceiverPortfolio);
|
|
4801
|
-
}
|
|
4802
|
-
if (boolToBoolean(senderInsufficientBalance)) {
|
|
4803
|
-
general.push(types_3.TransferError.InsufficientPortfolioBalance);
|
|
4804
|
-
}
|
|
4805
|
-
const restrictions = transferConditionResult.map(({ condition, result: tmResult }) => {
|
|
4806
|
-
return {
|
|
4807
|
-
restriction: transferConditionToTransferRestriction(condition, context),
|
|
4808
|
-
result: boolToBoolean(tmResult),
|
|
4809
|
-
};
|
|
4810
|
-
});
|
|
4811
|
-
let canTransfer = boolToBoolean(finalResult);
|
|
4812
|
-
if (canTransfer && (validateNftResult === null || validateNftResult === void 0 ? void 0 : validateNftResult.isErr)) {
|
|
4813
|
-
const transferError = nftDispatchErrorToTransferError(validateNftResult.asErr, context);
|
|
4814
|
-
general.push(transferError);
|
|
4815
|
-
canTransfer = false;
|
|
4816
|
-
}
|
|
4817
|
-
return {
|
|
4818
|
-
general,
|
|
4819
|
-
compliance: assetComplianceResultToCompliance(complianceResult, context),
|
|
4820
|
-
restrictions,
|
|
4821
|
-
result: canTransfer,
|
|
4822
|
-
};
|
|
4823
|
-
}
|
|
4824
4586
|
/**
|
|
4825
4587
|
* @hidden
|
|
4826
4588
|
*/
|