@polymeshassociation/polymesh-sdk 16.0.0-beta.2 → 16.0.0-beta.3
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 +41 -3
- package/README.md +1 -1
- package/api/client/Network.d.ts +3 -3
- package/api/client/Network.d.ts.map +1 -1
- package/api/client/Network.js +11 -7
- package/api/client/Network.js.map +1 -1
- package/api/client/Polymesh.d.ts +37 -3
- package/api/client/Polymesh.d.ts.map +1 -1
- package/api/client/Polymesh.js +4 -3
- package/api/client/Polymesh.js.map +1 -1
- package/api/entities/Account.d.ts +4 -0
- package/api/entities/Account.d.ts.map +1 -1
- package/api/entities/Account.js +10 -0
- package/api/entities/Account.js.map +1 -1
- package/api/entities/Asset/Checkpoints/Schedules.d.ts +1 -1
- package/api/entities/Asset/Settlements.d.ts +2 -2
- package/api/entities/Asset/Settlements.js +2 -2
- package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts +3 -0
- package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/ClaimCount.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts +3 -0
- package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/ClaimPercentage.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/Count.d.ts +3 -0
- package/api/entities/Asset/TransferRestrictions/Count.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/Count.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/Percentage.d.ts +3 -0
- package/api/entities/Asset/TransferRestrictions/Percentage.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/Percentage.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js +11 -10
- package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js.map +1 -1
- package/api/entities/DividendDistribution/index.d.ts.map +1 -1
- package/api/entities/DividendDistribution/index.js +2 -2
- package/api/entities/DividendDistribution/index.js.map +1 -1
- package/api/procedures/addAssetRequirement.d.ts +2 -2
- package/api/procedures/addAssetRequirement.d.ts.map +1 -1
- package/api/procedures/addAssetRequirement.js +3 -3
- package/api/procedures/addAssetRequirement.js.map +1 -1
- package/api/procedures/addAssetStat.d.ts +2 -2
- package/api/procedures/addAssetStat.d.ts.map +1 -1
- package/api/procedures/addAssetStat.js +6 -8
- package/api/procedures/addAssetStat.js.map +1 -1
- package/api/procedures/addInstruction.d.ts +4 -4
- package/api/procedures/addInstruction.d.ts.map +1 -1
- package/api/procedures/addInstruction.js +14 -16
- package/api/procedures/addInstruction.js.map +1 -1
- package/api/procedures/addInvestorUniquenessClaim.d.ts +2 -2
- package/api/procedures/addInvestorUniquenessClaim.d.ts.map +1 -1
- package/api/procedures/addInvestorUniquenessClaim.js +6 -4
- package/api/procedures/addInvestorUniquenessClaim.js.map +1 -1
- package/api/procedures/addTransferRestriction.d.ts +2 -2
- package/api/procedures/addTransferRestriction.d.ts.map +1 -1
- package/api/procedures/addTransferRestriction.js +16 -19
- package/api/procedures/addTransferRestriction.js.map +1 -1
- package/api/procedures/claimClassicTicker.d.ts +2 -1
- package/api/procedures/claimClassicTicker.d.ts.map +1 -1
- package/api/procedures/claimClassicTicker.js +3 -3
- package/api/procedures/claimClassicTicker.js.map +1 -1
- package/api/procedures/claimDividends.d.ts +2 -1
- package/api/procedures/claimDividends.d.ts.map +1 -1
- package/api/procedures/claimDividends.js +3 -2
- package/api/procedures/claimDividends.js.map +1 -1
- package/api/procedures/closeOffering.d.ts +2 -2
- package/api/procedures/closeOffering.d.ts.map +1 -1
- package/api/procedures/closeOffering.js +3 -2
- package/api/procedures/closeOffering.js.map +1 -1
- package/api/procedures/configureDividendDistribution.d.ts +3 -3
- package/api/procedures/configureDividendDistribution.d.ts.map +1 -1
- package/api/procedures/configureDividendDistribution.js +3 -4
- package/api/procedures/configureDividendDistribution.js.map +1 -1
- package/api/procedures/consumeAddMultiSigSignerAuthorization.d.ts +2 -2
- package/api/procedures/consumeAddMultiSigSignerAuthorization.d.ts.map +1 -1
- package/api/procedures/consumeAddMultiSigSignerAuthorization.js +3 -4
- package/api/procedures/consumeAddMultiSigSignerAuthorization.js.map +1 -1
- package/api/procedures/consumeAuthorizationRequests.d.ts +2 -2
- package/api/procedures/consumeAuthorizationRequests.d.ts.map +1 -1
- package/api/procedures/consumeAuthorizationRequests.js +18 -10
- package/api/procedures/consumeAuthorizationRequests.js.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.d.ts +2 -2
- package/api/procedures/consumeJoinOrRotateAuthorization.d.ts.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.js +8 -7
- package/api/procedures/consumeJoinOrRotateAuthorization.js.map +1 -1
- package/api/procedures/controllerTransfer.d.ts +2 -2
- package/api/procedures/controllerTransfer.d.ts.map +1 -1
- package/api/procedures/controllerTransfer.js +3 -2
- package/api/procedures/controllerTransfer.js.map +1 -1
- package/api/procedures/createAsset.d.ts +2 -2
- package/api/procedures/createAsset.d.ts.map +1 -1
- package/api/procedures/createAsset.js +19 -39
- package/api/procedures/createAsset.js.map +1 -1
- package/api/procedures/createCheckpoint.d.ts +3 -3
- package/api/procedures/createCheckpoint.d.ts.map +1 -1
- package/api/procedures/createCheckpoint.js +3 -4
- package/api/procedures/createCheckpoint.js.map +1 -1
- package/api/procedures/createCheckpointSchedule.d.ts +3 -3
- package/api/procedures/createCheckpointSchedule.d.ts.map +1 -1
- package/api/procedures/createCheckpointSchedule.js +3 -4
- package/api/procedures/createCheckpointSchedule.js.map +1 -1
- package/api/procedures/createGroup.d.ts +3 -3
- package/api/procedures/createGroup.d.ts.map +1 -1
- package/api/procedures/createGroup.js +3 -4
- package/api/procedures/createGroup.js.map +1 -1
- package/api/procedures/createMultiSig.d.ts +3 -2
- package/api/procedures/createMultiSig.d.ts.map +1 -1
- package/api/procedures/createMultiSig.js +3 -4
- package/api/procedures/createMultiSig.js.map +1 -1
- package/api/procedures/createPortfolios.d.ts +3 -2
- package/api/procedures/createPortfolios.d.ts.map +1 -1
- package/api/procedures/createPortfolios.js +4 -6
- package/api/procedures/createPortfolios.js.map +1 -1
- package/api/procedures/createTransactionBatch.d.ts +25 -0
- package/api/procedures/createTransactionBatch.d.ts.map +1 -0
- package/api/procedures/createTransactionBatch.js +118 -0
- package/api/procedures/createTransactionBatch.js.map +1 -0
- package/api/procedures/createVenue.d.ts +3 -2
- package/api/procedures/createVenue.d.ts.map +1 -1
- package/api/procedures/createVenue.js +3 -4
- package/api/procedures/createVenue.js.map +1 -1
- package/api/procedures/deletePortfolio.d.ts +2 -2
- package/api/procedures/deletePortfolio.d.ts.map +1 -1
- package/api/procedures/deletePortfolio.js +3 -2
- package/api/procedures/deletePortfolio.js.map +1 -1
- package/api/procedures/investInOffering.d.ts +2 -2
- package/api/procedures/investInOffering.d.ts.map +1 -1
- package/api/procedures/investInOffering.js +3 -2
- package/api/procedures/investInOffering.js.map +1 -1
- package/api/procedures/inviteAccount.d.ts +3 -2
- package/api/procedures/inviteAccount.d.ts.map +1 -1
- package/api/procedures/inviteAccount.js +3 -4
- package/api/procedures/inviteAccount.js.map +1 -1
- package/api/procedures/inviteExternalAgent.d.ts +3 -3
- package/api/procedures/inviteExternalAgent.d.ts.map +1 -1
- package/api/procedures/inviteExternalAgent.js +6 -10
- package/api/procedures/inviteExternalAgent.js.map +1 -1
- package/api/procedures/issueTokens.d.ts +2 -2
- package/api/procedures/issueTokens.d.ts.map +1 -1
- package/api/procedures/issueTokens.js +3 -3
- package/api/procedures/issueTokens.js.map +1 -1
- package/api/procedures/launchOffering.d.ts +3 -3
- package/api/procedures/launchOffering.d.ts.map +1 -1
- package/api/procedures/launchOffering.js +3 -4
- package/api/procedures/launchOffering.js.map +1 -1
- package/api/procedures/leaveIdentity.d.ts +2 -1
- package/api/procedures/leaveIdentity.d.ts.map +1 -1
- package/api/procedures/leaveIdentity.js +1 -1
- package/api/procedures/leaveIdentity.js.map +1 -1
- package/api/procedures/linkCaDocs.d.ts +2 -2
- package/api/procedures/linkCaDocs.d.ts.map +1 -1
- package/api/procedures/linkCaDocs.js +3 -2
- package/api/procedures/linkCaDocs.js.map +1 -1
- package/api/procedures/modifyAllowance.d.ts +2 -2
- package/api/procedures/modifyAllowance.d.ts.map +1 -1
- package/api/procedures/modifyAllowance.js +3 -2
- package/api/procedures/modifyAllowance.js.map +1 -1
- package/api/procedures/modifyAsset.d.ts +2 -2
- package/api/procedures/modifyAsset.d.ts.map +1 -1
- package/api/procedures/modifyAsset.js +1 -2
- package/api/procedures/modifyAsset.js.map +1 -1
- package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts +2 -2
- package/api/procedures/modifyAssetTrustedClaimIssuers.d.ts.map +1 -1
- package/api/procedures/modifyAssetTrustedClaimIssuers.js +11 -9
- package/api/procedures/modifyAssetTrustedClaimIssuers.js.map +1 -1
- package/api/procedures/modifyCaCheckpoint.d.ts +2 -2
- package/api/procedures/modifyCaCheckpoint.d.ts.map +1 -1
- package/api/procedures/modifyCaCheckpoint.js +19 -3
- package/api/procedures/modifyCaCheckpoint.js.map +1 -1
- package/api/procedures/modifyCaDefaultConfig.d.ts +2 -2
- package/api/procedures/modifyCaDefaultConfig.d.ts.map +1 -1
- package/api/procedures/modifyCaDefaultConfig.js +12 -6
- package/api/procedures/modifyCaDefaultConfig.js.map +1 -1
- package/api/procedures/modifyClaims.d.ts +2 -2
- package/api/procedures/modifyClaims.d.ts.map +1 -1
- package/api/procedures/modifyClaims.js +15 -11
- package/api/procedures/modifyClaims.js.map +1 -1
- package/api/procedures/modifyComplianceRequirement.d.ts +2 -2
- package/api/procedures/modifyComplianceRequirement.d.ts.map +1 -1
- package/api/procedures/modifyComplianceRequirement.js +3 -2
- package/api/procedures/modifyComplianceRequirement.js.map +1 -1
- package/api/procedures/modifyCorporateActionsAgent.d.ts +2 -2
- package/api/procedures/modifyCorporateActionsAgent.d.ts.map +1 -1
- package/api/procedures/modifyCorporateActionsAgent.js +3 -2
- package/api/procedures/modifyCorporateActionsAgent.js.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.d.ts +2 -2
- package/api/procedures/modifyInstructionAffirmation.d.ts.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.js +9 -10
- package/api/procedures/modifyInstructionAffirmation.js.map +1 -1
- package/api/procedures/modifyMultiSig.d.ts +2 -2
- package/api/procedures/modifyMultiSig.d.ts.map +1 -1
- package/api/procedures/modifyMultiSig.js +4 -1
- package/api/procedures/modifyMultiSig.js.map +1 -1
- package/api/procedures/modifyOfferingTimes.d.ts +2 -2
- package/api/procedures/modifyOfferingTimes.d.ts.map +1 -1
- package/api/procedures/modifyOfferingTimes.js +3 -2
- package/api/procedures/modifyOfferingTimes.js.map +1 -1
- package/api/procedures/modifyPrimaryIssuanceAgent.d.ts +2 -2
- package/api/procedures/modifyPrimaryIssuanceAgent.d.ts.map +1 -1
- package/api/procedures/modifyPrimaryIssuanceAgent.js +3 -2
- package/api/procedures/modifyPrimaryIssuanceAgent.js.map +1 -1
- package/api/procedures/modifySignerPermissions.d.ts +2 -2
- package/api/procedures/modifySignerPermissions.d.ts.map +1 -1
- package/api/procedures/modifySignerPermissions.js +3 -2
- package/api/procedures/modifySignerPermissions.js.map +1 -1
- package/api/procedures/modifyVenue.d.ts +2 -2
- package/api/procedures/modifyVenue.d.ts.map +1 -1
- package/api/procedures/modifyVenue.js +1 -1
- package/api/procedures/modifyVenue.js.map +1 -1
- package/api/procedures/moveFunds.d.ts +2 -2
- package/api/procedures/moveFunds.d.ts.map +1 -1
- package/api/procedures/moveFunds.js +3 -2
- package/api/procedures/moveFunds.js.map +1 -1
- package/api/procedures/payDividends.d.ts +2 -2
- package/api/procedures/payDividends.d.ts.map +1 -1
- package/api/procedures/payDividends.js +3 -2
- package/api/procedures/payDividends.js.map +1 -1
- package/api/procedures/quitCustody.d.ts +2 -2
- package/api/procedures/quitCustody.d.ts.map +1 -1
- package/api/procedures/quitCustody.js +3 -2
- package/api/procedures/quitCustody.js.map +1 -1
- package/api/procedures/quitSubsidy.d.ts +2 -2
- package/api/procedures/quitSubsidy.d.ts.map +1 -1
- package/api/procedures/quitSubsidy.js +3 -2
- package/api/procedures/quitSubsidy.js.map +1 -1
- package/api/procedures/reclaimDividendDistributionFunds.d.ts +2 -2
- package/api/procedures/reclaimDividendDistributionFunds.d.ts.map +1 -1
- package/api/procedures/reclaimDividendDistributionFunds.js +3 -2
- package/api/procedures/reclaimDividendDistributionFunds.js.map +1 -1
- package/api/procedures/redeemTokens.d.ts +2 -2
- package/api/procedures/redeemTokens.d.ts.map +1 -1
- package/api/procedures/redeemTokens.js +3 -2
- package/api/procedures/redeemTokens.js.map +1 -1
- package/api/procedures/registerIdentity.d.ts +3 -2
- package/api/procedures/registerIdentity.d.ts.map +1 -1
- package/api/procedures/registerIdentity.js +3 -4
- package/api/procedures/registerIdentity.js.map +1 -1
- package/api/procedures/removeAssetRequirement.d.ts +2 -2
- package/api/procedures/removeAssetRequirement.d.ts.map +1 -1
- package/api/procedures/removeAssetRequirement.js +3 -3
- package/api/procedures/removeAssetRequirement.js.map +1 -1
- package/api/procedures/removeAssetStat.d.ts +2 -2
- package/api/procedures/removeAssetStat.d.ts.map +1 -1
- package/api/procedures/removeAssetStat.js +7 -5
- package/api/procedures/removeAssetStat.js.map +1 -1
- package/api/procedures/removeCheckpointSchedule.d.ts +2 -2
- package/api/procedures/removeCheckpointSchedule.d.ts.map +1 -1
- package/api/procedures/removeCheckpointSchedule.js +3 -2
- package/api/procedures/removeCheckpointSchedule.js.map +1 -1
- package/api/procedures/removeCorporateAction.d.ts +2 -2
- package/api/procedures/removeCorporateAction.d.ts.map +1 -1
- package/api/procedures/removeCorporateAction.js +3 -2
- package/api/procedures/removeCorporateAction.js.map +1 -1
- package/api/procedures/removeCorporateActionsAgent.d.ts +2 -2
- package/api/procedures/removeCorporateActionsAgent.d.ts.map +1 -1
- package/api/procedures/removeCorporateActionsAgent.js +3 -2
- package/api/procedures/removeCorporateActionsAgent.js.map +1 -1
- package/api/procedures/removeExternalAgent.d.ts +2 -2
- package/api/procedures/removeExternalAgent.d.ts.map +1 -1
- package/api/procedures/removeExternalAgent.js +3 -2
- package/api/procedures/removeExternalAgent.js.map +1 -1
- package/api/procedures/removePrimaryIssuanceAgent.d.ts +2 -2
- package/api/procedures/removePrimaryIssuanceAgent.d.ts.map +1 -1
- package/api/procedures/removePrimaryIssuanceAgent.js +3 -2
- package/api/procedures/removePrimaryIssuanceAgent.js.map +1 -1
- package/api/procedures/removeSecondaryAccounts.d.ts +2 -1
- package/api/procedures/removeSecondaryAccounts.d.ts.map +1 -1
- package/api/procedures/removeSecondaryAccounts.js +3 -2
- package/api/procedures/removeSecondaryAccounts.js.map +1 -1
- package/api/procedures/renamePortfolio.d.ts +2 -2
- package/api/procedures/renamePortfolio.d.ts.map +1 -1
- package/api/procedures/renamePortfolio.js +3 -3
- package/api/procedures/renamePortfolio.js.map +1 -1
- package/api/procedures/rescheduleInstruction.d.ts +2 -1
- package/api/procedures/rescheduleInstruction.d.ts.map +1 -1
- package/api/procedures/rescheduleInstruction.js +3 -3
- package/api/procedures/rescheduleInstruction.js.map +1 -1
- package/api/procedures/reserveTicker.d.ts +3 -3
- package/api/procedures/reserveTicker.d.ts.map +1 -1
- package/api/procedures/reserveTicker.js +3 -4
- package/api/procedures/reserveTicker.js.map +1 -1
- package/api/procedures/setAssetDocuments.d.ts +2 -2
- package/api/procedures/setAssetDocuments.d.ts.map +1 -1
- package/api/procedures/setAssetDocuments.js +1 -2
- package/api/procedures/setAssetDocuments.js.map +1 -1
- package/api/procedures/setAssetRequirements.d.ts +2 -2
- package/api/procedures/setAssetRequirements.d.ts.map +1 -1
- package/api/procedures/setAssetRequirements.js +9 -10
- package/api/procedures/setAssetRequirements.js.map +1 -1
- package/api/procedures/setCustodian.d.ts +3 -3
- package/api/procedures/setCustodian.d.ts.map +1 -1
- package/api/procedures/setCustodian.js +3 -6
- package/api/procedures/setCustodian.js.map +1 -1
- package/api/procedures/setGroupPermissions.d.ts +2 -2
- package/api/procedures/setGroupPermissions.d.ts.map +1 -1
- package/api/procedures/setGroupPermissions.js +3 -2
- package/api/procedures/setGroupPermissions.js.map +1 -1
- package/api/procedures/setPermissionGroup.d.ts +2 -2
- package/api/procedures/setPermissionGroup.d.ts.map +1 -1
- package/api/procedures/setPermissionGroup.js +6 -7
- package/api/procedures/setPermissionGroup.js.map +1 -1
- package/api/procedures/setTransferRestrictions.d.ts +8 -3
- package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
- package/api/procedures/setTransferRestrictions.js +117 -45
- package/api/procedures/setTransferRestrictions.js.map +1 -1
- package/api/procedures/subsidizeAccount.d.ts +3 -2
- package/api/procedures/subsidizeAccount.d.ts.map +1 -1
- package/api/procedures/subsidizeAccount.js +3 -4
- package/api/procedures/subsidizeAccount.js.map +1 -1
- package/api/procedures/toggleFreezeOffering.d.ts +2 -2
- package/api/procedures/toggleFreezeOffering.d.ts.map +1 -1
- package/api/procedures/toggleFreezeOffering.js +17 -18
- package/api/procedures/toggleFreezeOffering.js.map +1 -1
- package/api/procedures/toggleFreezeSecondaryAccounts.d.ts +2 -2
- package/api/procedures/toggleFreezeSecondaryAccounts.d.ts.map +1 -1
- package/api/procedures/toggleFreezeSecondaryAccounts.js +7 -9
- package/api/procedures/toggleFreezeSecondaryAccounts.js.map +1 -1
- package/api/procedures/toggleFreezeTransfers.d.ts +2 -2
- package/api/procedures/toggleFreezeTransfers.d.ts.map +1 -1
- package/api/procedures/toggleFreezeTransfers.js +12 -13
- package/api/procedures/toggleFreezeTransfers.js.map +1 -1
- package/api/procedures/togglePauseRequirements.d.ts +2 -2
- package/api/procedures/togglePauseRequirements.d.ts.map +1 -1
- package/api/procedures/togglePauseRequirements.js +3 -3
- package/api/procedures/togglePauseRequirements.js.map +1 -1
- package/api/procedures/transferAssetOwnership.d.ts +3 -3
- package/api/procedures/transferAssetOwnership.d.ts.map +1 -1
- package/api/procedures/transferAssetOwnership.js +3 -4
- package/api/procedures/transferAssetOwnership.js.map +1 -1
- package/api/procedures/transferPolyx.d.ts +2 -2
- package/api/procedures/transferPolyx.d.ts.map +1 -1
- package/api/procedures/transferPolyx.js +8 -8
- package/api/procedures/transferPolyx.js.map +1 -1
- package/api/procedures/transferTickerOwnership.d.ts +3 -3
- package/api/procedures/transferTickerOwnership.d.ts.map +1 -1
- package/api/procedures/transferTickerOwnership.js +3 -4
- package/api/procedures/transferTickerOwnership.js.map +1 -1
- package/api/procedures/types.d.ts +13 -30
- package/api/procedures/types.d.ts.map +1 -1
- package/api/procedures/types.js +1 -23
- package/api/procedures/types.js.map +1 -1
- package/api/procedures/utils.d.ts +1 -2
- package/api/procedures/utils.d.ts.map +1 -1
- package/api/procedures/utils.js +1 -8
- package/api/procedures/utils.js.map +1 -1
- package/api/procedures/waivePermissions.d.ts +2 -2
- package/api/procedures/waivePermissions.d.ts.map +1 -1
- package/api/procedures/waivePermissions.js +3 -2
- package/api/procedures/waivePermissions.js.map +1 -1
- package/base/Context.d.ts +15 -2
- package/base/Context.d.ts.map +1 -1
- package/base/Context.js +37 -3
- package/base/Context.js.map +1 -1
- package/base/PolymeshError.js +1 -1
- package/base/PolymeshError.js.map +1 -1
- package/base/PolymeshTransaction.d.ts +20 -19
- package/base/PolymeshTransaction.d.ts.map +1 -1
- package/base/PolymeshTransaction.js +19 -12
- package/base/PolymeshTransaction.js.map +1 -1
- package/base/PolymeshTransactionBase.d.ts +70 -35
- package/base/PolymeshTransactionBase.d.ts.map +1 -1
- package/base/PolymeshTransactionBase.js +237 -68
- package/base/PolymeshTransactionBase.js.map +1 -1
- package/base/PolymeshTransactionBatch.d.ts +43 -15
- package/base/PolymeshTransactionBatch.d.ts.map +1 -1
- package/base/PolymeshTransactionBatch.js +107 -18
- package/base/PolymeshTransactionBatch.js.map +1 -1
- package/base/Procedure.d.ts +10 -35
- package/base/Procedure.d.ts.map +1 -1
- package/base/Procedure.js +27 -92
- package/base/Procedure.js.map +1 -1
- package/base/types.d.ts +2 -4
- package/base/types.d.ts.map +1 -1
- package/internal.d.ts +1 -3
- package/internal.d.ts.map +1 -1
- package/internal.js +5 -9
- package/internal.js.map +1 -1
- package/npm-package/polymeshassociation-polymesh-sdk-16.0.0-beta.3.tgz +0 -0
- package/package.json +1 -1
- package/types/index.d.ts +75 -66
- package/types/index.d.ts.map +1 -1
- package/types/index.js +8 -25
- package/types/index.js.map +1 -1
- package/types/internal.d.ts +74 -105
- package/types/internal.d.ts.map +1 -1
- package/types/internal.js +27 -8
- package/types/internal.js.map +1 -1
- package/utils/conversion.d.ts +7 -7
- package/utils/conversion.d.ts.map +1 -1
- package/utils/conversion.js +33 -27
- package/utils/conversion.js.map +1 -1
- package/utils/internal.d.ts +37 -19
- package/utils/internal.d.ts.map +1 -1
- package/utils/internal.js +123 -55
- package/utils/internal.js.map +1 -1
- package/utils/typeguards.d.ts +2 -2
- package/utils/typeguards.d.ts.map +1 -1
- package/utils/typeguards.js.map +1 -1
- package/api/procedures/modifyDistributionCheckpoint.d.ts +0 -25
- package/api/procedures/modifyDistributionCheckpoint.d.ts.map +0 -1
- package/api/procedures/modifyDistributionCheckpoint.js +0 -60
- package/api/procedures/modifyDistributionCheckpoint.js.map +0 -1
- package/base/PostTransactionValue.d.ts +0 -45
- package/base/PostTransactionValue.d.ts.map +0 -1
- package/base/PostTransactionValue.js +0 -108
- package/base/PostTransactionValue.js.map +0 -1
- package/base/TransactionQueue.d.ts +0 -142
- package/base/TransactionQueue.d.ts.map +0 -1
- package/base/TransactionQueue.js +0 -420
- package/base/TransactionQueue.js.map +0 -1
- package/npm-package/polymeshassociation-polymesh-sdk-16.0.0-beta.2.tgz +0 -0
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PostTransactionValue = void 0;
|
|
13
|
-
const internal_1 = require("../internal");
|
|
14
|
-
const types_1 = require("../types");
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*
|
|
18
|
-
* Represents a value or method that doesn't exist at the moment, but will exist once a certain transaction
|
|
19
|
-
* has been run
|
|
20
|
-
*/
|
|
21
|
-
class PostTransactionValue {
|
|
22
|
-
// eslint-disable-next-line require-jsdoc
|
|
23
|
-
constructor(resolver, runCondition = () => true) {
|
|
24
|
-
this.resolved = false;
|
|
25
|
-
/**
|
|
26
|
-
* Array of PostTransactionValues spawned by this one via `transform` or `merge`. We use this to keep track
|
|
27
|
-
*/
|
|
28
|
-
this.children = [];
|
|
29
|
-
this.resolver = resolver;
|
|
30
|
-
this.runCondition = runCondition;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Run the resolver function and assign its result to this object
|
|
34
|
-
*/
|
|
35
|
-
run(receipt) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
if (!this.runCondition()) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const result = yield this.resolver(receipt);
|
|
41
|
-
this.resolved = true;
|
|
42
|
-
this._value = result;
|
|
43
|
-
yield Promise.all(this.children.map(child => child.run(receipt)));
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Retrieve the resolved value
|
|
48
|
-
*
|
|
49
|
-
* @throws if the value is being accessed before the resolver function has run
|
|
50
|
-
*/
|
|
51
|
-
get value() {
|
|
52
|
-
const { _value: value, resolved } = this;
|
|
53
|
-
if (!resolved) {
|
|
54
|
-
throw new internal_1.PolymeshError({
|
|
55
|
-
code: types_1.ErrorCode.FatalError,
|
|
56
|
-
message: 'Post Transaction Value accessed before the corresponding transaction was executed',
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
60
|
-
return value;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Add a new PostTransactionValue to the children array to be run when this one runs
|
|
64
|
-
*/
|
|
65
|
-
addChild(child) {
|
|
66
|
-
this.children.push(child);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Return a new PostTransactionValue that resolves to the value of this one processed by
|
|
70
|
-
* the passed callback. The new PostTransactionValue is resolved when this one is resolved
|
|
71
|
-
*/
|
|
72
|
-
transform(callback) {
|
|
73
|
-
const newResolver = () => {
|
|
74
|
-
return callback(this.value);
|
|
75
|
-
};
|
|
76
|
-
const child = new PostTransactionValue(newResolver);
|
|
77
|
-
this.addChild(child);
|
|
78
|
-
return child;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Merge this PostTransactionValue with another PostTransactionValue (or plain value), resulting in a new
|
|
82
|
-
* PostTransactionValue that resolves once these two are resolved. The resolved value is the result of passing the
|
|
83
|
-
* resolved values of both PostTransactionValues to the callback
|
|
84
|
-
*/
|
|
85
|
-
merge(postValue,
|
|
86
|
-
// cSpell: disable-next-line
|
|
87
|
-
callback) {
|
|
88
|
-
let newResolver;
|
|
89
|
-
let runCondition;
|
|
90
|
-
// do nothing on .run unless both underlying values have been resolved
|
|
91
|
-
if (postValue instanceof PostTransactionValue) {
|
|
92
|
-
newResolver = () => callback(this.value, postValue.value);
|
|
93
|
-
runCondition = () => this.resolved && postValue.resolved;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
newResolver = () => callback(this.value, postValue);
|
|
97
|
-
runCondition = () => this.resolved;
|
|
98
|
-
}
|
|
99
|
-
const child = new PostTransactionValue(newResolver, runCondition);
|
|
100
|
-
this.addChild(child);
|
|
101
|
-
if (postValue instanceof PostTransactionValue) {
|
|
102
|
-
postValue.addChild(child);
|
|
103
|
-
}
|
|
104
|
-
return child;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.PostTransactionValue = PostTransactionValue;
|
|
108
|
-
//# sourceMappingURL=PostTransactionValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PostTransactionValue.js","sourceRoot":"","sources":["../../src/base/PostTransactionValue.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,0CAA2C;AAC3C,oCAAoC;AAGpC;;;;;GAKG;AACH,MAAa,oBAAoB;IAc/B,yCAAyC;IACzC,YACE,QAAiE,EACjE,eAA8B,GAAY,EAAE,CAAC,IAAI;QAd3C,aAAQ,GAAG,KAAK,CAAC;QAMzB;;WAEG;QACK,aAAQ,GAAoC,EAAE,CAAC;QAOrD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACU,GAAG,CAAC,OAA2B;;YAC1C,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE;gBACxB,OAAO;aACR;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YAErB,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC;KAAA;IAED;;;;OAIG;IACH,IAAW,KAAK;QACd,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEzC,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAI,wBAAa,CAAC;gBACtB,IAAI,EAAE,iBAAS,CAAC,UAAU;gBAC1B,OAAO,EACL,mFAAmF;aACtF,CAAC,CAAC;SACJ;QAED,oEAAoE;QACpE,OAAO,KAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,QAAQ,CAAC,KAAoC;QACnD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,SAAS,CAAW,QAAkC;QAC3D,MAAM,WAAW,GAAG,GAAa,EAAE;YACjC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CAAC;QAEF,MAAM,KAAK,GAAG,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAErB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,KAAK,CACV,SAA+C;IAC/C,4BAA4B;IAC5B,QAAmD;QAEnD,IAAI,WAAW,CAAC;QAChB,IAAI,YAAY,CAAC;QAEjB,sEAAsE;QACtE,IAAI,SAAS,YAAY,oBAAoB,EAAE;YAC7C,WAAW,GAAG,GAAa,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;YACpE,YAAY,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC;SACnE;aAAM;YACL,WAAW,GAAG,GAAa,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC9D,YAAY,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;SAC7C;QAED,MAAM,KAAK,GAAG,IAAI,oBAAoB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAErB,IAAI,SAAS,YAAY,oBAAoB,EAAE;YAC7C,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC3B;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA/GD,oDA+GC"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { Context, PolymeshError, PolymeshTransactionBase } from "../internal";
|
|
2
|
-
import { FeesBreakdown, TransactionQueueStatus } from "../types";
|
|
3
|
-
import { MaybePostTransactionValue } from "../types/internal";
|
|
4
|
-
/**
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
declare type PolymeshTransactionArray<TransactionArgs extends unknown[][]> = {
|
|
8
|
-
[K in keyof TransactionArgs]: TransactionArgs[K] extends TransactionArgs[number] ? PolymeshTransactionBase<TransactionArgs[K]> : never;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Class to manage procedural transaction queues
|
|
12
|
-
*/
|
|
13
|
-
export declare class TransactionQueue<ProcedureReturnType = void, ReturnType = ProcedureReturnType, TransactionArgs extends unknown[][] = unknown[][]> {
|
|
14
|
-
/**
|
|
15
|
-
* transactions that will be run in the queue
|
|
16
|
-
*/
|
|
17
|
-
transactions: PolymeshTransactionArray<TransactionArgs>;
|
|
18
|
-
/**
|
|
19
|
-
* status of the queue
|
|
20
|
-
*/
|
|
21
|
-
status: TransactionQueueStatus;
|
|
22
|
-
/**
|
|
23
|
-
* optional error information
|
|
24
|
-
*/
|
|
25
|
-
error?: PolymeshError;
|
|
26
|
-
/**
|
|
27
|
-
* @hidden
|
|
28
|
-
* internal queue of transactions to be run
|
|
29
|
-
*/
|
|
30
|
-
private queue;
|
|
31
|
-
/**
|
|
32
|
-
* @hidden
|
|
33
|
-
* value
|
|
34
|
-
*/
|
|
35
|
-
private procedureResult;
|
|
36
|
-
/**
|
|
37
|
-
* @hidden
|
|
38
|
-
* function that transforms the return type
|
|
39
|
-
*/
|
|
40
|
-
private transformer;
|
|
41
|
-
/**
|
|
42
|
-
* @hidden
|
|
43
|
-
* internal event emitter to listen for status changes
|
|
44
|
-
*/
|
|
45
|
-
private emitter;
|
|
46
|
-
/**
|
|
47
|
-
* @hidden
|
|
48
|
-
* whether the queue has run or not (prevents re-running)
|
|
49
|
-
*/
|
|
50
|
-
private hasRun;
|
|
51
|
-
private context;
|
|
52
|
-
/**
|
|
53
|
-
* Create a transaction queue
|
|
54
|
-
*
|
|
55
|
-
* @param args.transactions - list of transactions to be run in this queue
|
|
56
|
-
* @param args.procedureResult - value that will be returned by the queue after it is run. It can be a {@link PostTransactionValue}
|
|
57
|
-
* @param args.transformer - function that transforms the procedure's return value before returning it after the queue is run
|
|
58
|
-
*/
|
|
59
|
-
constructor(args: {
|
|
60
|
-
transactions: PolymeshTransactionArray<TransactionArgs>;
|
|
61
|
-
procedureResult: MaybePostTransactionValue<ProcedureReturnType>;
|
|
62
|
-
transformer?: (result: ProcedureReturnType) => Promise<ReturnType> | ReturnType;
|
|
63
|
-
}, context: Context);
|
|
64
|
-
/**
|
|
65
|
-
* Run the transactions in the queue in sequential order. If a transaction fails or the user refuses to sign it, one of two things can happen:
|
|
66
|
-
*
|
|
67
|
-
* 1) If `transaction.isCritical === true`, the entire queue fails and the corresponding error is stored in `this.error` as well as thrown
|
|
68
|
-
* 2) Otherwise, the queue continues executing and the error is stored in `transaction.error`
|
|
69
|
-
*/
|
|
70
|
-
run(): Promise<ReturnType>;
|
|
71
|
-
/**
|
|
72
|
-
* Retrieve a lower bound of the fees required to execute this transaction queue.
|
|
73
|
-
* Transaction fees can be higher at execution time for three reasons:
|
|
74
|
-
*
|
|
75
|
-
* - One or more transaction arguments depend on the result of another transaction in the queue.
|
|
76
|
-
* This means fees can't be calculated for said transaction until previous transactions in the queue have run
|
|
77
|
-
* - Protocol or gas fees may vary between when this value is fetched and when the transaction is actually executed because of a
|
|
78
|
-
* governance vote
|
|
79
|
-
*
|
|
80
|
-
* Transaction fees are broken down between those that have to be paid by the signing Account and
|
|
81
|
-
* those that will be paid by third parties. In most cases, the entirety of the fees will be paid by
|
|
82
|
-
* either the signing Account or a **single** third party Account
|
|
83
|
-
*/
|
|
84
|
-
getMinFees(): Promise<FeesBreakdown>;
|
|
85
|
-
/**
|
|
86
|
-
* @hidden
|
|
87
|
-
*
|
|
88
|
-
* Return a breakdown of the queue's fees and which transactions are being subsidized
|
|
89
|
-
*/
|
|
90
|
-
private _getMinFees;
|
|
91
|
-
/**
|
|
92
|
-
* Subscribe to status changes on the Transaction Queue
|
|
93
|
-
*
|
|
94
|
-
* @param listener - callback function that will be called whenever the Transaction Queue's status changes
|
|
95
|
-
*
|
|
96
|
-
* @returns unsubscribe function
|
|
97
|
-
*/
|
|
98
|
-
onStatusChange(listener: (transactionQueue: this, err?: PolymeshError) => void): () => void;
|
|
99
|
-
/**
|
|
100
|
-
* Subscribe to status changes on individual transactions
|
|
101
|
-
*
|
|
102
|
-
* @param listener - callback function that will be called whenever the individual transaction's status changes
|
|
103
|
-
*
|
|
104
|
-
* @returns unsubscribe function
|
|
105
|
-
*/
|
|
106
|
-
onTransactionStatusChange<Values extends unknown[]>(listener: (transaction: PolymeshTransactionBase<Values>, transactionQueue: this) => void): () => void;
|
|
107
|
-
/**
|
|
108
|
-
* Subscribe to the results of this queue being processed by the harvester (and as such, available to the middleware)
|
|
109
|
-
*
|
|
110
|
-
* @param listener - callback function that will be called whenever the middleware is updated with the latest data.
|
|
111
|
-
* If there is an error (timeout or middleware offline) it will be passed to this callback
|
|
112
|
-
*
|
|
113
|
-
* @note this event will be fired even if the queue fails
|
|
114
|
-
* @returns unsubscribe function
|
|
115
|
-
* @throws if the middleware wasn't enabled when instantiating the SDK client
|
|
116
|
-
*/
|
|
117
|
-
onProcessedByMiddleware(listener: (err?: PolymeshError) => void): () => void;
|
|
118
|
-
/**
|
|
119
|
-
* @hidden
|
|
120
|
-
*/
|
|
121
|
-
private updateStatus;
|
|
122
|
-
/**
|
|
123
|
-
* @hidden
|
|
124
|
-
*/
|
|
125
|
-
private executeTransactionQueue;
|
|
126
|
-
/**
|
|
127
|
-
* Poll the middleware every 2 seconds to see if it has already processed the
|
|
128
|
-
* block that reflects the changes brought on by this queue being run. If so,
|
|
129
|
-
* emit the corresponding event. After 5 retries (or if the middleware can't be reached),
|
|
130
|
-
* the event is emitted with an error
|
|
131
|
-
*
|
|
132
|
-
* @note uses the middleware
|
|
133
|
-
*/
|
|
134
|
-
private emitWhenMiddlewareIsSynced;
|
|
135
|
-
/**
|
|
136
|
-
* Check if balances and allowances (both third party and signing Account)
|
|
137
|
-
* are sufficient to cover this queue's fees
|
|
138
|
-
*/
|
|
139
|
-
private assertFeesCovered;
|
|
140
|
-
}
|
|
141
|
-
export {};
|
|
142
|
-
//# sourceMappingURL=TransactionQueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionQueue.d.ts","sourceRoot":"","sources":["../../src/base/TransactionQueue.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAwB,oBAAmB;AAGnG,OAAO,EAGL,aAAa,EAGb,sBAAsB,EACvB,iBAAgB;AACjB,OAAO,EAAE,yBAAyB,EAAE,0BAAyB;AAa7D;;GAEG;AACH,aAAK,wBAAwB,CAAC,eAAe,SAAS,OAAO,EAAE,EAAE,IAAI;KAClE,CAAC,IAAI,MAAM,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,SAAS,eAAe,CAAC,MAAM,CAAC,GAC5E,uBAAuB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAC3C,KAAK;CACV,CAAC;AAEF;;GAEG;AACH,qBAAa,gBAAgB,CAC3B,mBAAmB,GAAG,IAAI,EAC1B,UAAU,GAAG,mBAAmB,EAChC,eAAe,SAAS,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE;IAEjD;;OAEG;IACI,YAAY,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;IAE/D;;OAEG;IACI,MAAM,EAAE,sBAAsB,CAA+B;IAEpE;;OAEG;IACI,KAAK,CAAC,EAAE,aAAa,CAAC;IAE7B;;;OAGG;IACH,OAAO,CAAC,KAAK,CAA8D;IAE3E;;;OAGG;IACH,OAAO,CAAC,eAAe,CAAiD;IAExE;;;OAGG;IACH,OAAO,CAAC,WAAW,CAA6E;IAEhG;;;OAGG;IACH,OAAO,CAAC,OAAO,CAAe;IAE9B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAU;IAExB,OAAO,CAAC,OAAO,CAAU;IAEzB;;;;;;OAMG;gBAED,IAAI,EAAE;QACJ,YAAY,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;QACxD,eAAe,EAAE,yBAAyB,CAAC,mBAAmB,CAAC,CAAC;QAChE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;KACjF,EACD,OAAO,EAAE,OAAO;IAwBlB;;;;;OAKG;IACU,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;IAwCvC;;;;;;;;;;;;OAYG;IACU,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;IAUjD;;;;OAIG;YACW,WAAW;IA8FzB;;;;;;OAMG;IACI,cAAc,CACnB,QAAQ,EAAE,CAAC,gBAAgB,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,aAAa,KAAK,IAAI,GAC9D,MAAM,IAAI;IAQb;;;;;;OAMG;IACI,yBAAyB,CAAC,MAAM,SAAS,OAAO,EAAE,EACvD,QAAQ,EAAE,CAAC,WAAW,EAAE,uBAAuB,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,IAAI,KAAK,IAAI,GACvF,MAAM,IAAI;IAQb;;;;;;;;;OASG;IACI,uBAAuB,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI;IAenF;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB;;OAEG;YACW,uBAAuB;IAkBrC;;;;;;;OAOG;YACW,0BAA0B;IAyDxC;;;OAGG;YACW,iBAAiB;CAkEhC"}
|
package/base/TransactionQueue.js
DELETED
|
@@ -1,420 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.TransactionQueue = void 0;
|
|
27
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
28
|
-
const bluebird_1 = __importDefault(require("bluebird"));
|
|
29
|
-
const events_1 = require("events");
|
|
30
|
-
const lodash_1 = require("lodash");
|
|
31
|
-
const internal_1 = require("../internal");
|
|
32
|
-
const queries_1 = require("../middleware/queries");
|
|
33
|
-
const types_1 = require("../types");
|
|
34
|
-
const internal_2 = require("../utils/internal");
|
|
35
|
-
/**
|
|
36
|
-
* @hidden
|
|
37
|
-
*/
|
|
38
|
-
var Event;
|
|
39
|
-
(function (Event) {
|
|
40
|
-
Event["StatusChange"] = "StatusChange";
|
|
41
|
-
Event["TransactionStatusChange"] = "TransactionStatusChange";
|
|
42
|
-
Event["ProcessedByMiddleware"] = "ProcessedByMiddleware";
|
|
43
|
-
})(Event || (Event = {}));
|
|
44
|
-
/**
|
|
45
|
-
* Class to manage procedural transaction queues
|
|
46
|
-
*/
|
|
47
|
-
class TransactionQueue {
|
|
48
|
-
/**
|
|
49
|
-
* Create a transaction queue
|
|
50
|
-
*
|
|
51
|
-
* @param args.transactions - list of transactions to be run in this queue
|
|
52
|
-
* @param args.procedureResult - value that will be returned by the queue after it is run. It can be a {@link PostTransactionValue}
|
|
53
|
-
* @param args.transformer - function that transforms the procedure's return value before returning it after the queue is run
|
|
54
|
-
*/
|
|
55
|
-
constructor(args, context) {
|
|
56
|
-
/**
|
|
57
|
-
* status of the queue
|
|
58
|
-
*/
|
|
59
|
-
this.status = types_1.TransactionQueueStatus.Idle;
|
|
60
|
-
/**
|
|
61
|
-
* @hidden
|
|
62
|
-
* internal queue of transactions to be run
|
|
63
|
-
*/
|
|
64
|
-
this.queue = [];
|
|
65
|
-
const { transactions, procedureResult, transformer = (val) => __awaiter(this, void 0, void 0, function* () { return val; }), } = args;
|
|
66
|
-
this.emitter = new events_1.EventEmitter();
|
|
67
|
-
this.procedureResult = procedureResult;
|
|
68
|
-
this.hasRun = false;
|
|
69
|
-
this.context = context;
|
|
70
|
-
this.transactions = [];
|
|
71
|
-
this.transformer = transformer;
|
|
72
|
-
transactions.forEach(transaction => {
|
|
73
|
-
transaction.onStatusChange(updatedTransaction => {
|
|
74
|
-
this.emitter.emit(Event.TransactionStatusChange, updatedTransaction, this);
|
|
75
|
-
});
|
|
76
|
-
this.transactions.push(transaction);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Run the transactions in the queue in sequential order. If a transaction fails or the user refuses to sign it, one of two things can happen:
|
|
81
|
-
*
|
|
82
|
-
* 1) If `transaction.isCritical === true`, the entire queue fails and the corresponding error is stored in `this.error` as well as thrown
|
|
83
|
-
* 2) Otherwise, the queue continues executing and the error is stored in `transaction.error`
|
|
84
|
-
*/
|
|
85
|
-
run() {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
if (this.hasRun) {
|
|
88
|
-
throw new internal_1.PolymeshError({
|
|
89
|
-
code: types_1.ErrorCode.General,
|
|
90
|
-
message: 'Cannot re-run a Transaction Queue',
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
yield this.assertFeesCovered();
|
|
94
|
-
this.queue = [...this.transactions];
|
|
95
|
-
this.updateStatus(types_1.TransactionQueueStatus.Running);
|
|
96
|
-
let procRes;
|
|
97
|
-
let res;
|
|
98
|
-
try {
|
|
99
|
-
yield this.executeTransactionQueue();
|
|
100
|
-
this.updateStatus(types_1.TransactionQueueStatus.Succeeded);
|
|
101
|
-
const { procedureResult } = this;
|
|
102
|
-
if (procedureResult instanceof internal_1.PostTransactionValue) {
|
|
103
|
-
procRes = procedureResult.value;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
procRes = procedureResult;
|
|
107
|
-
}
|
|
108
|
-
res = yield this.transformer(procRes);
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
this.error = err;
|
|
112
|
-
this.updateStatus(types_1.TransactionQueueStatus.Failed);
|
|
113
|
-
throw err;
|
|
114
|
-
}
|
|
115
|
-
finally {
|
|
116
|
-
this.hasRun = true;
|
|
117
|
-
yield this.emitWhenMiddlewareIsSynced();
|
|
118
|
-
}
|
|
119
|
-
return res;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Retrieve a lower bound of the fees required to execute this transaction queue.
|
|
124
|
-
* Transaction fees can be higher at execution time for three reasons:
|
|
125
|
-
*
|
|
126
|
-
* - One or more transaction arguments depend on the result of another transaction in the queue.
|
|
127
|
-
* This means fees can't be calculated for said transaction until previous transactions in the queue have run
|
|
128
|
-
* - Protocol or gas fees may vary between when this value is fetched and when the transaction is actually executed because of a
|
|
129
|
-
* governance vote
|
|
130
|
-
*
|
|
131
|
-
* Transaction fees are broken down between those that have to be paid by the signing Account and
|
|
132
|
-
* those that will be paid by third parties. In most cases, the entirety of the fees will be paid by
|
|
133
|
-
* either the signing Account or a **single** third party Account
|
|
134
|
-
*/
|
|
135
|
-
getMinFees() {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
const _a = yield this._getMinFees(), {
|
|
138
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
139
|
-
subsidizedTransactions } = _a, rest = __rest(_a, ["subsidizedTransactions"]);
|
|
140
|
-
return rest;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @hidden
|
|
145
|
-
*
|
|
146
|
-
* Return a breakdown of the queue's fees and which transactions are being subsidized
|
|
147
|
-
*/
|
|
148
|
-
_getMinFees() {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
const { context, transactions } = this;
|
|
151
|
-
// get the fees and paying Account for each transaction in the queue
|
|
152
|
-
const allFees = yield bluebird_1.default.map(transactions, (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
const [payingAccount, fees] = yield Promise.all([
|
|
154
|
-
transaction.getPayingAccount(),
|
|
155
|
-
transaction.getFees(),
|
|
156
|
-
]);
|
|
157
|
-
if (!fees) {
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
if (payingAccount) {
|
|
161
|
-
return {
|
|
162
|
-
fees,
|
|
163
|
-
payingAccount,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
fees,
|
|
168
|
-
};
|
|
169
|
-
}));
|
|
170
|
-
const addFees = (a, b) => {
|
|
171
|
-
return {
|
|
172
|
-
protocol: a.protocol.plus(b.protocol),
|
|
173
|
-
gas: a.gas.plus(b.gas),
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
// Account address -> fee data (for efficiency)
|
|
177
|
-
const breakdownByAccount = {};
|
|
178
|
-
// fees for the signing Account
|
|
179
|
-
let accountFees = {
|
|
180
|
-
protocol: new bignumber_js_1.default(0),
|
|
181
|
-
gas: new bignumber_js_1.default(0),
|
|
182
|
-
};
|
|
183
|
-
const subsidizedTransactions = [];
|
|
184
|
-
// compile the fees and other data for each paying Account (and the signing Account as well)
|
|
185
|
-
const eachPromise = bluebird_1.default.each(allFees, (transactionFees, index) => __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
if (!transactionFees) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const { fees, payingAccount } = transactionFees;
|
|
190
|
-
if (!payingAccount) {
|
|
191
|
-
// payingAccount === null means the signing Account has to pay
|
|
192
|
-
accountFees = addFees(accountFees, fees);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
const { account, type } = payingAccount;
|
|
196
|
-
const { address } = account;
|
|
197
|
-
const thirdPartyData = breakdownByAccount[address];
|
|
198
|
-
if (type === types_1.PayingAccountType.Subsidy) {
|
|
199
|
-
subsidizedTransactions.push(transactions[index]);
|
|
200
|
-
}
|
|
201
|
-
if (!thirdPartyData) {
|
|
202
|
-
// first time encountering this third party Account, we must populate the initial values
|
|
203
|
-
const { free: balance } = yield account.getBalance();
|
|
204
|
-
breakdownByAccount[address] = Object.assign(Object.assign({}, payingAccount), { balance,
|
|
205
|
-
fees });
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
// already encountered the Account before, just add the fees
|
|
209
|
-
thirdPartyData.fees = addFees(thirdPartyData.fees, fees);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}));
|
|
213
|
-
const { free: accountBalance } = yield context.accountBalance();
|
|
214
|
-
yield eachPromise;
|
|
215
|
-
const thirdPartyFees = (0, lodash_1.values)(breakdownByAccount);
|
|
216
|
-
return {
|
|
217
|
-
thirdPartyFees,
|
|
218
|
-
accountBalance,
|
|
219
|
-
accountFees,
|
|
220
|
-
subsidizedTransactions,
|
|
221
|
-
};
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Subscribe to status changes on the Transaction Queue
|
|
226
|
-
*
|
|
227
|
-
* @param listener - callback function that will be called whenever the Transaction Queue's status changes
|
|
228
|
-
*
|
|
229
|
-
* @returns unsubscribe function
|
|
230
|
-
*/
|
|
231
|
-
onStatusChange(listener) {
|
|
232
|
-
this.emitter.on(Event.StatusChange, listener);
|
|
233
|
-
return () => {
|
|
234
|
-
this.emitter.removeListener(Event.StatusChange, listener);
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Subscribe to status changes on individual transactions
|
|
239
|
-
*
|
|
240
|
-
* @param listener - callback function that will be called whenever the individual transaction's status changes
|
|
241
|
-
*
|
|
242
|
-
* @returns unsubscribe function
|
|
243
|
-
*/
|
|
244
|
-
onTransactionStatusChange(listener) {
|
|
245
|
-
this.emitter.on(Event.TransactionStatusChange, listener);
|
|
246
|
-
return () => {
|
|
247
|
-
this.emitter.removeListener(Event.TransactionStatusChange, listener);
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Subscribe to the results of this queue being processed by the harvester (and as such, available to the middleware)
|
|
252
|
-
*
|
|
253
|
-
* @param listener - callback function that will be called whenever the middleware is updated with the latest data.
|
|
254
|
-
* If there is an error (timeout or middleware offline) it will be passed to this callback
|
|
255
|
-
*
|
|
256
|
-
* @note this event will be fired even if the queue fails
|
|
257
|
-
* @returns unsubscribe function
|
|
258
|
-
* @throws if the middleware wasn't enabled when instantiating the SDK client
|
|
259
|
-
*/
|
|
260
|
-
onProcessedByMiddleware(listener) {
|
|
261
|
-
if (!this.context.isMiddlewareEnabled()) {
|
|
262
|
-
throw new internal_1.PolymeshError({
|
|
263
|
-
code: types_1.ErrorCode.General,
|
|
264
|
-
message: 'Cannot subscribe without an enabled middleware connection',
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
this.emitter.on(Event.ProcessedByMiddleware, listener);
|
|
268
|
-
return () => {
|
|
269
|
-
this.emitter.removeListener(Event.ProcessedByMiddleware, listener);
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* @hidden
|
|
274
|
-
*/
|
|
275
|
-
updateStatus(status) {
|
|
276
|
-
this.status = status;
|
|
277
|
-
switch (status) {
|
|
278
|
-
case types_1.TransactionQueueStatus.Running:
|
|
279
|
-
case types_1.TransactionQueueStatus.Succeeded: {
|
|
280
|
-
this.emitter.emit(Event.StatusChange, this);
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
case types_1.TransactionQueueStatus.Failed: {
|
|
284
|
-
this.emitter.emit(Event.StatusChange, this, this.error);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* @hidden
|
|
290
|
-
*/
|
|
291
|
-
executeTransactionQueue() {
|
|
292
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
-
const nextTransaction = this.queue.shift();
|
|
294
|
-
if (!nextTransaction) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
try {
|
|
298
|
-
yield nextTransaction.run();
|
|
299
|
-
}
|
|
300
|
-
catch (err) {
|
|
301
|
-
if (nextTransaction.isCritical) {
|
|
302
|
-
throw err;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
yield this.executeTransactionQueue();
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Poll the middleware every 2 seconds to see if it has already processed the
|
|
310
|
-
* block that reflects the changes brought on by this queue being run. If so,
|
|
311
|
-
* emit the corresponding event. After 5 retries (or if the middleware can't be reached),
|
|
312
|
-
* the event is emitted with an error
|
|
313
|
-
*
|
|
314
|
-
* @note uses the middleware
|
|
315
|
-
*/
|
|
316
|
-
emitWhenMiddlewareIsSynced() {
|
|
317
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
318
|
-
const { context } = this;
|
|
319
|
-
if (!context.isMiddlewareEnabled()) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
const blockNumber = yield context.getLatestBlock();
|
|
323
|
-
let done = false;
|
|
324
|
-
/*
|
|
325
|
-
* We do not await this promise because it is supposed to run in the background, and
|
|
326
|
-
* any errors encountered are emitted. If the user isn't listening, they shouldn't
|
|
327
|
-
* care about middleware (or other) errors anyway
|
|
328
|
-
*/
|
|
329
|
-
bluebird_1.default.each((0, lodash_1.range)(6), (i) => __awaiter(this, void 0, void 0, function* () {
|
|
330
|
-
if (done) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
try {
|
|
334
|
-
const { data: { latestBlock: { id: processedBlock }, }, } = yield context.queryMiddleware((0, queries_1.latestProcessedBlock)());
|
|
335
|
-
if (blockNumber.lte(processedBlock)) {
|
|
336
|
-
done = true;
|
|
337
|
-
this.emitter.emit(Event.ProcessedByMiddleware);
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
catch (err) { }
|
|
342
|
-
if (i === 5) {
|
|
343
|
-
this.emitter.emit(Event.ProcessedByMiddleware, new internal_1.PolymeshError({ code: types_1.ErrorCode.MiddlewareError, message: 'Timed out' }));
|
|
344
|
-
}
|
|
345
|
-
return (0, internal_2.delay)(2000);
|
|
346
|
-
})).catch(
|
|
347
|
-
/* istanbul ignore next: very hard to test, extreme edge case */
|
|
348
|
-
err => {
|
|
349
|
-
this.emitter.emit(Event.ProcessedByMiddleware, new internal_1.PolymeshError({
|
|
350
|
-
code: types_1.ErrorCode.UnexpectedError,
|
|
351
|
-
message: err.message || 'Unexpected error',
|
|
352
|
-
}));
|
|
353
|
-
});
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Check if balances and allowances (both third party and signing Account)
|
|
358
|
-
* are sufficient to cover this queue's fees
|
|
359
|
-
*/
|
|
360
|
-
assertFeesCovered() {
|
|
361
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
-
const breakdown = yield this._getMinFees();
|
|
363
|
-
const { accountBalance, accountFees, thirdPartyFees, subsidizedTransactions } = breakdown;
|
|
364
|
-
const unsupportedTransactions = subsidizedTransactions.filter(transaction => !transaction.supportsSubsidy());
|
|
365
|
-
if (unsupportedTransactions.length) {
|
|
366
|
-
throw new internal_1.PolymeshError({
|
|
367
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
368
|
-
message: 'Some of the transactions in the queue cannot be run with a subsidized Account',
|
|
369
|
-
data: {
|
|
370
|
-
unsupportedTransactions,
|
|
371
|
-
},
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
const calculateTotal = ({ protocol, gas }) => protocol.plus(gas);
|
|
375
|
-
const noThirdPartyAllowance = [];
|
|
376
|
-
const noThirdPartyBalance = [];
|
|
377
|
-
thirdPartyFees.forEach(data => {
|
|
378
|
-
const { allowance, balance, fees } = data;
|
|
379
|
-
const total = calculateTotal(fees);
|
|
380
|
-
if (balance.lt(total)) {
|
|
381
|
-
noThirdPartyBalance.push(data);
|
|
382
|
-
}
|
|
383
|
-
if (allowance === null || allowance === void 0 ? void 0 : allowance.lt(total)) {
|
|
384
|
-
noThirdPartyAllowance.push(data);
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
if (noThirdPartyAllowance.length) {
|
|
388
|
-
throw new internal_1.PolymeshError({
|
|
389
|
-
code: types_1.ErrorCode.InsufficientBalance,
|
|
390
|
-
message: "Not enough POLYX third party allowance to pay for this procedure's fees",
|
|
391
|
-
data: {
|
|
392
|
-
thirdPartyFees: noThirdPartyAllowance,
|
|
393
|
-
},
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
if (noThirdPartyBalance.length) {
|
|
397
|
-
throw new internal_1.PolymeshError({
|
|
398
|
-
code: types_1.ErrorCode.InsufficientBalance,
|
|
399
|
-
message: "Not enough POLYX third party balance to pay for this procedure's fees",
|
|
400
|
-
data: {
|
|
401
|
-
thirdPartyFees: noThirdPartyBalance,
|
|
402
|
-
},
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
const totalFees = calculateTotal(accountFees);
|
|
406
|
-
if (accountBalance.lt(totalFees)) {
|
|
407
|
-
throw new internal_1.PolymeshError({
|
|
408
|
-
code: types_1.ErrorCode.InsufficientBalance,
|
|
409
|
-
message: "Not enough POLYX balance to pay for this procedure's fees",
|
|
410
|
-
data: {
|
|
411
|
-
balance: accountBalance,
|
|
412
|
-
fees: accountFees,
|
|
413
|
-
},
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
exports.TransactionQueue = TransactionQueue;
|
|
420
|
-
//# sourceMappingURL=TransactionQueue.js.map
|