@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeManualInstruction.js","sourceRoot":"","sources":["../../../src/api/procedures/executeManualInstruction.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"executeManualInstruction.js","sourceRoot":"","sources":["../../../src/api/procedures/executeManualInstruction.ts"],"names":[],"mappings":";;;;;;;;;;;;AAwCA,0EA6EC;AAKD,4CAcC;AAKD,wCA6EC;AAxND,kDAAkF;AAClF,yCAA4E;AAC5E,mCAMiB;AAEjB,yCAAsC;AACtC,mCAAgE;AAChE,mDAM4B;AAiB5B;;GAEG;AACH,SAAsB,+BAA+B,CAEnD,IAAY;;;QAIZ,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,EAChC,KAAK,EAAE,EAAE,UAAU,EAAE,EACrB,IAAI,EAAE,EAAE,aAAa,EAAE,GACxB,GACF,EACD,OAAO,EACP,OAAO,EAAE,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,GAC/F,GAAG,IAAI,CAAC;QAET,MAAM,EAAE,EAAE,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC;QAE1C,MAAM,WAAW,GAAG,IAAI,sBAAW,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAErD,MAAM,IAAA,gDAAwC,EAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAE5E,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,MAAM,CAAA,MAAA,kBAAkB,CAAC,KAAK,0CAAE,OAAO,EAAE,CAAA,CAAC;YAE1D,IACE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,GAAG,MAAK,SAAS;gBAChC,CAAC,eAAe,CAAC,GA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oBACxC,uBAAuB,CAAC,aAAa,CAAC;iBACvC,CAAC,CAAC;gBAEH,IAAI,aAAa,EAAE,CAAC;oBAClB,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC1C,CAAC;gBAED,IAAI,WAAW,EAAE,CAAC;oBAChB,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC;YAED,OAAO,IAAA,aAAK,EAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;QAClD,CAAC,CAAA,EAAE,OAAO,CAAC,OAAO,CAAC,IAAA,aAAK,EAAC,EAAE,EAAE,IAAI,GAAG,EAAU,CAAC,CAAC,CAAC,CAAC;QAElD,OAAO;YACL,mBAAmB,EAAE,cAAc;YACnC,kBAAkB,EAAE,OAAO;YAC3B,SAAS,EAAE,GAAG;YACd,eAAe;YACf,YAAY;SACb,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACI,MAAM,wBAAwB,GAAG,GAA4C,EAAE,CACpF,IAAI,oBAAS,CAAC,+BAA+B,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AADtE,QAAA,wBAAwB,4BAC8C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initiateCorporateAction.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/initiateCorporateAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"initiateCorporateAction.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/initiateCorporateAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,aAAa,EAEb,SAAS,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAa,6BAA6B,EAAU,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAc5F;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,6BAA6B,GAAG;IACnD,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,GACzC,OAAO,aAAa,EAAE,SAAS,OAAO,MAChC,SAAS,kBAAkB,KAAG,OAAO,CAAC,eAAe,CAyB3D,CAAC;AAEJ;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,UAAU,GAAG,kBAAkB,GAAG,IAAI,GACjD,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,eAAe,CAAC,EACxC,IAAI,EAAE,MAAM,GACX,OAAO,CACR,eAAe,CAAC,eAAe,EAAE,eAAe,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,CAAC,CAChG,CAoFA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,eAAe,CAAC,EACxC,EAAE,KAAK,EAAE,EAAE,MAAM,GAChB,sBAAsB,CAQxB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,SAAS,CAAC,MAAM,EAAE,eAAe,CACX,CAAC"}
|
|
@@ -13,6 +13,7 @@ exports.initiateCorporateAction = exports.initiateCorporateActionResolver = void
|
|
|
13
13
|
exports.assertCheckpointValue = assertCheckpointValue;
|
|
14
14
|
exports.prepareInitiateCorporateAction = prepareInitiateCorporateAction;
|
|
15
15
|
exports.getAuthorization = getAuthorization;
|
|
16
|
+
const utils_1 = require("../../api/procedures/utils");
|
|
16
17
|
const internal_1 = require("../../internal");
|
|
17
18
|
const types_1 = require("../../types");
|
|
18
19
|
const conversion_1 = require("../../utils/conversion");
|
|
@@ -74,12 +75,15 @@ function prepareInitiateCorporateAction(args) {
|
|
|
74
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
76
|
const { context: { polymeshApi: { tx: { corporateAction }, query, }, }, context, } = this;
|
|
76
77
|
const { asset, kind, description, targets, declarationDate, checkpoint, taxWithholdings, defaultTaxWithholding, } = args;
|
|
78
|
+
// Validate declarationDate is in the past
|
|
77
79
|
(0, internal_2.assertDeclarationDate)(declarationDate);
|
|
80
|
+
// Validate checkpoint/recordDate
|
|
78
81
|
let checkpointValue = null;
|
|
79
82
|
if (checkpoint) {
|
|
80
83
|
checkpointValue = yield (0, internal_2.getCheckpointValue)(checkpoint, asset, context);
|
|
81
84
|
yield assertCheckpointValue(checkpointValue);
|
|
82
85
|
}
|
|
86
|
+
// Validate details length (max_details_length)
|
|
83
87
|
const rawMaxDetailsLength = yield query.corporateAction.maxDetailsLength();
|
|
84
88
|
const maxDetailsLength = (0, conversion_1.u32ToBigNumber)(rawMaxDetailsLength);
|
|
85
89
|
// ensure the corporate action details are short enough
|
|
@@ -92,6 +96,12 @@ function prepareInitiateCorporateAction(args) {
|
|
|
92
96
|
},
|
|
93
97
|
});
|
|
94
98
|
}
|
|
99
|
+
// Validate targets limit (handled in targetsToTargetIdentities conversion)
|
|
100
|
+
// Validate withholding_tax: check limit and detect duplicates (chain throws error on duplicates)
|
|
101
|
+
if (taxWithholdings && taxWithholdings.length > 0) {
|
|
102
|
+
// Check limit and detect duplicates (assertCaTaxWithholdingsValid handles both)
|
|
103
|
+
(0, utils_1.assertCaTaxWithholdingsValid)(taxWithholdings, context);
|
|
104
|
+
}
|
|
95
105
|
const rawArgs = (0, conversion_1.corporateActionParamsToMeshCorporateActionArgs)({
|
|
96
106
|
asset,
|
|
97
107
|
kind,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initiateCorporateAction.js","sourceRoot":"","sources":["../../../src/api/procedures/initiateCorporateAction.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"initiateCorporateAction.js","sourceR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;AACH,SAAgB,gBAAgB,CAE9B,EAAE,KAAK,EAAU;IAEjB,OAAO;QACL,WAAW,EAAE;YACX,YAAY,EAAE,CAAC,cAAM,CAAC,eAAe,CAAC,uBAAuB,CAAC;YAC9D,MAAM,EAAE,CAAC,KAAK,CAAC;YACf,UAAU,EAAE,EAAE;SACf;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,MAAM,uBAAuB,GAAG,GAAuC,EAAE,CAC9E,IAAI,oBAAS,CAAC,8BAA8B,EAAE,gBAAgB,CAAC,CAAC;AADrD,QAAA,uBAAuB,2BAC8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issueNft.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/issueNft.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"issueNft.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/issueNft.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAA4B,gBAAgB,EAAU,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAShF,MAAM,MAAM,MAAM,GAAG;IACnB,YAAY,EAAE,gBAAgB,EAAE,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,aAAa,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC5B,SAAS,OAAO,MAChB,SAAS,kBAAkB,KAAG,GAAG,EAejC,CAAC;AAsCJ;;GAEG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAC9B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,oBAAoB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAmCnD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAC9B,EAAE,UAAU,EAAE,EAAE,MAAM,GACrB,sBAAsB,CAQxB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAO,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,CACD,CAAC"}
|
|
@@ -21,7 +21,14 @@ const internal_2 = require("../../utils/internal");
|
|
|
21
21
|
* @hidden
|
|
22
22
|
*/
|
|
23
23
|
const issuedNftsResolver = (context) => (receipt) => {
|
|
24
|
-
|
|
24
|
+
let records;
|
|
25
|
+
if (context.isV7) {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
records = (0, internal_2.filterEventRecords)(receipt, 'nft', 'NFTPortfolioUpdated');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
records = (0, internal_2.filterEventRecords)(receipt, 'nft', 'NFTHoldingsUpdated');
|
|
31
|
+
}
|
|
25
32
|
return records.map(({ data }) => {
|
|
26
33
|
const { assetId, ids } = (0, conversion_1.meshNftToNftId)(data[1]);
|
|
27
34
|
const id = ids[0];
|
|
@@ -70,10 +77,10 @@ function prepareIssueNft(args) {
|
|
|
70
77
|
? yield signingIdentity.portfolios.getPortfolio({ portfolioId })
|
|
71
78
|
: yield signingIdentity.portfolios.getPortfolio();
|
|
72
79
|
const rawAssetId = (0, conversion_1.assetToMeshAssetId)(collection, context);
|
|
73
|
-
const
|
|
80
|
+
const rawAssetHolder = (0, conversion_1.assetHolderToAssetHolderKind)(portfolio, context);
|
|
74
81
|
const transactions = rawMetadataValues.map(metadata => (0, internal_2.checkTxType)({
|
|
75
82
|
transaction: tx.nft.issueNft,
|
|
76
|
-
args: [rawAssetId, metadata,
|
|
83
|
+
args: [rawAssetId, metadata, rawAssetHolder],
|
|
77
84
|
}));
|
|
78
85
|
return {
|
|
79
86
|
transactions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issueNft.js","sourceRoot":"","sources":["../../../src/api/procedures/issueNft.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"issueNft.js","sourceRoot":"","sources":["../../../src/api/procedures/issueNft.ts"],"names":[],"mappings":";;;;;;;;;;;;AAmFA,0CAsCC;AAKD,4CAWC;AArID,8DAA2D;AAC3D,yCAA8E;AAC9E,mCAA6E;AAE7E,mDAK4B;AAC5B,+CAAmE;AAQnE;;GAEG;AACI,MAAM,kBAAkB,GAC7B,CAAC,OAAgB,EAAE,EAAE,CACrB,CAAC,OAA2B,EAAS,EAAE;IACrC,IAAI,OAAO,CAAC;IACZ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,8DAA8D;QAC9D,OAAO,GAAG,IAAA,6BAAkB,EAAC,OAAO,EAAE,KAAY,EAAE,qBAAqB,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,IAAA,6BAAkB,EAAC,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9B,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAA,2BAAc,EAAC,IAAI,CAAC,CAAC,CAA8B,CAAC,CAAC;QAC9E,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAE,CAAC;QAEnB,OAAO,IAAI,SAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAjBS,QAAA,kBAAkB,sBAiB3B;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YACpB,UAAU,EAAE,EAAE;SACf;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,MAAM,QAAQ,GAAG,GAA6B,EAAE,CACrD,IAAI,oBAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AADtC,QAAA,QAAQ,YAC8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issueTokens.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/issueTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAa,iBAAiB,EAAU,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"issueTokens.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/issueTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAa,iBAAiB,EAAU,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAS5F,MAAM,MAAM,MAAM,GAAG,iBAAiB,GAAG;IACvC,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,EACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,aAAa,EAAE,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CA4D5E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,EACtC,EAAE,KAAK,EAAE,EAAE,MAAM,GAChB,sBAAsB,CAQxB;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,QAAO,SAAS,CAAC,MAAM,EAAE,aAAa,CACT,CAAC"}
|
|
@@ -16,13 +16,26 @@ const internal_1 = require("../../internal");
|
|
|
16
16
|
const types_1 = require("../../types");
|
|
17
17
|
const constants_1 = require("../../utils/constants");
|
|
18
18
|
const conversion_1 = require("../../utils/conversion");
|
|
19
|
+
const internal_2 = require("../../utils/internal");
|
|
19
20
|
/**
|
|
20
21
|
* @hidden
|
|
21
22
|
*/
|
|
22
23
|
function prepareIssueTokens(args) {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
25
|
const { context: { polymeshApi: { tx: { asset }, }, }, context, } = this;
|
|
25
|
-
const { asset: assetEntity, amount, portfolioId } = args;
|
|
26
|
+
const { asset: assetEntity, amount, portfolioId, account } = args;
|
|
27
|
+
if (portfolioId && account) {
|
|
28
|
+
throw new internal_1.PolymeshError({
|
|
29
|
+
code: types_1.ErrorCode.ValidationError,
|
|
30
|
+
message: 'Only one of portfolioId or account can be provided to issue tokens',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (account && context.getSigningAccount().address !== account) {
|
|
34
|
+
throw new internal_1.PolymeshError({
|
|
35
|
+
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
36
|
+
message: 'Account should be same as the signing account',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
26
39
|
const [{ isDivisible, totalSupply }, signingIdentity] = yield Promise.all([
|
|
27
40
|
assetEntity.details(),
|
|
28
41
|
context.getSigningIdentity(),
|
|
@@ -38,15 +51,21 @@ function prepareIssueTokens(args) {
|
|
|
38
51
|
},
|
|
39
52
|
});
|
|
40
53
|
}
|
|
41
|
-
const portfolio = portfolioId
|
|
42
|
-
? yield signingIdentity.portfolios.getPortfolio({ portfolioId })
|
|
43
|
-
: yield signingIdentity.portfolios.getPortfolio();
|
|
44
54
|
const rawAssetId = (0, conversion_1.assetToMeshAssetId)(assetEntity, context);
|
|
45
55
|
const rawValue = (0, conversion_1.bigNumberToBalance)(amount, context, isDivisible);
|
|
46
|
-
|
|
56
|
+
let rawAssetHolder;
|
|
57
|
+
if (account) {
|
|
58
|
+
rawAssetHolder = (0, conversion_1.assetHolderToAssetHolderKind)((0, internal_2.asAccount)(account, context), context);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const portfolio = portfolioId
|
|
62
|
+
? yield signingIdentity.portfolios.getPortfolio({ portfolioId })
|
|
63
|
+
: yield signingIdentity.portfolios.getPortfolio();
|
|
64
|
+
rawAssetHolder = (0, conversion_1.assetHolderToAssetHolderKind)(portfolio, context);
|
|
65
|
+
}
|
|
47
66
|
return {
|
|
48
67
|
transaction: asset.issue,
|
|
49
|
-
args: [rawAssetId, rawValue,
|
|
68
|
+
args: [rawAssetId, rawValue, rawAssetHolder],
|
|
50
69
|
resolver: assetEntity,
|
|
51
70
|
};
|
|
52
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issueTokens.js","sourceRoot":"","sources":["../../../src/api/procedures/issueTokens.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"issueTokens.js","sourceRoot":"","sources":["../../../src/api/procedures/issueTokens.ts"],"names":[],"mappings":";;;;;;;;;;;;AAkBA,gDA+DC;AAKD,4CAWC;AAjGD,yCAAqE;AACrE,mCAA+D;AAE/D,iDAAgD;AAChD,mDAI4B;AAC5B,+CAA6C;AAM7C;;GAEG;AACH,SAAsB,kBAAkB,CAEtC,IAAY;;QAEZ,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,EAAE,EAAE,EAAE,KAAK,EAAE,GACd,GACF,EACD,OAAO,GACR,GAAG,IAAI,CAAC;QACT,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAElE,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,IAAI,wBAAa,CAAC;gBACt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3B,CAAC,CAAC,MAAM,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;gBAChE,CAAC,CAAC,MAAM,eAAe,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;YACpD,cAAc,GAAG,IAAA,yCAA4B,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC;QAED,OAAO;YACL,WAAW,EAAE,KAAK,CAAC,KAAK;YACxB,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,cAAc,CAAC;YAC5C,QAAQ,EAAE,WAAW;SACtB,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAE9B,EAAE,KAAK,EAAU;IAEjB,OAAO;QACL,WAAW,EAAE;YACX,YAAY,EAAE,CAAC,cAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAClC,MAAM,EAAE,CAAC,KAAK,CAAC;YACf,UAAU,EAAE,EAAE;SACf;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,MAAM,WAAW,GAAG,GAAqC,EAAE,CAChE,IAAI,oBAAS,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AADzC,QAAA,WAAW,eAC8B"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ExecuteInstructionInfo } from '@polymeshassociation/polymesh-types/polkadot/polymesh';
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
3
|
import { Identity, Instruction, Procedure } from '../../internal';
|
|
4
|
-
import {
|
|
4
|
+
import { AssetHolder, AssetHolderId, AssetHolderLike, ModifyInstructionAffirmationParams } from '../../types';
|
|
5
5
|
import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from '../../types/internal';
|
|
6
6
|
export interface Storage {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
allowedAssetHolders: AssetHolder[];
|
|
8
|
+
assetHolderParams: AssetHolderLike[];
|
|
9
|
+
senderLegCount: BigNumber;
|
|
10
|
+
totalLegCount: BigNumber;
|
|
11
11
|
signer: Identity;
|
|
12
12
|
offChainLegIndices: number[];
|
|
13
13
|
instructionInfo: ExecuteInstructionInfo;
|
|
@@ -23,7 +23,7 @@ export declare function getAuthorization(this: Procedure<ModifyInstructionAffirm
|
|
|
23
23
|
/**
|
|
24
24
|
* @hidden
|
|
25
25
|
*/
|
|
26
|
-
export declare const isParam: (
|
|
26
|
+
export declare const isParam: (legAssetHolder: AssetHolder, assetHolderIdParams: AssetHolderId[]) => boolean;
|
|
27
27
|
/**
|
|
28
28
|
* @hidden
|
|
29
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modifyInstructionAffirmation.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/modifyInstructionAffirmation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modifyInstructionAffirmation.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/modifyInstructionAffirmation.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,sBAAsB,EAEvB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,SAAS,MAAM,cAAc,CAAC;AAIrC,OAAO,EAAoB,QAAQ,EAAE,WAAW,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,EAGL,WAAW,EACX,aAAa,EACb,eAAe,EAIf,kCAAkC,EAMnC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,eAAe,EAEf,sBAAsB,EACtB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAmC1B,MAAM,WAAW,OAAO;IACtB,mBAAmB,EAAE,WAAW,EAAE,CAAC;IACnC,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,cAAc,EAAE,SAAS,CAAC;IAC1B,aAAa,EAAE,SAAS,CAAC;IACzB,MAAM,EAAE,QAAQ,CAAC;IACjB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,eAAe,EAAE,sBAAsB,CAAC;CACzC;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@@ exports.prepareModifyInstructionAffirmation = prepareModifyInstructionAffirmatio
|
|
|
28
28
|
exports.getAuthorization = getAuthorization;
|
|
29
29
|
exports.prepareStorage = prepareStorage;
|
|
30
30
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
31
|
+
const helpers_1 = require("../../api/entities/Account/helpers");
|
|
31
32
|
const utils_1 = require("../../api/procedures/utils");
|
|
32
33
|
const internal_1 = require("../../internal");
|
|
33
34
|
const types_1 = require("../../types");
|
|
@@ -45,22 +46,23 @@ const getAssetCount = (context, instructionInfo) => {
|
|
|
45
46
|
/**
|
|
46
47
|
* @hidden
|
|
47
48
|
*/
|
|
48
|
-
const
|
|
49
|
+
const assertAssetHoldersAreValid = (assetHolderLikeParams, assetHolders, operation) => {
|
|
49
50
|
if (operation === types_1.InstructionAffirmationOperation.AffirmAsMediator ||
|
|
50
51
|
operation === types_1.InstructionAffirmationOperation.RejectAsMediator ||
|
|
51
52
|
operation === types_1.InstructionAffirmationOperation.WithdrawAsMediator) {
|
|
53
|
+
// since no asset holders are involved in these operations, consider them as valid
|
|
52
54
|
return;
|
|
53
55
|
}
|
|
54
|
-
if (
|
|
56
|
+
if (assetHolderLikeParams.length && assetHolderLikeParams.length !== assetHolders.length) {
|
|
55
57
|
throw new internal_1.PolymeshError({
|
|
56
58
|
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
57
|
-
message: 'Some of the
|
|
59
|
+
message: 'Some of the asset holders are not a involved in this instruction',
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
|
-
if (!
|
|
62
|
+
if (!assetHolders.length) {
|
|
61
63
|
throw new internal_1.PolymeshError({
|
|
62
64
|
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
63
|
-
message: 'The
|
|
65
|
+
message: 'The signer is not involved in this Instruction',
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
68
|
};
|
|
@@ -164,7 +166,7 @@ function validateMediatorStatusForAffirmation(mediatorStatus, signer, id) {
|
|
|
164
166
|
/**
|
|
165
167
|
* @hidden
|
|
166
168
|
*/
|
|
167
|
-
function
|
|
169
|
+
function validateMediatorStatusForWithdrawal(mediatorStatus, signer, id) {
|
|
168
170
|
if (mediatorStatus !== types_1.AffirmationStatus.Affirmed) {
|
|
169
171
|
throw new internal_1.PolymeshError({
|
|
170
172
|
code: types_1.ErrorCode.ValidationError,
|
|
@@ -216,14 +218,15 @@ function rejectAsMediator(mediatorStatus, signer, context, instruction, instruct
|
|
|
216
218
|
/**
|
|
217
219
|
* @hidden
|
|
218
220
|
*/
|
|
219
|
-
function reject(context, instructionInfo, instruction,
|
|
221
|
+
function reject(context, instructionInfo, instruction, totalLegCount, rawAllowedAssetHolders) {
|
|
220
222
|
const rawInstructionId = (0, conversion_1.bigNumberToU64)(instruction.id, context);
|
|
221
223
|
const rawAssetCount = getAssetCount(context, instructionInfo);
|
|
222
224
|
return {
|
|
223
225
|
transaction: context.polymeshApi.tx.settlement.rejectInstructionWithCount,
|
|
224
226
|
resolver: instruction,
|
|
225
|
-
feeMultiplier:
|
|
226
|
-
|
|
227
|
+
feeMultiplier: totalLegCount,
|
|
228
|
+
// since only one asset holder is allowed while rejecting, it is safe to assume 0th index
|
|
229
|
+
args: [rawInstructionId, rawAllowedAssetHolders[0], rawAssetCount],
|
|
227
230
|
};
|
|
228
231
|
}
|
|
229
232
|
/**
|
|
@@ -250,19 +253,19 @@ function validateInstructionNotLocked(instruction) {
|
|
|
250
253
|
*/
|
|
251
254
|
function prepareModifyInstructionAffirmation(args) {
|
|
252
255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
-
const { context: { polymeshApi: { tx: { settlement: settlementTx }, query: { settlement }, call, }, }, context, storage: {
|
|
256
|
+
const { context: { polymeshApi: { tx: { settlement: settlementTx }, query: { settlement }, call, }, }, context, storage: { allowedAssetHolders, assetHolderParams, senderLegCount, totalLegCount, signer, instructionInfo, offChainLegIndices, }, } = this;
|
|
254
257
|
const { operation, id } = args, rest = __rest(args, ["operation", "id"]);
|
|
255
258
|
const instruction = new internal_1.Instruction({ id }, context);
|
|
256
|
-
yield
|
|
259
|
+
yield (0, utils_1.assertInstructionValid)(instruction, context);
|
|
257
260
|
if (!('receipts' in args)) {
|
|
258
|
-
|
|
261
|
+
assertAssetHoldersAreValid(assetHolderParams, allowedAssetHolders, operation);
|
|
259
262
|
}
|
|
260
263
|
const rawInstructionId = (0, conversion_1.bigNumberToU64)(id, context);
|
|
261
|
-
const
|
|
264
|
+
const rawAllowedAssetHolders = yield Promise.all(allowedAssetHolders.map((assetHolder) => __awaiter(this, void 0, void 0, function* () { return yield (0, conversion_1.assetHolderIdToMeshAssetHolder)((0, conversion_1.assetHolderLikeToAssetHolderId)(assetHolder), context); })));
|
|
262
265
|
const rawDid = (0, conversion_1.stringToIdentityId)(signer.did, context);
|
|
263
|
-
const multiArgs =
|
|
266
|
+
const multiArgs = rawAllowedAssetHolders.map(rawAssetHolder => (0, utils_2.tuple)(rawInstructionId, rawAssetHolder));
|
|
264
267
|
const [rawAffirmationStatuses, rawMediatorAffirmation] = yield Promise.all([
|
|
265
|
-
settlement.
|
|
268
|
+
settlement.affirmsReceived.multi(multiArgs),
|
|
266
269
|
settlement.instructionMediatorsAffirmations(rawInstructionId, rawDid),
|
|
267
270
|
]);
|
|
268
271
|
const affirmationStatuses = rawAffirmationStatuses.map(conversion_1.meshAffirmationStatusToAffirmationStatus);
|
|
@@ -276,8 +279,15 @@ function prepareModifyInstructionAffirmation(args) {
|
|
|
276
279
|
return affirmAsMediator(mediatorStatus, signer, context, instruction, args.expiry);
|
|
277
280
|
}
|
|
278
281
|
case types_1.InstructionAffirmationOperation.WithdrawAsMediator: {
|
|
279
|
-
|
|
282
|
+
if (!context.isV7) {
|
|
283
|
+
throw new internal_1.PolymeshError({
|
|
284
|
+
code: types_1.ErrorCode.NotSupported,
|
|
285
|
+
message: 'Withdrawal of affirmed instructions has been discontinued from v8 chain',
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
validateMediatorStatusForWithdrawal(mediatorStatus, signer, id);
|
|
280
289
|
return {
|
|
290
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
281
291
|
transaction: settlementTx.withdrawAffirmationAsMediator,
|
|
282
292
|
resolver: instruction,
|
|
283
293
|
args: [rawInstructionId],
|
|
@@ -288,7 +298,7 @@ function prepareModifyInstructionAffirmation(args) {
|
|
|
288
298
|
}
|
|
289
299
|
case types_1.InstructionAffirmationOperation.Reject: {
|
|
290
300
|
yield validateInstructionNotLocked(instruction);
|
|
291
|
-
return reject(context, instructionInfo, instruction,
|
|
301
|
+
return reject(context, instructionInfo, instruction, totalLegCount, rawAllowedAssetHolders);
|
|
292
302
|
}
|
|
293
303
|
case types_1.InstructionAffirmationOperation.Affirm: {
|
|
294
304
|
excludeCriteria.push(types_1.AffirmationStatus.Affirmed);
|
|
@@ -304,22 +314,29 @@ function prepareModifyInstructionAffirmation(args) {
|
|
|
304
314
|
break;
|
|
305
315
|
}
|
|
306
316
|
case types_1.InstructionAffirmationOperation.Withdraw: {
|
|
317
|
+
if (!context.isV7) {
|
|
318
|
+
throw new internal_1.PolymeshError({
|
|
319
|
+
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
320
|
+
message: 'Withdrawal of affirmed instructions has been discontinued from v8 chain',
|
|
321
|
+
});
|
|
322
|
+
}
|
|
307
323
|
yield validateInstructionNotLocked(instruction);
|
|
308
324
|
excludeCriteria.push(types_1.AffirmationStatus.Pending);
|
|
309
325
|
errorMessage = 'The instruction is not affirmed';
|
|
326
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
310
327
|
transaction = settlementTx.withdrawAffirmationWithCount;
|
|
311
328
|
break;
|
|
312
329
|
}
|
|
313
330
|
}
|
|
314
|
-
const
|
|
315
|
-
if (!
|
|
331
|
+
const validAssetHolders = rawAllowedAssetHolders.filter((_, index) => !excludeCriteria.includes(affirmationStatuses[index]));
|
|
332
|
+
if (!validAssetHolders.length && !rawReceiptDetails) {
|
|
316
333
|
throw new internal_1.PolymeshError({
|
|
317
334
|
code: types_1.ErrorCode.NoDataChange,
|
|
318
335
|
message: errorMessage,
|
|
319
336
|
});
|
|
320
337
|
}
|
|
321
|
-
const rawAffirmCount = yield call.settlementApi.getAffirmationCount(rawInstructionId,
|
|
322
|
-
const portfolioIds = (0, conversion_1.
|
|
338
|
+
const rawAffirmCount = yield call.settlementApi.getAffirmationCount(rawInstructionId, validAssetHolders);
|
|
339
|
+
const portfolioIds = (0, conversion_1.assetHolderIdsToBtreeSet)(validAssetHolders, context);
|
|
323
340
|
if (transaction === settlementTx.affirmWithReceiptsWithCount) {
|
|
324
341
|
return {
|
|
325
342
|
transaction,
|
|
@@ -328,9 +345,10 @@ function prepareModifyInstructionAffirmation(args) {
|
|
|
328
345
|
};
|
|
329
346
|
}
|
|
330
347
|
return {
|
|
331
|
-
|
|
348
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
349
|
+
transaction: transaction,
|
|
332
350
|
resolver: instruction,
|
|
333
|
-
feeMultiplier:
|
|
351
|
+
feeMultiplier: senderLegCount,
|
|
334
352
|
args: [rawInstructionId, portfolioIds, rawAffirmCount],
|
|
335
353
|
};
|
|
336
354
|
});
|
|
@@ -339,7 +357,7 @@ function prepareModifyInstructionAffirmation(args) {
|
|
|
339
357
|
* @hidden
|
|
340
358
|
*/
|
|
341
359
|
function getAuthorization(args) {
|
|
342
|
-
const { storage: {
|
|
360
|
+
const { storage: { allowedAssetHolders: assetHolders }, } = this;
|
|
343
361
|
let transactions;
|
|
344
362
|
const { operation } = args;
|
|
345
363
|
switch (operation) {
|
|
@@ -376,7 +394,7 @@ function getAuthorization(args) {
|
|
|
376
394
|
}
|
|
377
395
|
return {
|
|
378
396
|
permissions: {
|
|
379
|
-
portfolios,
|
|
397
|
+
portfolios: assetHolders.filter(utils_3.isPortfolioAssetHolder),
|
|
380
398
|
transactions,
|
|
381
399
|
assets: [],
|
|
382
400
|
},
|
|
@@ -385,65 +403,87 @@ function getAuthorization(args) {
|
|
|
385
403
|
/**
|
|
386
404
|
* @hidden
|
|
387
405
|
*/
|
|
388
|
-
function
|
|
406
|
+
function extractAssetHolderParams(params) {
|
|
389
407
|
const { operation } = params;
|
|
390
|
-
let
|
|
408
|
+
let assetHolderParams = [];
|
|
391
409
|
if (operation === types_1.InstructionAffirmationOperation.Reject) {
|
|
392
|
-
const { portfolio } = params;
|
|
410
|
+
const { assetHolder: portfolio } = params;
|
|
393
411
|
if (portfolio) {
|
|
394
|
-
|
|
412
|
+
assetHolderParams.push(portfolio);
|
|
395
413
|
}
|
|
396
414
|
}
|
|
397
415
|
else if (operation === types_1.InstructionAffirmationOperation.Affirm ||
|
|
398
416
|
operation === types_1.InstructionAffirmationOperation.Withdraw) {
|
|
399
|
-
const {
|
|
400
|
-
if (
|
|
401
|
-
|
|
417
|
+
const { holders } = params;
|
|
418
|
+
if (holders) {
|
|
419
|
+
assetHolderParams = [...assetHolderParams, ...holders];
|
|
402
420
|
}
|
|
403
421
|
}
|
|
404
|
-
return
|
|
422
|
+
return assetHolderParams;
|
|
405
423
|
}
|
|
406
424
|
/**
|
|
407
425
|
* @hidden
|
|
408
426
|
*/
|
|
409
|
-
const isParam = (
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
427
|
+
const isParam = (legAssetHolder, assetHolderIdParams) => {
|
|
428
|
+
if (!assetHolderIdParams.length) {
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
const areAssetHolderIdsEqual = (holder1, holder2) => {
|
|
432
|
+
var _a, _b;
|
|
433
|
+
if (typeof holder1 === 'string' && typeof holder2 === 'string') {
|
|
434
|
+
return holder1 === holder2;
|
|
435
|
+
}
|
|
436
|
+
if (typeof holder1 !== 'string' && typeof holder2 !== 'string') {
|
|
437
|
+
return (holder1.did === holder2.did &&
|
|
438
|
+
((_a = holder1.number) !== null && _a !== void 0 ? _a : new bignumber_js_1.default(0)).eq((_b = holder2.number) !== null && _b !== void 0 ? _b : new bignumber_js_1.default(0)));
|
|
439
|
+
}
|
|
440
|
+
return false;
|
|
441
|
+
};
|
|
442
|
+
const legAssetHolderId = (0, conversion_1.assetHolderLikeToAssetHolderId)(legAssetHolder);
|
|
443
|
+
return assetHolderIdParams.some(assetHolderId => areAssetHolderIdsEqual(legAssetHolderId, assetHolderId));
|
|
414
444
|
};
|
|
415
445
|
exports.isParam = isParam;
|
|
416
446
|
/**
|
|
417
447
|
* @hidden
|
|
418
448
|
*/
|
|
419
|
-
const
|
|
449
|
+
const assembleAssetHolders = (result, from, to, signer, assetHolderIdParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
420
450
|
const [fromExists, toExists] = yield Promise.all([from.exists(), to.exists()]);
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (isCustodied) {
|
|
428
|
-
res = [...res, legPortfolio];
|
|
451
|
+
const checkCustody = (legAssetHolder, exists, sender) => __awaiter(void 0, void 0, void 0, function* () {
|
|
452
|
+
let localAllowedAssetHolders = [];
|
|
453
|
+
let localSenderLegCount = new bignumber_js_1.default(0);
|
|
454
|
+
if (legAssetHolder instanceof internal_1.Account) {
|
|
455
|
+
if (legAssetHolder.address === signer.address) {
|
|
456
|
+
localAllowedAssetHolders = [legAssetHolder];
|
|
429
457
|
if (sender) {
|
|
430
|
-
|
|
458
|
+
localSenderLegCount = new bignumber_js_1.default(1);
|
|
431
459
|
}
|
|
432
460
|
}
|
|
433
461
|
}
|
|
434
|
-
else if (
|
|
435
|
-
|
|
462
|
+
else if (exists) {
|
|
463
|
+
const isCustodied = yield legAssetHolder.isCustodiedBy({ identity: signer.did });
|
|
464
|
+
const missingPerms = (0, helpers_1.getMissingPortfolioPermissions)([legAssetHolder], signer.portfolioPermissions);
|
|
465
|
+
if (isCustodied && missingPerms === undefined) {
|
|
466
|
+
localAllowedAssetHolders = [legAssetHolder];
|
|
467
|
+
if (sender) {
|
|
468
|
+
localSenderLegCount = new bignumber_js_1.default(1);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
436
471
|
}
|
|
472
|
+
return [localAllowedAssetHolders, localSenderLegCount];
|
|
437
473
|
});
|
|
438
474
|
const promises = [];
|
|
439
|
-
if ((0, exports.isParam)(from,
|
|
475
|
+
if ((0, exports.isParam)(from, assetHolderIdParams)) {
|
|
440
476
|
promises.push(checkCustody(from, fromExists, true));
|
|
441
477
|
}
|
|
442
|
-
if ((0, exports.isParam)(to,
|
|
478
|
+
if ((0, exports.isParam)(to, assetHolderIdParams)) {
|
|
443
479
|
promises.push(checkCustody(to, toExists, false));
|
|
444
480
|
}
|
|
445
|
-
yield Promise.all(promises);
|
|
446
|
-
|
|
481
|
+
const results = yield Promise.all(promises);
|
|
482
|
+
const [finalAssetHolders, finalSenderLegCount] = results.reduce(([accAssetHolders, accCount], [currAssetHolders, currCount]) => [
|
|
483
|
+
[...accAssetHolders, ...currAssetHolders],
|
|
484
|
+
accCount.plus(currCount),
|
|
485
|
+
], result);
|
|
486
|
+
return (0, utils_2.tuple)(finalAssetHolders, finalSenderLegCount);
|
|
447
487
|
});
|
|
448
488
|
/**
|
|
449
489
|
* @hidden
|
|
@@ -453,39 +493,44 @@ function prepareStorage(params) {
|
|
|
453
493
|
const { context, context: { polymeshApi: { call: { settlementApi }, }, }, } = this;
|
|
454
494
|
const { id } = params;
|
|
455
495
|
const rawId = (0, conversion_1.bigNumberToU64)(id, context);
|
|
456
|
-
const
|
|
457
|
-
const
|
|
496
|
+
const assetHolderParams = extractAssetHolderParams(params);
|
|
497
|
+
const assetHolderIdParams = assetHolderParams.map(conversion_1.assetHolderLikeToAssetHolderId);
|
|
458
498
|
const instruction = new internal_1.Instruction({ id }, context);
|
|
459
|
-
const [{ data: legs }, signer, executeInstructionInfo] = yield Promise.all([
|
|
499
|
+
const [{ data: legs }, signer, executeInstructionInfo, { portfolios: signerPortfolioPermissions },] = yield Promise.all([
|
|
460
500
|
instruction.getLegsFromChain(),
|
|
461
501
|
context.getSigningIdentity(),
|
|
462
502
|
settlementApi.getExecuteInstructionInfo(rawId),
|
|
503
|
+
context.getSigningAccount().getPermissions(),
|
|
463
504
|
]);
|
|
464
505
|
const legContributions = yield Promise.all(legs.map((leg, index) => __awaiter(this, void 0, void 0, function* () {
|
|
465
506
|
if ((0, utils_3.isOffChainLeg)(leg)) {
|
|
466
507
|
return {
|
|
467
|
-
|
|
468
|
-
|
|
508
|
+
allowedAssetHolders: [],
|
|
509
|
+
senderLegCount: new bignumber_js_1.default(0),
|
|
469
510
|
offChainIndex: index,
|
|
470
511
|
};
|
|
471
512
|
}
|
|
472
513
|
else {
|
|
473
514
|
const { from, to } = leg;
|
|
474
|
-
const [
|
|
475
|
-
|
|
515
|
+
const [allowedAssetHolders, senderLegCount] = yield assembleAssetHolders((0, utils_2.tuple)([], new bignumber_js_1.default(0)), from, to, {
|
|
516
|
+
did: signer.did,
|
|
517
|
+
address: context.getSigningAccount().address,
|
|
518
|
+
portfolioPermissions: signerPortfolioPermissions,
|
|
519
|
+
}, assetHolderIdParams);
|
|
520
|
+
return { allowedAssetHolders, senderLegCount, offChainIndex: undefined };
|
|
476
521
|
}
|
|
477
522
|
})));
|
|
478
|
-
const
|
|
479
|
-
const
|
|
523
|
+
const allowedAssetHolders = legContributions.flatMap(c => c.allowedAssetHolders);
|
|
524
|
+
const senderLegCount = legContributions.reduce((sum, c) => sum.plus(c.senderLegCount), new bignumber_js_1.default(0));
|
|
480
525
|
const offChainLegIndices = legContributions
|
|
481
526
|
.filter(c => c.offChainIndex !== undefined)
|
|
482
527
|
.map(c => c.offChainIndex);
|
|
483
528
|
const instructionInfo = executeInstructionInfo.unwrapOrDefault();
|
|
484
529
|
return {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
530
|
+
allowedAssetHolders,
|
|
531
|
+
assetHolderParams,
|
|
532
|
+
senderLegCount,
|
|
533
|
+
totalLegCount: new bignumber_js_1.default(legs.length),
|
|
489
534
|
signer,
|
|
490
535
|
offChainLegIndices,
|
|
491
536
|
instructionInfo,
|