@polymeshassociation/polymesh-sdk 29.1.0-beta.9 → 30.0.0-beta.2
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/.releaserc.js +46 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +4 -2
- package/README.md +1 -1
- package/api/client/AccountManagement.d.ts +29 -1
- package/api/client/AccountManagement.d.ts.map +1 -1
- package/api/client/AccountManagement.js +5 -2
- package/api/client/AccountManagement.js.map +1 -1
- package/api/client/Assets.d.ts +9 -1
- package/api/client/Assets.d.ts.map +1 -1
- package/api/client/Assets.js +3 -0
- package/api/client/Assets.js.map +1 -1
- package/api/client/Claims.d.ts +2 -0
- package/api/client/Claims.d.ts.map +1 -1
- package/api/client/Claims.js +21 -9
- package/api/client/Claims.js.map +1 -1
- package/api/client/Identities.d.ts +16 -4
- package/api/client/Identities.d.ts.map +1 -1
- package/api/client/Identities.js +5 -1
- package/api/client/Identities.js.map +1 -1
- package/api/client/Polymesh.d.ts.map +1 -1
- package/api/client/Polymesh.js +3 -1
- package/api/client/Polymesh.js.map +1 -1
- package/api/client/Staking.d.ts +1 -0
- package/api/client/Staking.d.ts.map +1 -1
- package/api/client/Staking.js.map +1 -1
- package/api/client/types.d.ts +5 -1
- package/api/client/types.d.ts.map +1 -1
- package/api/client/types.js +4 -0
- package/api/client/types.js.map +1 -1
- package/api/entities/Account/Staking/index.d.ts.map +1 -1
- package/api/entities/Account/Staking/index.js +11 -3
- package/api/entities/Account/Staking/index.js.map +1 -1
- package/api/entities/Account/index.d.ts +18 -2
- package/api/entities/Account/index.d.ts.map +1 -1
- package/api/entities/Account/index.js +119 -2
- package/api/entities/Account/index.js.map +1 -1
- package/api/entities/Asset/Base/Settlements/index.d.ts +15 -15
- package/api/entities/Asset/Base/Settlements/index.d.ts.map +1 -1
- package/api/entities/Asset/Base/Settlements/index.js +33 -16
- package/api/entities/Asset/Base/Settlements/index.js.map +1 -1
- package/api/entities/Asset/Fungible/Checkpoints/Schedules.js.map +1 -1
- package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts +15 -0
- package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts.map +1 -1
- package/api/entities/Asset/Fungible/TransferRestrictions/index.js +75 -11
- package/api/entities/Asset/Fungible/TransferRestrictions/index.js.map +1 -1
- package/api/entities/Asset/Fungible/index.d.ts +18 -2
- package/api/entities/Asset/Fungible/index.d.ts.map +1 -1
- package/api/entities/Asset/Fungible/index.js +23 -2
- package/api/entities/Asset/Fungible/index.js.map +1 -1
- package/api/entities/Asset/NonFungible/AssetHolders/index.js.map +1 -1
- package/api/entities/Asset/NonFungible/Nft.d.ts +2 -2
- package/api/entities/Asset/NonFungible/Nft.d.ts.map +1 -1
- package/api/entities/Asset/NonFungible/Nft.js +21 -6
- package/api/entities/Asset/NonFungible/Nft.js.map +1 -1
- package/api/entities/Asset/NonFungible/NftCollection.d.ts.map +1 -1
- package/api/entities/Asset/NonFungible/NftCollection.js +6 -2
- package/api/entities/Asset/NonFungible/NftCollection.js.map +1 -1
- package/api/entities/Asset/types.d.ts +15 -2
- package/api/entities/Asset/types.d.ts.map +1 -1
- package/api/entities/Asset/types.js +7 -1
- package/api/entities/Asset/types.js.map +1 -1
- package/api/entities/Identity/ChildIdentity.d.ts +8 -0
- package/api/entities/Identity/ChildIdentity.d.ts.map +1 -1
- package/api/entities/Identity/ChildIdentity.js +14 -0
- package/api/entities/Identity/ChildIdentity.js.map +1 -1
- package/api/entities/Identity/index.d.ts +21 -2
- package/api/entities/Identity/index.d.ts.map +1 -1
- package/api/entities/Identity/index.js +76 -18
- package/api/entities/Identity/index.js.map +1 -1
- package/api/entities/Instruction/index.d.ts +6 -1
- package/api/entities/Instruction/index.d.ts.map +1 -1
- package/api/entities/Instruction/index.js +72 -31
- package/api/entities/Instruction/index.js.map +1 -1
- package/api/entities/Instruction/types.d.ts +11 -6
- package/api/entities/Instruction/types.d.ts.map +1 -1
- package/api/entities/Instruction/types.js +6 -1
- package/api/entities/Instruction/types.js.map +1 -1
- package/api/entities/Portfolio/index.d.ts.map +1 -1
- package/api/entities/Portfolio/index.js +33 -37
- package/api/entities/Portfolio/index.js.map +1 -1
- package/api/entities/Subsidies.d.ts +6 -0
- package/api/entities/Subsidies.d.ts.map +1 -1
- package/api/entities/Subsidies.js +16 -0
- 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 +8 -0
- package/api/entities/common/namespaces/Authorizations.js.map +1 -1
- package/api/entities/types.d.ts +54 -14
- package/api/entities/types.d.ts.map +1 -1
- package/api/entities/types.js +11 -7
- package/api/entities/types.js.map +1 -1
- package/api/procedures/acceptPrimaryKeyRotation.d.ts.map +1 -1
- package/api/procedures/acceptPrimaryKeyRotation.js +19 -4
- package/api/procedures/acceptPrimaryKeyRotation.js.map +1 -1
- package/api/procedures/acceptSubsidy.d.ts +12 -0
- package/api/procedures/acceptSubsidy.d.ts.map +1 -0
- package/api/procedures/acceptSubsidy.js +61 -0
- package/api/procedures/acceptSubsidy.js.map +1 -0
- package/api/procedures/addInstruction.d.ts +12 -3
- package/api/procedures/addInstruction.d.ts.map +1 -1
- package/api/procedures/addInstruction.js +122 -70
- package/api/procedures/addInstruction.js.map +1 -1
- package/api/procedures/approveAllowance.d.ts +22 -0
- package/api/procedures/approveAllowance.d.ts.map +1 -0
- package/api/procedures/approveAllowance.js +51 -0
- package/api/procedures/approveAllowance.js.map +1 -0
- package/api/procedures/bondPolyx.d.ts.map +1 -1
- package/api/procedures/bondPolyx.js +17 -6
- package/api/procedures/bondPolyx.js.map +1 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.d.ts +1 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.d.ts.map +1 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.js +11 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.js.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.d.ts.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.js +10 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.js.map +1 -1
- package/api/procedures/controllerTransfer.d.ts +3 -2
- package/api/procedures/controllerTransfer.d.ts.map +1 -1
- package/api/procedures/controllerTransfer.js +21 -7
- package/api/procedures/controllerTransfer.js.map +1 -1
- package/api/procedures/createAsset.js +2 -2
- package/api/procedures/createAsset.js.map +1 -1
- package/api/procedures/createChildIdentities.d.ts +5 -2
- package/api/procedures/createChildIdentities.d.ts.map +1 -1
- package/api/procedures/createChildIdentities.js +14 -2
- package/api/procedures/createChildIdentities.js.map +1 -1
- package/api/procedures/createChildIdentity.d.ts +9 -4
- package/api/procedures/createChildIdentity.d.ts.map +1 -1
- package/api/procedures/createChildIdentity.js +12 -3
- package/api/procedures/createChildIdentity.js.map +1 -1
- package/api/procedures/createVenue.d.ts.map +1 -1
- package/api/procedures/createVenue.js +7 -2
- package/api/procedures/createVenue.js.map +1 -1
- package/api/procedures/executeManualInstruction.d.ts +4 -3
- package/api/procedures/executeManualInstruction.d.ts.map +1 -1
- package/api/procedures/executeManualInstruction.js +41 -20
- package/api/procedures/executeManualInstruction.js.map +1 -1
- package/api/procedures/initiateCorporateAction.d.ts.map +1 -1
- package/api/procedures/initiateCorporateAction.js +10 -0
- package/api/procedures/initiateCorporateAction.js.map +1 -1
- package/api/procedures/issueNft.d.ts.map +1 -1
- package/api/procedures/issueNft.js +10 -3
- package/api/procedures/issueNft.js.map +1 -1
- package/api/procedures/issueTokens.d.ts.map +1 -1
- package/api/procedures/issueTokens.js +25 -6
- package/api/procedures/issueTokens.js.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.d.ts +6 -6
- package/api/procedures/modifyInstructionAffirmation.d.ts.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.js +112 -67
- package/api/procedures/modifyInstructionAffirmation.js.map +1 -1
- package/api/procedures/modifySignerPermissions.js +1 -1
- package/api/procedures/modifySignerPermissions.js.map +1 -1
- package/api/procedures/moveFunds.js.map +1 -1
- package/api/procedures/nftControllerTransfer.d.ts +5 -4
- package/api/procedures/nftControllerTransfer.d.ts.map +1 -1
- package/api/procedures/nftControllerTransfer.js +33 -22
- package/api/procedures/nftControllerTransfer.js.map +1 -1
- package/api/procedures/payDividends.d.ts +1 -1
- package/api/procedures/payDividends.d.ts.map +1 -1
- package/api/procedures/payDividends.js +2 -2
- package/api/procedures/payDividends.js.map +1 -1
- package/api/procedures/quitSubsidy.d.ts +1 -1
- package/api/procedures/quitSubsidy.d.ts.map +1 -1
- package/api/procedures/quitSubsidy.js +9 -1
- package/api/procedures/quitSubsidy.js.map +1 -1
- package/api/procedures/redeemNft.d.ts +4 -4
- package/api/procedures/redeemNft.d.ts.map +1 -1
- package/api/procedures/redeemNft.js +32 -13
- package/api/procedures/redeemNft.js.map +1 -1
- package/api/procedures/redeemTokens.d.ts +5 -5
- package/api/procedures/redeemTokens.d.ts.map +1 -1
- package/api/procedures/redeemTokens.js +24 -14
- package/api/procedures/redeemTokens.js.map +1 -1
- package/api/procedures/revokeSubsidy.d.ts +12 -0
- package/api/procedures/revokeSubsidy.d.ts.map +1 -0
- package/api/procedures/revokeSubsidy.js +61 -0
- package/api/procedures/revokeSubsidy.js.map +1 -0
- package/api/procedures/selfRegisterDid.d.ts +20 -0
- package/api/procedures/selfRegisterDid.d.ts.map +1 -0
- package/api/procedures/selfRegisterDid.js +68 -0
- package/api/procedures/selfRegisterDid.js.map +1 -0
- package/api/procedures/setAssetStats.d.ts +15 -3
- package/api/procedures/setAssetStats.d.ts.map +1 -1
- package/api/procedures/setAssetStats.js +98 -30
- package/api/procedures/setAssetStats.js.map +1 -1
- package/api/procedures/setMandatoryReceiverAffirmation.d.ts +33 -0
- package/api/procedures/setMandatoryReceiverAffirmation.d.ts.map +1 -0
- package/api/procedures/setMandatoryReceiverAffirmation.js +87 -0
- package/api/procedures/setMandatoryReceiverAffirmation.js.map +1 -0
- package/api/procedures/setStakingController.d.ts.map +1 -1
- package/api/procedures/setStakingController.js +17 -5
- package/api/procedures/setStakingController.js.map +1 -1
- package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
- package/api/procedures/setTransferRestrictions.js +20 -19
- package/api/procedures/setTransferRestrictions.js.map +1 -1
- package/api/procedures/subsidizeAccount.d.ts +6 -3
- package/api/procedures/subsidizeAccount.d.ts.map +1 -1
- package/api/procedures/subsidizeAccount.js +55 -25
- package/api/procedures/subsidizeAccount.js.map +1 -1
- package/api/procedures/transferFunds.d.ts +31 -0
- package/api/procedures/transferFunds.d.ts.map +1 -0
- package/api/procedures/transferFunds.js +165 -0
- package/api/procedures/transferFunds.js.map +1 -0
- package/api/procedures/transferPolyx.d.ts +1 -1
- package/api/procedures/transferPolyx.d.ts.map +1 -1
- package/api/procedures/transferPolyx.js +25 -8
- package/api/procedures/transferPolyx.js.map +1 -1
- package/api/procedures/types.d.ts +149 -21
- package/api/procedures/types.d.ts.map +1 -1
- package/api/procedures/types.js +10 -0
- package/api/procedures/types.js.map +1 -1
- package/api/procedures/unlinkChildIdentity.d.ts +1 -1
- package/api/procedures/unlinkChildIdentity.d.ts.map +1 -1
- package/api/procedures/unlinkChildIdentity.js +10 -1
- package/api/procedures/unlinkChildIdentity.js.map +1 -1
- package/api/procedures/updateVenueSigners.d.ts.map +1 -1
- package/api/procedures/updateVenueSigners.js +6 -5
- package/api/procedures/updateVenueSigners.js.map +1 -1
- package/api/procedures/utils.d.ts +10 -2
- package/api/procedures/utils.d.ts.map +1 -1
- package/api/procedures/utils.js +35 -4
- package/api/procedures/utils.js.map +1 -1
- package/base/Context.d.ts +10 -0
- package/base/Context.d.ts.map +1 -1
- package/base/Context.js +72 -1
- package/base/Context.js.map +1 -1
- package/base/PolymeshTransaction.d.ts +1 -0
- package/base/PolymeshTransaction.d.ts.map +1 -1
- package/base/PolymeshTransaction.js +6 -2
- package/base/PolymeshTransaction.js.map +1 -1
- package/base/PolymeshTransactionBase.d.ts +27 -2
- package/base/PolymeshTransactionBase.d.ts.map +1 -1
- package/base/PolymeshTransactionBase.js +55 -15
- package/base/PolymeshTransactionBase.js.map +1 -1
- package/base/PolymeshTransactionBatch.d.ts +1 -0
- package/base/PolymeshTransactionBatch.d.ts.map +1 -1
- package/base/PolymeshTransactionBatch.js +6 -2
- package/base/PolymeshTransactionBatch.js.map +1 -1
- package/base/types.d.ts +2 -1
- package/base/types.d.ts.map +1 -1
- package/internal.d.ts +7 -1
- package/internal.d.ts.map +1 -1
- package/internal.js +16 -3
- package/internal.js.map +1 -1
- package/middleware/queries/assets.d.ts.map +1 -1
- package/middleware/queries/assets.js +4 -0
- package/middleware/queries/assets.js.map +1 -1
- package/middleware/queries/claims.d.ts.map +1 -1
- package/middleware/queries/claims.js +2 -3
- package/middleware/queries/claims.js.map +1 -1
- package/middleware/queries/portfolios.d.ts.map +1 -1
- package/middleware/queries/portfolios.js +2 -0
- package/middleware/queries/portfolios.js.map +1 -1
- package/middleware/queries/settlements.d.ts.map +1 -1
- package/middleware/queries/settlements.js +4 -0
- package/middleware/queries/settlements.js.map +1 -1
- package/middleware/types.d.ts +273 -11
- package/middleware/types.d.ts.map +1 -1
- package/middleware/types.js +146 -1
- package/middleware/types.js.map +1 -1
- package/npm-package/polymeshassociation-polymesh-sdk-30.0.0-beta.2.tgz +0 -0
- package/package.json +53 -68
- package/utils/constants.d.ts +2 -2
- package/utils/constants.d.ts.map +1 -1
- package/utils/constants.js +2 -2
- package/utils/constants.js.map +1 -1
- package/utils/conversion.d.ts +81 -13
- package/utils/conversion.d.ts.map +1 -1
- package/utils/conversion.js +368 -33
- package/utils/conversion.js.map +1 -1
- package/utils/internal.d.ts +4 -0
- package/utils/internal.d.ts.map +1 -1
- package/utils/internal.js +145 -68
- package/utils/internal.js.map +1 -1
- package/utils/typeguards.d.ts +9 -1
- package/utils/typeguards.d.ts.map +1 -1
- package/utils/typeguards.js +15 -1
- package/utils/typeguards.js.map +1 -1
- package/npm-package/polymeshassociation-polymesh-sdk-29.1.0-beta.9.tgz +0 -0
package/utils/conversion.js
CHANGED
|
@@ -67,12 +67,17 @@ exports.meshClaimToInputStatClaim = meshClaimToInputStatClaim;
|
|
|
67
67
|
exports.claimCountToClaimCountRestrictionValue = claimCountToClaimCountRestrictionValue;
|
|
68
68
|
exports.claimPercentageToClaimPercentageRestrictionValue = claimPercentageToClaimPercentageRestrictionValue;
|
|
69
69
|
exports.meshPortfolioIdToPortfolio = meshPortfolioIdToPortfolio;
|
|
70
|
+
exports.meshAssetHolderToAssetHolder = meshAssetHolderToAssetHolder;
|
|
70
71
|
exports.portfolioToPortfolioId = portfolioToPortfolioId;
|
|
71
72
|
exports.portfolioLikeToPortfolioId = portfolioLikeToPortfolioId;
|
|
73
|
+
exports.assetHolderLikeToAssetHolderId = assetHolderLikeToAssetHolderId;
|
|
72
74
|
exports.portfolioIdToPortfolio = portfolioIdToPortfolio;
|
|
73
75
|
exports.portfolioLikeToPortfolio = portfolioLikeToPortfolio;
|
|
76
|
+
exports.assetHolderLikeToAssetHolder = assetHolderLikeToAssetHolder;
|
|
74
77
|
exports.portfolioIdToMeshPortfolioId = portfolioIdToMeshPortfolioId;
|
|
78
|
+
exports.assetHolderIdToMeshAssetHolder = assetHolderIdToMeshAssetHolder;
|
|
75
79
|
exports.portfolioToPortfolioKind = portfolioToPortfolioKind;
|
|
80
|
+
exports.assetHolderToAssetHolderKind = assetHolderToAssetHolderKind;
|
|
76
81
|
exports.stringToText = stringToText;
|
|
77
82
|
exports.textToString = textToString;
|
|
78
83
|
exports.txGroupToTxTags = txGroupToTxTags;
|
|
@@ -148,6 +153,7 @@ exports.secondaryAccountToMeshSecondaryKey = secondaryAccountToMeshSecondaryKey;
|
|
|
148
153
|
exports.meshVenueTypeToVenueType = meshVenueTypeToVenueType;
|
|
149
154
|
exports.venueTypeToMeshVenueType = venueTypeToMeshVenueType;
|
|
150
155
|
exports.meshInstructionStatusToInstructionStatus = meshInstructionStatusToInstructionStatus;
|
|
156
|
+
exports.affirmationRequirementToMesh = affirmationRequirementToMesh;
|
|
151
157
|
exports.meshAffirmationStatusToAffirmationStatus = meshAffirmationStatusToAffirmationStatus;
|
|
152
158
|
exports.meshSettlementTypeToEndCondition = meshSettlementTypeToEndCondition;
|
|
153
159
|
exports.endConditionToSettlementType = endConditionToSettlementType;
|
|
@@ -160,13 +166,16 @@ exports.claimTypeToMeshClaimType = claimTypeToMeshClaimType;
|
|
|
160
166
|
exports.claimIssuerToMeshClaimIssuer = claimIssuerToMeshClaimIssuer;
|
|
161
167
|
exports.transferRestrictionToPolymeshTransferCondition = transferRestrictionToPolymeshTransferCondition;
|
|
162
168
|
exports.identitiesToBtreeSet = identitiesToBtreeSet;
|
|
169
|
+
exports.addressesToBtreeSet = addressesToBtreeSet;
|
|
163
170
|
exports.portfolioIdsToBtreeSet = portfolioIdsToBtreeSet;
|
|
171
|
+
exports.assetHolderIdsToBtreeSet = assetHolderIdsToBtreeSet;
|
|
164
172
|
exports.identitiesSetToIdentities = identitiesSetToIdentities;
|
|
165
173
|
exports.assetDispatchErrorToTransferError = assetDispatchErrorToTransferError;
|
|
166
174
|
exports.nftDispatchErrorToTransferError = nftDispatchErrorToTransferError;
|
|
167
175
|
exports.offeringTierToPriceTier = offeringTierToPriceTier;
|
|
168
176
|
exports.permissionsLikeToPermissions = permissionsLikeToPermissions;
|
|
169
177
|
exports.middlewarePortfolioToPortfolio = middlewarePortfolioToPortfolio;
|
|
178
|
+
exports.middlewareAssetHolderToAssetHolder = middlewareAssetHolderToAssetHolder;
|
|
170
179
|
exports.fundraiserTierToTier = fundraiserTierToTier;
|
|
171
180
|
exports.fundraiserToOfferingDetails = fundraiserToOfferingDetails;
|
|
172
181
|
exports.meshCorporateActionToCorporateActionParams = meshCorporateActionToCorporateActionParams;
|
|
@@ -193,7 +202,10 @@ exports.complianceConditionsToBtreeSet = complianceConditionsToBtreeSet;
|
|
|
193
202
|
exports.toExemptKey = toExemptKey;
|
|
194
203
|
exports.claimCountStatInputToStatUpdates = claimCountStatInputToStatUpdates;
|
|
195
204
|
exports.countStatInputToStatUpdates = countStatInputToStatUpdates;
|
|
205
|
+
exports.balanceStatInputToStatUpdates = balanceStatInputToStatUpdates;
|
|
206
|
+
exports.claimBalanceStatInputToStatUpdates = claimBalanceStatInputToStatUpdates;
|
|
196
207
|
exports.inputStatTypeToMeshStatType = inputStatTypeToMeshStatType;
|
|
208
|
+
exports.statParamsToMeshStatType = statParamsToMeshStatType;
|
|
197
209
|
exports.meshProposalStateToProposalStatus = meshProposalStateToProposalStatus;
|
|
198
210
|
exports.metadataSpecToMeshMetadataSpec = metadataSpecToMeshMetadataSpec;
|
|
199
211
|
exports.meshMetadataSpecToMetadataSpec = meshMetadataSpecToMetadataSpec;
|
|
@@ -258,6 +270,8 @@ exports.granularCanTransferResultToTransferBreakdown = granularCanTransferResult
|
|
|
258
270
|
exports.fundingToRawFunding = fundingToRawFunding;
|
|
259
271
|
exports.offChainFundingReceiptDetailsToMeshReceiptDetails = offChainFundingReceiptDetailsToMeshReceiptDetails;
|
|
260
272
|
exports.claimTypeInputToMiddlewareClaimTypeDetails = claimTypeInputToMiddlewareClaimTypeDetails;
|
|
273
|
+
exports.meshNftOwnerStatusToNftOwnerStatus = meshNftOwnerStatusToNftOwnerStatus;
|
|
274
|
+
exports.fundDetailsToMeshFund = fundDetailsToMeshFund;
|
|
261
275
|
const util_1 = require("@polkadot/util");
|
|
262
276
|
const util_crypto_1 = require("@polkadot/util-crypto");
|
|
263
277
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
@@ -603,6 +617,15 @@ function meshPortfolioIdToPortfolio(portfolioId, context) {
|
|
|
603
617
|
}
|
|
604
618
|
return new internal_1.NumberedPortfolio({ did: identityId, id: u64ToBigNumber(kind.asUser) }, context);
|
|
605
619
|
}
|
|
620
|
+
/**
|
|
621
|
+
* @hidden
|
|
622
|
+
*/
|
|
623
|
+
function meshAssetHolderToAssetHolder(rawAccountHolder, context) {
|
|
624
|
+
if (rawAccountHolder.isPortfolio) {
|
|
625
|
+
return meshPortfolioIdToPortfolio(rawAccountHolder.asPortfolio, context);
|
|
626
|
+
}
|
|
627
|
+
return new internal_1.Account({ address: rawAccountHolder.asAccount.toString() }, context);
|
|
628
|
+
}
|
|
606
629
|
/**
|
|
607
630
|
* @hidden
|
|
608
631
|
*/
|
|
@@ -638,6 +661,21 @@ function portfolioLikeToPortfolioId(value) {
|
|
|
638
661
|
}
|
|
639
662
|
return { did, number: (number === null || number === void 0 ? void 0 : number.gt(0)) ? number : undefined };
|
|
640
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* @hidden
|
|
666
|
+
*/
|
|
667
|
+
function assetHolderLikeToAssetHolderId(value) {
|
|
668
|
+
if (typeof value === 'string') {
|
|
669
|
+
if ((0, util_1.hexHasPrefix)(value)) {
|
|
670
|
+
return portfolioLikeToPortfolioId(value);
|
|
671
|
+
}
|
|
672
|
+
return value;
|
|
673
|
+
}
|
|
674
|
+
if (value instanceof internal_1.Account) {
|
|
675
|
+
return value.address;
|
|
676
|
+
}
|
|
677
|
+
return portfolioLikeToPortfolioId(value);
|
|
678
|
+
}
|
|
641
679
|
/**
|
|
642
680
|
* @hidden
|
|
643
681
|
*/
|
|
@@ -653,6 +691,18 @@ function portfolioIdToPortfolio(portfolioId, context) {
|
|
|
653
691
|
function portfolioLikeToPortfolio(value, context) {
|
|
654
692
|
return portfolioIdToPortfolio(portfolioLikeToPortfolioId(value), context);
|
|
655
693
|
}
|
|
694
|
+
/**
|
|
695
|
+
* @hidden
|
|
696
|
+
*/
|
|
697
|
+
function assetHolderLikeToAssetHolder(value, context) {
|
|
698
|
+
if (typeof value === 'string' && !(0, util_1.hexHasPrefix)(value)) {
|
|
699
|
+
return new internal_1.Account({ address: value }, context);
|
|
700
|
+
}
|
|
701
|
+
if (value instanceof internal_1.Account) {
|
|
702
|
+
return value;
|
|
703
|
+
}
|
|
704
|
+
return portfolioLikeToPortfolio(value, context);
|
|
705
|
+
}
|
|
656
706
|
/**
|
|
657
707
|
* @hidden
|
|
658
708
|
*/
|
|
@@ -663,6 +713,49 @@ function portfolioIdToMeshPortfolioId(portfolioId, context) {
|
|
|
663
713
|
kind: number ? { User: bigNumberToU64(number, context) } : 'Default',
|
|
664
714
|
});
|
|
665
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* @hidden
|
|
718
|
+
*/
|
|
719
|
+
function assetHolderIdToMeshAssetHolder(assetHolderId, context) {
|
|
720
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
721
|
+
if (typeof assetHolderId === 'string') {
|
|
722
|
+
if ((0, util_1.hexHasPrefix)(assetHolderId)) {
|
|
723
|
+
if (context.isV7) {
|
|
724
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
725
|
+
return portfolioIdToMeshPortfolioId({ did: assetHolderId }, context);
|
|
726
|
+
}
|
|
727
|
+
return context.createType('PolymeshPrimitivesAssetAssetHolder', {
|
|
728
|
+
Portfolio: portfolioIdToMeshPortfolioId({ did: assetHolderId }, context),
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
if (context.isV7) {
|
|
732
|
+
const account = new internal_1.Account({ address: assetHolderId }, context);
|
|
733
|
+
const identity = yield account.getIdentity();
|
|
734
|
+
if (!identity) {
|
|
735
|
+
throw new internal_1.PolymeshError({
|
|
736
|
+
code: types_3.ErrorCode.UnmetPrerequisite,
|
|
737
|
+
message: 'Invalid string value',
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
return context.createType('PolymeshPrimitivesIdentityIdPortfolioId', {
|
|
741
|
+
did: stringToIdentityId(identity.did, context),
|
|
742
|
+
kind: { AccountId: stringToAccountId(assetHolderId, context) },
|
|
743
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
return context.createType('PolymeshPrimitivesAssetAssetHolder', {
|
|
747
|
+
Account: stringToAccountId(assetHolderId, context),
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
if (context.isV7) {
|
|
751
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
752
|
+
return portfolioIdToMeshPortfolioId(assetHolderId, context);
|
|
753
|
+
}
|
|
754
|
+
return context.createType('PolymeshPrimitivesAssetAssetHolder', {
|
|
755
|
+
Portfolio: portfolioIdToMeshPortfolioId(assetHolderId, context),
|
|
756
|
+
});
|
|
757
|
+
});
|
|
758
|
+
}
|
|
666
759
|
/**
|
|
667
760
|
* @hidden
|
|
668
761
|
*/
|
|
@@ -676,6 +769,29 @@ function portfolioToPortfolioKind(portfolio, context) {
|
|
|
676
769
|
}
|
|
677
770
|
return context.createType('PolymeshPrimitivesIdentityIdPortfolioKind', portfolioKind);
|
|
678
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* @hidden
|
|
774
|
+
*/
|
|
775
|
+
function assetHolderToAssetHolderKind(assetHolder, context) {
|
|
776
|
+
if (context.isV7) {
|
|
777
|
+
if (assetHolder instanceof internal_1.Account) {
|
|
778
|
+
return context.createType('PolymeshPrimitivesIdentityIdPortfolioKind', {
|
|
779
|
+
AccountId: stringToAccountId(assetHolder.address, context),
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
783
|
+
return portfolioToPortfolioKind(assetHolder, context);
|
|
784
|
+
}
|
|
785
|
+
if (assetHolder instanceof internal_1.Account) {
|
|
786
|
+
return context.createType('PolymeshPrimitivesAssetAssetHolderKind', 'Account');
|
|
787
|
+
}
|
|
788
|
+
if (assetHolder instanceof internal_1.DefaultPortfolio) {
|
|
789
|
+
return context.createType('PolymeshPrimitivesAssetAssetHolderKind', 'DefaultPortfolio');
|
|
790
|
+
}
|
|
791
|
+
return context.createType('PolymeshPrimitivesAssetAssetHolderKind', {
|
|
792
|
+
UserPortfolio: bigNumberToU64(assetHolder.id, context),
|
|
793
|
+
});
|
|
794
|
+
}
|
|
679
795
|
/**
|
|
680
796
|
* @hidden
|
|
681
797
|
*/
|
|
@@ -1310,15 +1426,23 @@ function authorizationDataToAuthorization(auth, context) {
|
|
|
1310
1426
|
value: meshPermissionsToPermissions(auth.asJoinIdentity, context),
|
|
1311
1427
|
};
|
|
1312
1428
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1429
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1430
|
+
if (auth.isAddRelayerPayingKey || auth.isOldAddRelayerPayingKey) {
|
|
1431
|
+
const [userKey, payingKey, polyxLimit] = auth.asOldAddRelayerPayingKey;
|
|
1432
|
+
const value = {
|
|
1433
|
+
beneficiary: new internal_1.Account({ address: accountIdToString(userKey) }, context),
|
|
1434
|
+
subsidizer: new internal_1.Account({ address: accountIdToString(payingKey) }, context),
|
|
1435
|
+
allowance: balanceToBigNumber(polyxLimit),
|
|
1436
|
+
};
|
|
1437
|
+
if (context.isV7) {
|
|
1438
|
+
return {
|
|
1439
|
+
type: types_3.AuthorizationType.AddRelayerPayingKey, // NOSONAR
|
|
1440
|
+
value,
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1315
1443
|
return {
|
|
1316
|
-
type: types_3.AuthorizationType.
|
|
1317
|
-
value
|
|
1318
|
-
beneficiary: new internal_1.Account({ address: accountIdToString(userKey) }, context),
|
|
1319
|
-
subsidizer: new internal_1.Account({ address: accountIdToString(payingKey) }, context),
|
|
1320
|
-
allowance: balanceToBigNumber(polyxLimit),
|
|
1321
|
-
},
|
|
1444
|
+
type: types_3.AuthorizationType.OldAddRelayerPayingKey,
|
|
1445
|
+
value,
|
|
1322
1446
|
};
|
|
1323
1447
|
}
|
|
1324
1448
|
if (auth.isBecomeAgent) {
|
|
@@ -2320,7 +2444,7 @@ function complianceRequirementToRequirement(complianceRequirement, context) {
|
|
|
2320
2444
|
function txTagToProtocolOp(tag, context) {
|
|
2321
2445
|
const protocolOpTags = [
|
|
2322
2446
|
types_3.TxTags.asset.RegisterUniqueTicker,
|
|
2323
|
-
types_3.TxTags.asset.
|
|
2447
|
+
types_3.TxTags.asset.RegisterTicker,
|
|
2324
2448
|
types_3.TxTags.asset.Issue,
|
|
2325
2449
|
types_3.TxTags.asset.AddDocuments,
|
|
2326
2450
|
types_3.TxTags.asset.CreateAsset,
|
|
@@ -2333,16 +2457,21 @@ function txTagToProtocolOp(tag, context) {
|
|
|
2333
2457
|
types_3.TxTags.pips.Propose,
|
|
2334
2458
|
types_3.TxTags.corporateBallot.AttachBallot,
|
|
2335
2459
|
types_3.TxTags.capitalDistribution.Distribute,
|
|
2460
|
+
types_3.TxTags.nft.CreateNftCollection,
|
|
2461
|
+
types_3.TxTags.nft.IssueNft,
|
|
2336
2462
|
];
|
|
2337
2463
|
const [moduleName, extrinsicName] = tag.split('.');
|
|
2338
2464
|
const value = `${(0, util_1.stringUpperFirst)(moduleName)}${(0, util_1.stringUpperFirst)(extrinsicName)}`;
|
|
2339
2465
|
if (!(0, lodash_1.includes)(protocolOpTags, tag)) {
|
|
2340
2466
|
throw new internal_1.PolymeshError({
|
|
2341
2467
|
code: types_3.ErrorCode.ValidationError,
|
|
2342
|
-
message: `${value} does not match any
|
|
2468
|
+
message: `${value} does not match any PolymeshPrimitivesProtocolFeeProtocolOp`,
|
|
2343
2469
|
});
|
|
2344
2470
|
}
|
|
2345
|
-
|
|
2471
|
+
if (context.isV7) {
|
|
2472
|
+
return context.createType('PolymeshCommonUtilitiesProtocolFeeProtocolOp', value);
|
|
2473
|
+
}
|
|
2474
|
+
return context.createType('PolymeshPrimitivesProtocolFeeProtocolOp', value);
|
|
2346
2475
|
}
|
|
2347
2476
|
/**
|
|
2348
2477
|
* @hidden
|
|
@@ -2489,6 +2618,12 @@ function meshInstructionStatusToInstructionStatus(instruction) {
|
|
|
2489
2618
|
}
|
|
2490
2619
|
return internal_2.InstructionStatus.Unknown;
|
|
2491
2620
|
}
|
|
2621
|
+
/**
|
|
2622
|
+
* @hidden
|
|
2623
|
+
*/
|
|
2624
|
+
function affirmationRequirementToMesh(requirement, context) {
|
|
2625
|
+
return context.createType('PolymeshPrimitivesSettlementAffirmationRequirement', requirement);
|
|
2626
|
+
}
|
|
2492
2627
|
/**
|
|
2493
2628
|
* @hidden
|
|
2494
2629
|
*/
|
|
@@ -2699,12 +2834,31 @@ function identitiesToBtreeSet(identities, context) {
|
|
|
2699
2834
|
const rawIds = identities.map(({ did }) => stringToIdentityId(did, context));
|
|
2700
2835
|
return context.createType('BTreeSet<PolymeshPrimitivesIdentityId>', rawIds);
|
|
2701
2836
|
}
|
|
2837
|
+
/**
|
|
2838
|
+
* @hidden
|
|
2839
|
+
*/
|
|
2840
|
+
function addressesToBtreeSet(addresses, context) {
|
|
2841
|
+
const rawIds = addresses.map(address => stringToAccountId(address, context));
|
|
2842
|
+
return context.createType('BTreeSet<AccountId32>', rawIds);
|
|
2843
|
+
}
|
|
2702
2844
|
/**
|
|
2703
2845
|
* @hidden
|
|
2704
2846
|
*/
|
|
2705
2847
|
function portfolioIdsToBtreeSet(rawPortfolioIds, context) {
|
|
2706
2848
|
return context.createType('BTreeSet<PolymeshPrimitivesIdentityIdPortfolioId>', (0, lodash_1.uniqWith)(rawPortfolioIds, lodash_1.isEqual));
|
|
2707
2849
|
}
|
|
2850
|
+
/**
|
|
2851
|
+
* @hidden
|
|
2852
|
+
*/
|
|
2853
|
+
function assetHolderIdsToBtreeSet(rawAssetHolderIds, context) {
|
|
2854
|
+
if (context.isV7) {
|
|
2855
|
+
return portfolioIdsToBtreeSet(rawAssetHolderIds, // NOSONAR
|
|
2856
|
+
context
|
|
2857
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2858
|
+
);
|
|
2859
|
+
}
|
|
2860
|
+
return context.createType('BTreeSet<PolymeshPrimitivesAssetAssetHolder>', (0, lodash_1.uniqWith)(rawAssetHolderIds, lodash_1.isEqual));
|
|
2861
|
+
}
|
|
2708
2862
|
/**
|
|
2709
2863
|
* @hidden
|
|
2710
2864
|
*/
|
|
@@ -2715,15 +2869,13 @@ function identitiesSetToIdentities(identitySet, context) {
|
|
|
2715
2869
|
* @hidden
|
|
2716
2870
|
*/
|
|
2717
2871
|
function assetDispatchErrorToTransferError(error, context) {
|
|
2872
|
+
var _a;
|
|
2718
2873
|
const { asset: assetErrors, portfolio: portfolioErrors, statistics: statisticsError, } = context.polymeshApi.errors;
|
|
2719
|
-
|
|
2874
|
+
let record = [
|
|
2720
2875
|
[assetErrors.NoSuchAsset, types_3.TransferError.AssetDoesNotExists],
|
|
2721
2876
|
[assetErrors.InvalidGranularity, types_3.TransferError.InvalidGranularity],
|
|
2722
2877
|
[assetErrors.SenderSameAsReceiver, types_3.TransferError.SelfTransfer],
|
|
2723
|
-
[portfolioErrors.InvalidTransferSenderIdMatchesReceiverId, types_3.TransferError.SelfTransfer],
|
|
2724
2878
|
[assetErrors.BalanceOverflow, types_3.TransferError.BalanceOverflow],
|
|
2725
|
-
[assetErrors.InvalidTransferInvalidReceiverCDD, types_3.TransferError.InvalidReceiverCdd],
|
|
2726
|
-
[assetErrors.InvalidTransferInvalidSenderCDD, types_3.TransferError.InvalidSenderCdd],
|
|
2727
2879
|
[assetErrors.InsufficientBalance, types_3.TransferError.InsufficientBalance],
|
|
2728
2880
|
[assetErrors.InvalidTransferFrozenAsset, types_3.TransferError.TransfersFrozen],
|
|
2729
2881
|
[portfolioErrors.PortfolioDoesNotExist, types_3.TransferError.InvalidSenderPortfolio],
|
|
@@ -2732,12 +2884,34 @@ function assetDispatchErrorToTransferError(error, context) {
|
|
|
2732
2884
|
[assetErrors.InvalidTransfer, types_3.TransferError.ComplianceFailure],
|
|
2733
2885
|
[statisticsError.InvalidTransferStatisticsFailure, types_3.TransferError.TransferNotAllowed],
|
|
2734
2886
|
];
|
|
2887
|
+
if (context.isV7) {
|
|
2888
|
+
record = [
|
|
2889
|
+
...record,
|
|
2890
|
+
[
|
|
2891
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2892
|
+
portfolioErrors.InvalidTransferSenderIdMatchesReceiverId,
|
|
2893
|
+
types_3.TransferError.SelfTransfer,
|
|
2894
|
+
],
|
|
2895
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2896
|
+
[assetErrors.InvalidTransferInvalidReceiverCDD, types_3.TransferError.InvalidReceiverCdd],
|
|
2897
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2898
|
+
[assetErrors.InvalidTransferInvalidSenderCDD, types_3.TransferError.InvalidSenderCdd],
|
|
2899
|
+
];
|
|
2900
|
+
}
|
|
2735
2901
|
if (error.isModule) {
|
|
2736
2902
|
const moduleErr = error.asModule;
|
|
2737
|
-
const errorCase = record.find(([augmentedError]) => augmentedError.is(moduleErr));
|
|
2903
|
+
const errorCase = record.find(([augmentedError]) => augmentedError === null || augmentedError === void 0 ? void 0 : augmentedError.is(moduleErr));
|
|
2738
2904
|
if (errorCase) {
|
|
2739
2905
|
return errorCase[1];
|
|
2740
2906
|
}
|
|
2907
|
+
else {
|
|
2908
|
+
// Extract the actual error details from the registry metadata:
|
|
2909
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2910
|
+
const errorMeta = (_a = moduleErr.registry) === null || _a === void 0 ? void 0 : _a.findMetaError(moduleErr);
|
|
2911
|
+
if (errorMeta) {
|
|
2912
|
+
return errorMeta.name;
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2741
2915
|
}
|
|
2742
2916
|
throw new internal_1.PolymeshError({
|
|
2743
2917
|
code: types_3.ErrorCode.UnexpectedError,
|
|
@@ -2842,6 +3016,16 @@ function middlewarePortfolioToPortfolio(portfolio, context) {
|
|
|
2842
3016
|
}
|
|
2843
3017
|
return new internal_1.DefaultPortfolio({ did }, context);
|
|
2844
3018
|
}
|
|
3019
|
+
/**
|
|
3020
|
+
* @hidden
|
|
3021
|
+
*/
|
|
3022
|
+
function middlewareAssetHolderToAssetHolder(middlewareAssetHolder, context) {
|
|
3023
|
+
const { account } = middlewareAssetHolder;
|
|
3024
|
+
if (account) {
|
|
3025
|
+
return new internal_1.Account({ address: account }, context);
|
|
3026
|
+
}
|
|
3027
|
+
return middlewarePortfolioToPortfolio(middlewareAssetHolder, context);
|
|
3028
|
+
}
|
|
2845
3029
|
/**
|
|
2846
3030
|
* @hidden
|
|
2847
3031
|
*/
|
|
@@ -3258,6 +3442,10 @@ function toExemptKey(rawAssetId, op, claimType) {
|
|
|
3258
3442
|
*/
|
|
3259
3443
|
function claimCountStatInputToStatUpdates(args, context) {
|
|
3260
3444
|
const { value, claimType: type } = args;
|
|
3445
|
+
if (!value) {
|
|
3446
|
+
// Return empty BTreeSet if no value provided
|
|
3447
|
+
return statUpdatesToBtreeStatUpdate([], context);
|
|
3448
|
+
}
|
|
3261
3449
|
let updateArgs;
|
|
3262
3450
|
if (type === types_3.ClaimType.Jurisdiction) {
|
|
3263
3451
|
updateArgs = value.map(({ countryCode, count }) => {
|
|
@@ -3290,10 +3478,70 @@ function claimCountStatInputToStatUpdates(args, context) {
|
|
|
3290
3478
|
*/
|
|
3291
3479
|
function countStatInputToStatUpdates(args, context) {
|
|
3292
3480
|
const { count } = args;
|
|
3481
|
+
if (!count) {
|
|
3482
|
+
// Return empty BTreeSet if no count provided
|
|
3483
|
+
return statUpdatesToBtreeStatUpdate([], context);
|
|
3484
|
+
}
|
|
3293
3485
|
const secondKey = createStat2ndKey('NoClaimStat', context);
|
|
3294
3486
|
const stat = keyAndValueToStatUpdate(secondKey, bigNumberToU128(count, context), context);
|
|
3295
3487
|
return statUpdatesToBtreeStatUpdate([stat], context);
|
|
3296
3488
|
}
|
|
3489
|
+
/**
|
|
3490
|
+
* @hidden
|
|
3491
|
+
* transforms a non scoped balance stat to a StatUpdate type
|
|
3492
|
+
*/
|
|
3493
|
+
function balanceStatInputToStatUpdates(args, context) {
|
|
3494
|
+
const { balance } = args;
|
|
3495
|
+
if (!balance) {
|
|
3496
|
+
// Return empty BTreeSet if no balance provided
|
|
3497
|
+
return statUpdatesToBtreeStatUpdate([], context);
|
|
3498
|
+
}
|
|
3499
|
+
const secondKey = createStat2ndKey('NoClaimStat', context);
|
|
3500
|
+
const rawBalance = bigNumberToBalance(balance, context);
|
|
3501
|
+
const rawValue = context.createType('u128', rawBalance.toString());
|
|
3502
|
+
const stat = keyAndValueToStatUpdate(secondKey, rawValue, context);
|
|
3503
|
+
return statUpdatesToBtreeStatUpdate([stat], context);
|
|
3504
|
+
}
|
|
3505
|
+
/**
|
|
3506
|
+
* @hidden
|
|
3507
|
+
* transforms a scoped balance stat to a StatUpdate type
|
|
3508
|
+
*/
|
|
3509
|
+
function claimBalanceStatInputToStatUpdates(args, context) {
|
|
3510
|
+
const { value, claimType: type } = args;
|
|
3511
|
+
if (!value) {
|
|
3512
|
+
// Return empty BTreeSet if no value provided
|
|
3513
|
+
return statUpdatesToBtreeStatUpdate([], context);
|
|
3514
|
+
}
|
|
3515
|
+
let updateArgs;
|
|
3516
|
+
if (type === types_3.ClaimType.Jurisdiction) {
|
|
3517
|
+
updateArgs = value.map(({ countryCode, balance }) => {
|
|
3518
|
+
const rawSecondKey = createStat2ndKey(type, context, countryCode);
|
|
3519
|
+
const rawBalance = bigNumberToBalance(balance, context);
|
|
3520
|
+
const rawValue = context.createType('u128', rawBalance.toString());
|
|
3521
|
+
return keyAndValueToStatUpdate(rawSecondKey, rawValue, context);
|
|
3522
|
+
});
|
|
3523
|
+
}
|
|
3524
|
+
else {
|
|
3525
|
+
let yes, no;
|
|
3526
|
+
if (type === types_3.ClaimType.Accredited) {
|
|
3527
|
+
({ accredited: yes, nonAccredited: no } = value);
|
|
3528
|
+
}
|
|
3529
|
+
else {
|
|
3530
|
+
({ affiliate: yes, nonAffiliate: no } = value);
|
|
3531
|
+
}
|
|
3532
|
+
const yes2ndKey = createStat2ndKey(type, context, 'yes');
|
|
3533
|
+
const yesBalance = bigNumberToBalance(yes, context);
|
|
3534
|
+
const yesValue = context.createType('u128', yesBalance.toString());
|
|
3535
|
+
const no2ndKey = createStat2ndKey(type, context, 'no');
|
|
3536
|
+
const noBalance = bigNumberToBalance(no, context);
|
|
3537
|
+
const noValue = context.createType('u128', noBalance.toString());
|
|
3538
|
+
updateArgs = [
|
|
3539
|
+
keyAndValueToStatUpdate(yes2ndKey, yesValue, context),
|
|
3540
|
+
keyAndValueToStatUpdate(no2ndKey, noValue, context),
|
|
3541
|
+
];
|
|
3542
|
+
}
|
|
3543
|
+
return statUpdatesToBtreeStatUpdate(updateArgs, context);
|
|
3544
|
+
}
|
|
3297
3545
|
/**
|
|
3298
3546
|
* @hidden
|
|
3299
3547
|
*/
|
|
@@ -3306,6 +3554,17 @@ function inputStatTypeToMeshStatType(input, context) {
|
|
|
3306
3554
|
}
|
|
3307
3555
|
return statisticsOpTypeToStatType(Object.assign({ operationType: op }, (claimIssuer ? { claimIssuer } : {})), context);
|
|
3308
3556
|
}
|
|
3557
|
+
/**
|
|
3558
|
+
* @hidden
|
|
3559
|
+
* Converts stat params to InputStatType and then to mesh stat type
|
|
3560
|
+
*/
|
|
3561
|
+
function statParamsToMeshStatType(stat, context) {
|
|
3562
|
+
const { type } = stat;
|
|
3563
|
+
const inputStatType = type === types_3.StatType.ScopedCount || type === types_3.StatType.ScopedBalance
|
|
3564
|
+
? { type, claimIssuer: { issuer: stat.issuer, claimType: stat.claimType } }
|
|
3565
|
+
: { type };
|
|
3566
|
+
return inputStatTypeToMeshStatType(inputStatType, context);
|
|
3567
|
+
}
|
|
3309
3568
|
/**
|
|
3310
3569
|
* @hidden
|
|
3311
3570
|
*/
|
|
@@ -3477,20 +3736,20 @@ function portfolioIdStringToPortfolio(id) {
|
|
|
3477
3736
|
* @hidden
|
|
3478
3737
|
*/
|
|
3479
3738
|
function middlewareLegToLeg(leg, context) {
|
|
3480
|
-
const { legType, from, fromPortfolio, to, toPortfolio, assetId, ticker, nftIds, amount } = leg;
|
|
3739
|
+
const { legType, from, fromPortfolio, fromAccount, to, toPortfolio, toAccount, assetId, ticker, nftIds, amount, } = leg;
|
|
3481
3740
|
if (legType === types_2.LegTypeEnum.Fungible) {
|
|
3482
3741
|
return {
|
|
3483
3742
|
asset: new internal_1.FungibleAsset({ assetId: (0, internal_3.getAssetIdFromMiddleware)(assetId) }, context),
|
|
3484
3743
|
amount: new bignumber_js_1.default(amount).shiftedBy(-6),
|
|
3485
|
-
from:
|
|
3486
|
-
to:
|
|
3744
|
+
from: middlewareAssetHolderToAssetHolder({ identityId: from, account: fromAccount, number: fromPortfolio }, context),
|
|
3745
|
+
to: middlewareAssetHolderToAssetHolder({ identityId: to, account: toAccount, number: toPortfolio }, context),
|
|
3487
3746
|
};
|
|
3488
3747
|
}
|
|
3489
3748
|
if (legType === types_2.LegTypeEnum.NonFungible) {
|
|
3490
3749
|
const id = (0, internal_3.getAssetIdFromMiddleware)(assetId);
|
|
3491
3750
|
return {
|
|
3492
|
-
from:
|
|
3493
|
-
to:
|
|
3751
|
+
from: middlewareAssetHolderToAssetHolder({ identityId: from, account: fromAccount, number: fromPortfolio }, context),
|
|
3752
|
+
to: middlewareAssetHolderToAssetHolder({ identityId: to, account: toAccount, number: toPortfolio }, context),
|
|
3494
3753
|
nfts: nftIds.map((nftId) => new internal_1.Nft({ assetId: id, id: new bignumber_js_1.default(nftId) }, context)),
|
|
3495
3754
|
asset: new internal_1.NftCollection({ assetId: id }, context),
|
|
3496
3755
|
};
|
|
@@ -3699,7 +3958,7 @@ function middlewareExtrinsicPermissionsDataToTransactionPermissions(permissions)
|
|
|
3699
3958
|
function datesToScheduleCheckpoints(points, context) {
|
|
3700
3959
|
const rawPoints = points.map(point => dateToMoment(point, context));
|
|
3701
3960
|
const pending = context.createType('BTreeSet<Moment>', rawPoints);
|
|
3702
|
-
return context.createType('
|
|
3961
|
+
return context.createType('PolymeshPrimitivesCheckpointScheduleCheckpoints', { pending });
|
|
3703
3962
|
}
|
|
3704
3963
|
/**
|
|
3705
3964
|
* @hidden
|
|
@@ -3799,7 +4058,7 @@ function middlewareAuthorizationDataToAuthorization(context, type, data) {
|
|
|
3799
4058
|
});
|
|
3800
4059
|
}
|
|
3801
4060
|
return {
|
|
3802
|
-
type: types_3.AuthorizationType.AddRelayerPayingKey,
|
|
4061
|
+
type: types_3.AuthorizationType.AddRelayerPayingKey, // NOSONAR
|
|
3803
4062
|
value: {
|
|
3804
4063
|
beneficiary: new internal_1.Account({ address: beneficiary }, context),
|
|
3805
4064
|
subsidizer: new internal_1.Account({ address: subsidizer }, context),
|
|
@@ -3907,7 +4166,9 @@ function toCustomClaimTypeWithIdentity(data) {
|
|
|
3907
4166
|
* @hidden
|
|
3908
4167
|
*/
|
|
3909
4168
|
function portfolioMovementsToHistoricSettlements(portfolioMovements, context, handleMiddlewareAddress) {
|
|
3910
|
-
return portfolioMovements
|
|
4169
|
+
return portfolioMovements
|
|
4170
|
+
.filter(({ fromId, toId }) => fromId !== undefined && toId !== undefined)
|
|
4171
|
+
.map(({ createdBlock, fromId, toId, asset, amount, address: accountAddress }) => {
|
|
3911
4172
|
const { blockId, hash } = createdBlock;
|
|
3912
4173
|
return {
|
|
3913
4174
|
blockNumber: new bignumber_js_1.default(blockId),
|
|
@@ -4005,15 +4266,20 @@ function createRawExtrinsicStatus(status, value, context) {
|
|
|
4005
4266
|
*/
|
|
4006
4267
|
function signatureToMeshRuntimeMultiSignature(type, value, context) {
|
|
4007
4268
|
let rawValue;
|
|
4008
|
-
if (
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4269
|
+
if (context.isV7) {
|
|
4270
|
+
if (type === types_3.SignerKeyRingType.Ecdsa) {
|
|
4271
|
+
rawValue = context.createType('SpCoreEcdsaSignature', value);
|
|
4272
|
+
}
|
|
4273
|
+
else if (type === types_3.SignerKeyRingType.Ed25519) {
|
|
4274
|
+
rawValue = context.createType('SpCoreEd25519Signature', value);
|
|
4275
|
+
}
|
|
4276
|
+
else {
|
|
4277
|
+
// assume sr 25519
|
|
4278
|
+
rawValue = context.createType('SpCoreSr25519Signature', value);
|
|
4279
|
+
}
|
|
4013
4280
|
}
|
|
4014
4281
|
else {
|
|
4015
|
-
|
|
4016
|
-
rawValue = context.createType('SpCoreSr25519Signature', value);
|
|
4282
|
+
rawValue = context.createType('U8aFixed', value);
|
|
4017
4283
|
}
|
|
4018
4284
|
return context.createType('SpRuntimeMultiSignature', {
|
|
4019
4285
|
[type]: rawValue,
|
|
@@ -4067,10 +4333,15 @@ function secondaryAccountWithAuthToSecondaryKeyWithAuth(accounts, context) {
|
|
|
4067
4333
|
authSignature: stringToH512(authSignature, context),
|
|
4068
4334
|
};
|
|
4069
4335
|
});
|
|
4070
|
-
|
|
4336
|
+
if (context.isV7) {
|
|
4337
|
+
return context.createType('Vec<PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth>', keyWithAuths);
|
|
4338
|
+
}
|
|
4339
|
+
return context.createType('Vec<PolymeshPrimitivesIdentitySecondaryKeyWithAuth>', keyWithAuths);
|
|
4071
4340
|
}
|
|
4072
4341
|
/**
|
|
4073
4342
|
* @hidden
|
|
4343
|
+
*
|
|
4344
|
+
* @deprecated no longer supported in chain v8
|
|
4074
4345
|
*/
|
|
4075
4346
|
function childKeysWithAuthToCreateChildIdentitiesWithAuth(childKeyAuths, context) {
|
|
4076
4347
|
const keyWithAuths = childKeyAuths.map(({ key, authSignature }) => ({
|
|
@@ -4168,7 +4439,30 @@ function rewardDestinationToPayee(destination, stash, controller, context) {
|
|
|
4168
4439
|
* @hidden
|
|
4169
4440
|
*/
|
|
4170
4441
|
function rawStakingLedgerToStakingLedgerEntry(ledger, context) {
|
|
4171
|
-
|
|
4442
|
+
let rawTotal;
|
|
4443
|
+
let rawActive;
|
|
4444
|
+
let rawClaimedRewards;
|
|
4445
|
+
let rawUnlocking;
|
|
4446
|
+
let rawStash;
|
|
4447
|
+
if (context.isV7) {
|
|
4448
|
+
({
|
|
4449
|
+
total: rawTotal,
|
|
4450
|
+
active: rawActive,
|
|
4451
|
+
unlocking: rawUnlocking,
|
|
4452
|
+
claimedRewards: rawClaimedRewards,
|
|
4453
|
+
stash: rawStash,
|
|
4454
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4455
|
+
} = ledger);
|
|
4456
|
+
}
|
|
4457
|
+
else {
|
|
4458
|
+
({
|
|
4459
|
+
total: rawTotal,
|
|
4460
|
+
active: rawActive,
|
|
4461
|
+
unlocking: rawUnlocking,
|
|
4462
|
+
legacyClaimedRewards: rawClaimedRewards,
|
|
4463
|
+
stash: rawStash,
|
|
4464
|
+
} = ledger);
|
|
4465
|
+
}
|
|
4172
4466
|
const total = balanceToBigNumber(rawTotal.unwrap());
|
|
4173
4467
|
const active = balanceToBigNumber(rawActive.unwrap());
|
|
4174
4468
|
const unlocking = rawUnlocking.map(unlock => ({
|
|
@@ -4556,4 +4850,45 @@ function claimTypeInputToMiddlewareClaimTypeDetails(claimTypes) {
|
|
|
4556
4850
|
}
|
|
4557
4851
|
return result;
|
|
4558
4852
|
}
|
|
4853
|
+
/**
|
|
4854
|
+
* @hidden
|
|
4855
|
+
*/
|
|
4856
|
+
function meshNftOwnerStatusToNftOwnerStatus(rawStatus) {
|
|
4857
|
+
if (rawStatus.isNotOwned) {
|
|
4858
|
+
return types_3.NftOwnerStatus.NotOwned;
|
|
4859
|
+
}
|
|
4860
|
+
if (rawStatus.isOwner) {
|
|
4861
|
+
return types_3.NftOwnerStatus.Owner;
|
|
4862
|
+
}
|
|
4863
|
+
if (rawStatus.isOwnerLocked) {
|
|
4864
|
+
return types_3.NftOwnerStatus.OwnerLocked;
|
|
4865
|
+
}
|
|
4866
|
+
throw new internal_1.PolymeshError({
|
|
4867
|
+
code: types_3.ErrorCode.UnexpectedError,
|
|
4868
|
+
message: 'Unsupported Nft Owner Status. Please contact the Polymesh team',
|
|
4869
|
+
data: {
|
|
4870
|
+
rawStatus,
|
|
4871
|
+
},
|
|
4872
|
+
});
|
|
4873
|
+
}
|
|
4874
|
+
/**
|
|
4875
|
+
* @hidden
|
|
4876
|
+
*/
|
|
4877
|
+
function fundDetailsToMeshFund(description, memo, context) {
|
|
4878
|
+
let rawDescription;
|
|
4879
|
+
if ('amount' in description) {
|
|
4880
|
+
rawDescription = context.createType('PolymeshPrimitivesPortfolioFundDescription', {
|
|
4881
|
+
Fungible: description,
|
|
4882
|
+
});
|
|
4883
|
+
}
|
|
4884
|
+
else {
|
|
4885
|
+
rawDescription = context.createType('PolymeshPrimitivesPortfolioFundDescription', {
|
|
4886
|
+
NonFungible: description,
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
return context.createType('PolymeshPrimitivesPortfolioFund', {
|
|
4890
|
+
description: rawDescription,
|
|
4891
|
+
memo: (0, internal_3.optionize)(stringToMemo)(memo, context),
|
|
4892
|
+
});
|
|
4893
|
+
}
|
|
4559
4894
|
//# sourceMappingURL=conversion.js.map
|