@polymeshassociation/polymesh-sdk 30.2.0 → 31.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -12
- package/README.md +4 -4
- package/api/client/AccountManagement.d.ts +1 -15
- package/api/client/AccountManagement.d.ts.map +1 -1
- package/api/client/AccountManagement.js +1 -2
- package/api/client/AccountManagement.js.map +1 -1
- package/api/client/Assets.d.ts +1 -1
- package/api/client/Claims.d.ts +4 -17
- package/api/client/Claims.d.ts.map +1 -1
- package/api/client/Claims.js +3 -47
- package/api/client/Claims.js.map +1 -1
- package/api/client/Identities.d.ts +10 -45
- package/api/client/Identities.d.ts.map +1 -1
- package/api/client/Identities.js +3 -18
- package/api/client/Identities.js.map +1 -1
- package/api/client/Staking.d.ts +3 -4
- package/api/client/Staking.d.ts.map +1 -1
- package/api/client/Staking.js +2 -1
- package/api/client/Staking.js.map +1 -1
- package/api/entities/Account/Staking/index.d.ts.map +1 -1
- package/api/entities/Account/Staking/index.js +2 -9
- package/api/entities/Account/Staking/index.js.map +1 -1
- package/api/entities/Account/helpers.js +1 -1
- package/api/entities/Account/helpers.js.map +1 -1
- package/api/entities/Account/index.d.ts.map +1 -1
- package/api/entities/Account/index.js +0 -6
- package/api/entities/Account/index.js.map +1 -1
- package/api/entities/Account/types.d.ts +0 -2
- package/api/entities/Account/types.d.ts.map +1 -1
- package/api/entities/Account/types.js.map +1 -1
- package/api/entities/Asset/Base/Settlements/index.js +2 -2
- package/api/entities/Asset/Base/Settlements/index.js.map +1 -1
- package/api/entities/Asset/NonFungible/Nft.d.ts.map +1 -1
- package/api/entities/Asset/NonFungible/Nft.js +1 -11
- package/api/entities/Asset/NonFungible/Nft.js.map +1 -1
- package/api/entities/Asset/types.d.ts +3 -66
- package/api/entities/Asset/types.d.ts.map +1 -1
- package/api/entities/Asset/types.js +4 -68
- package/api/entities/Asset/types.js.map +1 -1
- package/api/entities/AuthorizationRequest.d.ts.map +1 -1
- package/api/entities/AuthorizationRequest.js +5 -8
- package/api/entities/AuthorizationRequest.js.map +1 -1
- package/api/entities/Identity/index.d.ts +4 -30
- package/api/entities/Identity/index.d.ts.map +1 -1
- package/api/entities/Identity/index.js +8 -70
- package/api/entities/Identity/index.js.map +1 -1
- package/api/entities/Instruction/index.d.ts +2 -14
- package/api/entities/Instruction/index.d.ts.map +1 -1
- package/api/entities/Instruction/index.js +19 -49
- package/api/entities/Instruction/index.js.map +1 -1
- package/api/entities/Instruction/types.d.ts +2 -2
- package/api/entities/Portfolio/index.d.ts.map +1 -1
- package/api/entities/Portfolio/index.js +4 -9
- package/api/entities/Portfolio/index.js.map +1 -1
- package/api/entities/Subsidies.d.ts +0 -2
- package/api/entities/Subsidies.d.ts.map +1 -1
- package/api/entities/Subsidies.js +0 -9
- package/api/entities/Subsidies.js.map +1 -1
- package/api/entities/common/namespaces/Authorizations.d.ts.map +1 -1
- package/api/entities/common/namespaces/Authorizations.js +0 -8
- package/api/entities/common/namespaces/Authorizations.js.map +1 -1
- package/api/entities/types.d.ts +5 -17
- package/api/entities/types.d.ts.map +1 -1
- package/api/entities/types.js +0 -4
- package/api/entities/types.js.map +1 -1
- package/api/procedures/acceptPrimaryKeyRotation.d.ts +1 -2
- package/api/procedures/acceptPrimaryKeyRotation.d.ts.map +1 -1
- package/api/procedures/acceptPrimaryKeyRotation.js +4 -33
- package/api/procedures/acceptPrimaryKeyRotation.js.map +1 -1
- package/api/procedures/acceptSubsidy.d.ts.map +1 -1
- package/api/procedures/acceptSubsidy.js +0 -6
- package/api/procedures/acceptSubsidy.js.map +1 -1
- package/api/procedures/addInstruction.d.ts.map +1 -1
- package/api/procedures/addInstruction.js +7 -31
- package/api/procedures/addInstruction.js.map +1 -1
- package/api/procedures/attestPrimaryKeyRotation.js +1 -1
- package/api/procedures/attestPrimaryKeyRotation.js.map +1 -1
- package/api/procedures/bondPolyx.d.ts.map +1 -1
- package/api/procedures/bondPolyx.js +7 -28
- package/api/procedures/bondPolyx.js.map +1 -1
- package/api/procedures/configureDividendDistribution.js +1 -1
- package/api/procedures/configureDividendDistribution.js.map +1 -1
- package/api/procedures/consumeAddMultiSigSignerAuthorization.js +1 -1
- package/api/procedures/consumeAddMultiSigSignerAuthorization.js.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.d.ts.map +1 -1
- package/api/procedures/consumeJoinOrRotateAuthorization.js +0 -9
- package/api/procedures/consumeJoinOrRotateAuthorization.js.map +1 -1
- package/api/procedures/controllerTransfer.js +1 -1
- package/api/procedures/controllerTransfer.js.map +1 -1
- package/api/procedures/createAsset.d.ts +1 -1
- package/api/procedures/createAsset.d.ts.map +1 -1
- package/api/procedures/createAsset.js +44 -38
- package/api/procedures/createAsset.js.map +1 -1
- package/api/procedures/createMultiSig.js +1 -1
- package/api/procedures/createMultiSig.js.map +1 -1
- package/api/procedures/createNftCollection.js +1 -1
- package/api/procedures/createNftCollection.js.map +1 -1
- package/api/procedures/createVenue.d.ts.map +1 -1
- package/api/procedures/createVenue.js +1 -5
- package/api/procedures/createVenue.js.map +1 -1
- package/api/procedures/executeManualInstruction.d.ts.map +1 -1
- package/api/procedures/executeManualInstruction.js +1 -1
- package/api/procedures/executeManualInstruction.js.map +1 -1
- package/api/procedures/inviteExternalAgent.d.ts +23 -5
- package/api/procedures/inviteExternalAgent.d.ts.map +1 -1
- package/api/procedures/inviteExternalAgent.js +47 -36
- package/api/procedures/inviteExternalAgent.js.map +1 -1
- package/api/procedures/issueNft.d.ts.map +1 -1
- package/api/procedures/issueNft.js +1 -8
- package/api/procedures/issueNft.js.map +1 -1
- package/api/procedures/modifyClaims.d.ts.map +1 -1
- package/api/procedures/modifyClaims.js +8 -3
- package/api/procedures/modifyClaims.js.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.d.ts +1 -1
- package/api/procedures/modifyInstructionAffirmation.d.ts.map +1 -1
- package/api/procedures/modifyInstructionAffirmation.js +13 -77
- package/api/procedures/modifyInstructionAffirmation.js.map +1 -1
- package/api/procedures/modifyMultiSig.js +3 -3
- package/api/procedures/modifyMultiSig.js.map +1 -1
- package/api/procedures/nftControllerTransfer.d.ts +1 -2
- package/api/procedures/nftControllerTransfer.d.ts.map +1 -1
- package/api/procedures/nftControllerTransfer.js +4 -9
- package/api/procedures/nftControllerTransfer.js.map +1 -1
- package/api/procedures/quitSubsidy.d.ts.map +1 -1
- package/api/procedures/quitSubsidy.js +1 -9
- package/api/procedures/quitSubsidy.js.map +1 -1
- package/api/procedures/registerDid.d.ts.map +1 -1
- package/api/procedures/registerDid.js +0 -6
- package/api/procedures/registerDid.js.map +1 -1
- package/api/procedures/registerIdentity.d.ts +5 -1
- package/api/procedures/registerIdentity.d.ts.map +1 -1
- package/api/procedures/registerIdentity.js +17 -8
- package/api/procedures/registerIdentity.js.map +1 -1
- package/api/procedures/revokeIdentityToCreatePortfolios.d.ts +1 -1
- package/api/procedures/revokeIdentityToCreatePortfolios.d.ts.map +1 -1
- package/api/procedures/revokeIdentityToCreatePortfolios.js.map +1 -1
- package/api/procedures/revokeSubsidy.d.ts.map +1 -1
- package/api/procedures/revokeSubsidy.js +0 -6
- package/api/procedures/revokeSubsidy.js.map +1 -1
- package/api/procedures/selfRegisterDid.d.ts.map +1 -1
- package/api/procedures/selfRegisterDid.js +0 -6
- package/api/procedures/selfRegisterDid.js.map +1 -1
- package/api/procedures/setMandatoryReceiverAffirmation.d.ts.map +1 -1
- package/api/procedures/setMandatoryReceiverAffirmation.js +0 -6
- package/api/procedures/setMandatoryReceiverAffirmation.js.map +1 -1
- package/api/procedures/setPermissionGroup.d.ts +11 -2
- package/api/procedures/setPermissionGroup.d.ts.map +1 -1
- package/api/procedures/setPermissionGroup.js +34 -30
- package/api/procedures/setPermissionGroup.js.map +1 -1
- package/api/procedures/setStakingController.d.ts +5 -10
- package/api/procedures/setStakingController.d.ts.map +1 -1
- package/api/procedures/setStakingController.js +10 -41
- package/api/procedures/setStakingController.js.map +1 -1
- package/api/procedures/setStakingPayee.d.ts.map +1 -1
- package/api/procedures/setStakingPayee.js +2 -2
- package/api/procedures/setStakingPayee.js.map +1 -1
- package/api/procedures/subsidizeAccount.d.ts +5 -7
- package/api/procedures/subsidizeAccount.d.ts.map +1 -1
- package/api/procedures/subsidizeAccount.js +2 -51
- package/api/procedures/subsidizeAccount.js.map +1 -1
- package/api/procedures/toggleAssetPreApproval.js +1 -1
- package/api/procedures/toggleAssetPreApproval.js.map +1 -1
- package/api/procedures/transferFunds.d.ts.map +1 -1
- package/api/procedures/transferFunds.js +2 -2
- package/api/procedures/transferFunds.js.map +1 -1
- package/api/procedures/transferPolyx.d.ts.map +1 -1
- package/api/procedures/transferPolyx.js +6 -30
- package/api/procedures/transferPolyx.js.map +1 -1
- package/api/procedures/types.d.ts +24 -110
- package/api/procedures/types.d.ts.map +1 -1
- package/api/procedures/types.js +13 -17
- package/api/procedures/types.js.map +1 -1
- package/api/procedures/updateVenueSigners.d.ts.map +1 -1
- package/api/procedures/updateVenueSigners.js +1 -5
- package/api/procedures/updateVenueSigners.js.map +1 -1
- package/api/procedures/utils.d.ts +1 -11
- package/api/procedures/utils.d.ts.map +1 -1
- package/api/procedures/utils.js +8 -70
- package/api/procedures/utils.js.map +1 -1
- package/base/Context.d.ts +1 -10
- package/base/Context.d.ts.map +1 -1
- package/base/Context.js +4 -55
- package/base/Context.js.map +1 -1
- package/base/PolymeshTransaction.js +1 -1
- package/base/PolymeshTransaction.js.map +1 -1
- package/internal.d.ts +0 -4
- package/internal.d.ts.map +1 -1
- package/internal.js +4 -12
- package/internal.js.map +1 -1
- package/npm-package/{polymeshassociation-polymesh-sdk-30.2.0.tgz → polymeshassociation-polymesh-sdk-31.0.0-beta.1.tgz} +0 -0
- package/package.json +1 -1
- package/types/txGroupConstants.d.ts +52 -21
- package/types/txGroupConstants.d.ts.map +1 -1
- package/types/txGroupConstants.js +84 -28
- package/types/txGroupConstants.js.map +1 -1
- package/utils/constants.d.ts +1 -1
- package/utils/constants.d.ts.map +1 -1
- package/utils/constants.js +1 -1
- package/utils/constants.js.map +1 -1
- package/utils/conversion.d.ts +8 -45
- package/utils/conversion.d.ts.map +1 -1
- package/utils/conversion.js +98 -336
- package/utils/conversion.js.map +1 -1
- package/utils/internal.d.ts +2 -11
- package/utils/internal.d.ts.map +1 -1
- package/utils/internal.js +3 -24
- package/utils/internal.js.map +1 -1
- package/utils/typeguards.d.ts +1 -5
- package/utils/typeguards.d.ts.map +1 -1
- package/utils/typeguards.js +0 -7
- package/utils/typeguards.js.map +1 -1
- package/api/entities/Identity/ChildIdentity.d.ts +0 -44
- package/api/entities/Identity/ChildIdentity.d.ts.map +0 -1
- package/api/entities/Identity/ChildIdentity.js +0 -80
- package/api/entities/Identity/ChildIdentity.js.map +0 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.d.ts +0 -35
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.d.ts.map +0 -1
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.js +0 -116
- package/api/procedures/consumeAddRelayerPayingKeyAuthorization.js.map +0 -1
- package/api/procedures/createChildIdentities.d.ts +0 -35
- package/api/procedures/createChildIdentities.d.ts.map +0 -1
- package/api/procedures/createChildIdentities.js +0 -123
- package/api/procedures/createChildIdentities.js.map +0 -1
- package/api/procedures/createChildIdentity.d.ts +0 -37
- package/api/procedures/createChildIdentity.d.ts.map +0 -1
- package/api/procedures/createChildIdentity.js +0 -128
- package/api/procedures/createChildIdentity.js.map +0 -1
- package/api/procedures/unlinkChildIdentity.d.ts +0 -27
- package/api/procedures/unlinkChildIdentity.d.ts.map +0 -1
- package/api/procedures/unlinkChildIdentity.js +0 -101
- package/api/procedures/unlinkChildIdentity.js.map +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Account, AuthorizationRequest, Procedure } from '../../internal';
|
|
2
|
-
import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from '../../types/internal';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
export interface ConsumeAddRelayerPayingKeyAuthorizationParams {
|
|
7
|
-
authRequest: AuthorizationRequest;
|
|
8
|
-
accept: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface Storage {
|
|
11
|
-
actingAccount: Account;
|
|
12
|
-
calledByTarget: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
*
|
|
17
|
-
* Consumes AddRelayerPayingKey Authorizations
|
|
18
|
-
*/
|
|
19
|
-
export declare function prepareConsumeAddRelayerPayingKeyAuthorization(this: Procedure<ConsumeAddRelayerPayingKeyAuthorizationParams, void, Storage>, args: ConsumeAddRelayerPayingKeyAuthorizationParams): Promise<TransactionSpec<void, ExtrinsicParams<'identity', 'removeAuthorization'>> | TransactionSpec<void, any>>;
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*
|
|
23
|
-
* - If the auth is being accepted, we check that the caller is the target
|
|
24
|
-
* - If the auth is being rejected, we check that the caller is either the target or the issuer
|
|
25
|
-
*/
|
|
26
|
-
export declare function getAuthorization(this: Procedure<ConsumeAddRelayerPayingKeyAuthorizationParams, void, Storage>, { authRequest, accept }: ConsumeAddRelayerPayingKeyAuthorizationParams): Promise<ProcedureAuthorization>;
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
export declare function prepareStorage(this: Procedure<ConsumeAddRelayerPayingKeyAuthorizationParams, void, Storage>, { authRequest: { target } }: ConsumeAddRelayerPayingKeyAuthorizationParams): Promise<Storage>;
|
|
31
|
-
/**
|
|
32
|
-
* @hidden
|
|
33
|
-
*/
|
|
34
|
-
export declare const consumeAddRelayerPayingKeyAuthorization: () => Procedure<ConsumeAddRelayerPayingKeyAuthorizationParams, void, Storage>;
|
|
35
|
-
//# sourceMappingURL=consumeAddRelayerPayingKeyAuthorization.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consumeAddRelay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@ -1,116 +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.consumeAddRelayerPayingKeyAuthorization = void 0;
|
|
13
|
-
exports.prepareConsumeAddRelayerPayingKeyAuthorization = prepareConsumeAddRelayerPayingKeyAuthorization;
|
|
14
|
-
exports.getAuthorization = getAuthorization;
|
|
15
|
-
exports.prepareStorage = prepareStorage;
|
|
16
|
-
const utils_1 = require("../../api/procedures/utils");
|
|
17
|
-
const internal_1 = require("../../internal");
|
|
18
|
-
const types_1 = require("../../types");
|
|
19
|
-
const conversion_1 = require("../../utils/conversion");
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*
|
|
23
|
-
* Consumes AddRelayerPayingKey Authorizations
|
|
24
|
-
*/
|
|
25
|
-
function prepareConsumeAddRelayerPayingKeyAuthorization(args) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const { context: { polymeshApi: { tx: { relayer, identity }, }, }, storage: { calledByTarget }, context, } = this;
|
|
28
|
-
const { authRequest, accept } = args;
|
|
29
|
-
const { target, authId, issuer, data: { type }, } = authRequest;
|
|
30
|
-
if (![
|
|
31
|
-
types_1.AuthorizationType.AddRelayerPayingKey, // NOSONAR
|
|
32
|
-
types_1.AuthorizationType.OldAddRelayerPayingKey,
|
|
33
|
-
].includes(type)) {
|
|
34
|
-
throw new internal_1.PolymeshError({
|
|
35
|
-
code: types_1.ErrorCode.UnexpectedError,
|
|
36
|
-
message: `Unrecognized auth type: "${type}" for consumeAddRelayerPayingKeyAuthorization method`,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
const rawAuthId = (0, conversion_1.bigNumberToU64)(authId, context);
|
|
40
|
-
if (!accept) {
|
|
41
|
-
const baseArgs = {};
|
|
42
|
-
if (calledByTarget) {
|
|
43
|
-
baseArgs.paidForBy = issuer;
|
|
44
|
-
}
|
|
45
|
-
return Object.assign(Object.assign({ transaction: identity.removeAuthorization }, baseArgs), { args: [
|
|
46
|
-
(0, conversion_1.signerValueToSignatory)((0, conversion_1.signerToSignerValue)(target), context),
|
|
47
|
-
rawAuthId,
|
|
48
|
-
(0, conversion_1.booleanToBool)(calledByTarget, context),
|
|
49
|
-
], resolver: undefined });
|
|
50
|
-
}
|
|
51
|
-
if (!context.isV7) {
|
|
52
|
-
throw new internal_1.PolymeshError({
|
|
53
|
-
code: types_1.ErrorCode.NotSupported,
|
|
54
|
-
message: 'acceptPayingKey type authorization is not supported in chain 8.x',
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
yield (0, utils_1.assertAuthorizationRequestValid)(authRequest, context);
|
|
58
|
-
return {
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
-
transaction: relayer.acceptPayingKey,
|
|
61
|
-
paidForBy: issuer,
|
|
62
|
-
args: [rawAuthId],
|
|
63
|
-
resolver: undefined,
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @hidden
|
|
69
|
-
*
|
|
70
|
-
* - If the auth is being accepted, we check that the caller is the target
|
|
71
|
-
* - If the auth is being rejected, we check that the caller is either the target or the issuer
|
|
72
|
-
*/
|
|
73
|
-
function getAuthorization(_a) {
|
|
74
|
-
return __awaiter(this, arguments, void 0, function* ({ authRequest, accept }) {
|
|
75
|
-
const { issuer } = authRequest;
|
|
76
|
-
const { storage: { actingAccount, calledByTarget }, } = this;
|
|
77
|
-
let hasRoles = calledByTarget;
|
|
78
|
-
if (accept) {
|
|
79
|
-
return {
|
|
80
|
-
roles: hasRoles ||
|
|
81
|
-
`"${types_1.AuthorizationType.AddRelayerPayingKey}" Authorization Requests must be accepted by the target Account`,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
const identity = yield actingAccount.getIdentity();
|
|
85
|
-
hasRoles = hasRoles || !!(identity === null || identity === void 0 ? void 0 : identity.isEqual(issuer));
|
|
86
|
-
return {
|
|
87
|
-
roles: hasRoles ||
|
|
88
|
-
`"${types_1.AuthorizationType.AddRelayerPayingKey}" Authorization Requests can only be removed by the issuer Identity or the target Account`,
|
|
89
|
-
permissions: {
|
|
90
|
-
transactions: [types_1.TxTags.identity.RemoveAuthorization],
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* @hidden
|
|
97
|
-
*/
|
|
98
|
-
function prepareStorage(_a) {
|
|
99
|
-
return __awaiter(this, arguments, void 0, function* ({ authRequest: { target } }) {
|
|
100
|
-
const { context } = this;
|
|
101
|
-
// AddRelayerPayingKey Authorizations always target an Account
|
|
102
|
-
const targetAccount = target;
|
|
103
|
-
const actingAccount = yield context.getActingAccount();
|
|
104
|
-
const calledByTarget = targetAccount.isEqual(actingAccount);
|
|
105
|
-
return {
|
|
106
|
-
actingAccount,
|
|
107
|
-
calledByTarget,
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* @hidden
|
|
113
|
-
*/
|
|
114
|
-
const consumeAddRelayerPayingKeyAuthorization = () => new internal_1.Procedure(prepareConsumeAddRelayerPayingKeyAuthorization, getAuthorization, prepareStorage);
|
|
115
|
-
exports.consumeAddRelayerPayingKeyAuthorization = consumeAddRelayerPayingKeyAuthorization;
|
|
116
|
-
//# sourceMappingURL=consumeAddRelayerPayingKeyAuthorization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consumeAddRelayerPayingKeyAuthorization.js","sourceRoot":"","sources":["../../../src/api/procedures/consumeAddRelayerPayingKeyAuthorization.ts"],"names":[],"mappings":";;;;;;;;;;;;AA6BA,wGA2EC;AAQD,4CA8BC;AAKD,wCAeC;AAlKD,kDAAyE;AACzE,yCAA+F;AAC/F,mCAA+D;AAE/D,mDAK4B;AAe5B;;;;GAIG;AACH,SAAsB,8CAA8C,CAElE,IAAmD;;QAMnD,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,GAC1B,GACF,EACD,OAAO,EAAE,EAAE,cAAc,EAAE,EAC3B,OAAO,GACR,GAAG,IAAI,CAAC;QACT,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAErC,MAAM,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EAAE,EAAE,IAAI,EAAE,GACf,GAAG,WAAW,CAAC;QAEhB,IACE,CAAC;YACC,yBAAiB,CAAC,mBAAmB,EAAE,UAAU;YACjD,yBAAiB,CAAC,sBAAsB;SACzC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAChB,CAAC;YACD,MAAM,IAAI,wBAAa,CAAC;gBACtB,IAAI,EAAE,iBAAS,CAAC,eAAe;gBAC/B,OAAO,EAAE,4BAA4B,IAAI,sDAAsD;aAChG,CAAC,CAAC;QACL,CAAC;QAED,MAAM,SAAS,GAAG,IAAA,2BAAc,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,QAAQ,GAA6B,EAAE,CAAC;YAE9C,IAAI,cAAc,EAAE,CAAC;gBACnB,QAAQ,CAAC,SAAS,GAAG,MAAM,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CAAE,OAAO,CAAC,MAAM,CAAC,CAAA,CAAC;QAEnD,OAAO;YACL,KAAK,EACH,QAAQ;gBACR,IAAI,yBAAiB,CAAC,mBAAmB,2FAA2F;YACtI,WAAW,EAAE;gBACX,YAAY,EAAE,CAAC,cAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC;aACpD;SACF,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACH,SAAsB,cAAc;yDAElC,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAiD;QAE1E,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,8DAA8D;QAC9D,MAAM,aAAa,GAAG,MAAiB,CAAC;QACxC,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACvD,MAAM,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAE5D,OAAO;YACL,aAAa;YACb,cAAc;SACf,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACI,MAAM,uCAAuC,GAAG,GAIrD,EAAE,CACF,IAAI,oBAAS,CAAC,8CAA8C,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AALrF,QAAA,uCAAuC,2CAK8C"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ISubmittableResult } from '@polkadot/types/types';
|
|
2
|
-
import { ChildIdentity, Context, Identity, Procedure } from '../../internal';
|
|
3
|
-
import { Account, CreateChildIdentitiesParams } from '../../types';
|
|
4
|
-
import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from '../../types/internal';
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export interface Storage {
|
|
9
|
-
identity: Identity;
|
|
10
|
-
actingAccount: Account;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export declare const createChildIdentityResolver: (context: Context) => (receipt: ISubmittableResult) => ChildIdentity[];
|
|
16
|
-
/**
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
export declare function prepareCreateChildIdentities(this: Procedure<CreateChildIdentitiesParams, ChildIdentity[], Storage>, // NOSONAR
|
|
20
|
-
args: CreateChildIdentitiesParams): Promise<TransactionSpec<ChildIdentity[], // NOSONAR
|
|
21
|
-
ExtrinsicParams<'identity', any>>>;
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
export declare function getAuthorization(this: Procedure<CreateChildIdentitiesParams, ChildIdentity[], Storage>): Promise<ProcedureAuthorization>;
|
|
26
|
-
/**
|
|
27
|
-
* @hidden
|
|
28
|
-
*/
|
|
29
|
-
export declare function prepareStorage(this: Procedure<CreateChildIdentitiesParams, ChildIdentity[], Storage>): Promise<Storage>;
|
|
30
|
-
/**
|
|
31
|
-
* @hidden
|
|
32
|
-
*/
|
|
33
|
-
export declare const createChildIdentities: () => Procedure<CreateChildIdentitiesParams, ChildIdentity[], // NOSONAR
|
|
34
|
-
Storage>;
|
|
35
|
-
//# sourceMappingURL=createChildIdentities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createChildIdentities.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/createChildIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAqB,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAQ5F;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACrC,SAAS,OAAO,MAChB,SAAS,kBAAkB,KAAG,aAAa,EAQ3C,CAAC;AAEJ;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,SAAS,CAAC,2BAA2B,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,UAAU;AAClF,IAAI,EAAE,2BAA2B,GAChC,OAAO,CACR,eAAe,CACb,aAAa,EAAE,EAAE,UAAU;AAE3B,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,CACjC,CACF,CA4DA;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,SAAS,CAAC,2BAA2B,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,GACrE,OAAO,CAAC,sBAAsB,CAAC,CAoBjC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,SAAS,CAAC,2BAA2B,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,GACrE,OAAO,CAAC,OAAO,CAAC,CAYlB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAAO,SAAS,CAChD,2BAA2B,EAC3B,aAAa,EAAE,EAAE,UAAU;AAC3B,OAAO,CACyE,CAAC"}
|
|
@@ -1,123 +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.createChildIdentities = exports.createChildIdentityResolver = void 0;
|
|
13
|
-
exports.prepareCreateChildIdentities = prepareCreateChildIdentities;
|
|
14
|
-
exports.getAuthorization = getAuthorization;
|
|
15
|
-
exports.prepareStorage = prepareStorage;
|
|
16
|
-
const internal_1 = require("../../internal");
|
|
17
|
-
const types_1 = require("../../types");
|
|
18
|
-
const conversion_1 = require("../../utils/conversion");
|
|
19
|
-
const internal_2 = require("../../utils/internal");
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
const createChildIdentityResolver = (context) => (receipt) => {
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
const childDids = (0, internal_2.filterEventRecords)(receipt, 'identity', 'ChildDidCreated');
|
|
26
|
-
return childDids.map(
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
({ data }) => new internal_1.ChildIdentity({ did: (0, conversion_1.identityIdToString)(data[1]) }, context) // NOSONAR
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
exports.createChildIdentityResolver = createChildIdentityResolver;
|
|
32
|
-
/**
|
|
33
|
-
* @hidden
|
|
34
|
-
*/
|
|
35
|
-
function prepareCreateChildIdentities(// NOSONAR
|
|
36
|
-
args) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const { context: { polymeshApi: { tx }, }, context, storage: { identity: { did: signingDid }, }, } = this;
|
|
39
|
-
if (!context.isV7) {
|
|
40
|
-
throw new internal_1.PolymeshError({
|
|
41
|
-
code: types_1.ErrorCode.NotSupported,
|
|
42
|
-
message: 'Child identities are no longer supported in chain v8',
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
const { childKeyAuths, expiresAt } = args;
|
|
46
|
-
if (expiresAt <= new Date()) {
|
|
47
|
-
throw new internal_1.PolymeshError({
|
|
48
|
-
code: types_1.ErrorCode.ValidationError,
|
|
49
|
-
message: 'Expiry date must be in the future',
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const childIdentity = new internal_1.ChildIdentity({ did: signingDid }, context);
|
|
53
|
-
const [parentDid, ...identities] = yield Promise.all([
|
|
54
|
-
childIdentity.getParentDid(),
|
|
55
|
-
...childKeyAuths.map(({ key }) => (0, internal_2.asAccount)(key, context).getIdentity()),
|
|
56
|
-
]);
|
|
57
|
-
if (parentDid) {
|
|
58
|
-
throw new internal_1.PolymeshError({
|
|
59
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
60
|
-
message: 'The signing Identity is already a child Identity and cannot create further child identities',
|
|
61
|
-
data: {
|
|
62
|
-
parentDid,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (identities.some(identityValue => identityValue !== null)) {
|
|
67
|
-
throw new internal_1.PolymeshError({
|
|
68
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
69
|
-
message: 'One or more accounts are already linked to some Identity',
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const rawExpiry = (0, conversion_1.dateToMoment)(expiresAt, context);
|
|
73
|
-
return {
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
-
transaction: tx.identity.createChildIdentities,
|
|
76
|
-
args: [(0, conversion_1.childKeysWithAuthToCreateChildIdentitiesWithAuth)(childKeyAuths, context), rawExpiry],
|
|
77
|
-
resolver: (0, exports.createChildIdentityResolver)(context),
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @hidden
|
|
83
|
-
*/
|
|
84
|
-
function getAuthorization() {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
const { storage: { identity, actingAccount }, } = this;
|
|
87
|
-
const { account: primaryAccount } = yield identity.getPrimaryAccount();
|
|
88
|
-
if (!(0, internal_2.areSameAccounts)(actingAccount, primaryAccount)) {
|
|
89
|
-
return {
|
|
90
|
-
signerPermissions: "Child Identities can only be created by an Identity's primary Account",
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
permissions: {
|
|
95
|
-
transactions: [types_1.TxTags.identity.CreateChildIdentities],
|
|
96
|
-
assets: [],
|
|
97
|
-
portfolios: [],
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* @hidden
|
|
104
|
-
*/
|
|
105
|
-
function prepareStorage() {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const { context } = this;
|
|
108
|
-
const [identity, actingAccount] = yield Promise.all([
|
|
109
|
-
context.getSigningIdentity(),
|
|
110
|
-
context.getActingAccount(),
|
|
111
|
-
]);
|
|
112
|
-
return {
|
|
113
|
-
identity,
|
|
114
|
-
actingAccount,
|
|
115
|
-
};
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @hidden
|
|
120
|
-
*/
|
|
121
|
-
const createChildIdentities = () => new internal_1.Procedure(prepareCreateChildIdentities, getAuthorization, prepareStorage);
|
|
122
|
-
exports.createChildIdentities = createChildIdentities;
|
|
123
|
-
//# sourceMappingURL=createChildIdentities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createChildIdentities.js","sourceRoot":"","sources":["../../../src/api/procedures/createChildIdentities.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsCA,oEAqEC;AAKD,4CAsBC;AAKD,wCAcC;AAvJD,yCAAwF;AACxF,mCAAkF;AAElF,mDAI4B;AAC5B,+CAAkF;AAUlF;;GAEG;AACI,MAAM,2BAA2B,GACtC,CAAC,OAAgB,EAAE,EAAE,CACrB,CAAC,OAA2B,EAAmB,EAAE;IAC/C,8DAA8D;IAC9D,MAAM,SAAS,GAAG,IAAA,6BAAkB,EAAC,OAAO,EAAE,UAAiB,EAAE,iBAAiB,CAAC,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AM,CAAC,QAAQ,CAAC,qBAAqB,CAAC;gBACrD,MAAM,EAAE,EAAE;gBACV,UAAU,EAAE,EAAE;aACf;SACF,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACH,SAAsB,cAAc;;QAGlC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAClD,OAAO,CAAC,kBAAkB,EAAE;YAC5B,OAAO,CAAC,gBAAgB,EAAE;SAC3B,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ;YACR,aAAa;SACd,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACI,MAAM,qBAAqB,GAAG,GAInC,EAAE,CAAC,IAAI,oBAAS,CAAC,4BAA4B,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAJtE,QAAA,qBAAqB,yBAIiD"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ISubmittableResult } from '@polkadot/types/types';
|
|
2
|
-
import { ChildIdentity, Context, Identity, Procedure } from '../../internal';
|
|
3
|
-
import { Account, CreateChildIdentityParams } from '../../types';
|
|
4
|
-
import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from '../../types/internal';
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export interface Storage {
|
|
9
|
-
identity: Identity;
|
|
10
|
-
actingAccount: Account;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export declare const createChildIdentityResolver: (context: Context) => (receipt: ISubmittableResult) => ChildIdentity;
|
|
16
|
-
/**
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
export declare function prepareCreateChildIdentity(this: Procedure<CreateChildIdentityParams, ChildIdentity, // NOSONAR
|
|
20
|
-
Storage>, args: CreateChildIdentityParams): Promise<TransactionSpec<ChildIdentity, // NOSONAR
|
|
21
|
-
ExtrinsicParams<'identity', any>>>;
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
export declare function getAuthorization(this: Procedure<CreateChildIdentityParams, ChildIdentity, // NOSONAR
|
|
26
|
-
Storage>): Promise<ProcedureAuthorization>;
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
export declare function prepareStorage(this: Procedure<CreateChildIdentityParams, ChildIdentity, // NOSONAR
|
|
31
|
-
Storage>): Promise<Storage>;
|
|
32
|
-
/**
|
|
33
|
-
* @hidden
|
|
34
|
-
*/
|
|
35
|
-
export declare const createChildIdentity: () => Procedure<CreateChildIdentityParams, ChildIdentity, // NOSONAR
|
|
36
|
-
Storage>;
|
|
37
|
-
//# sourceMappingURL=createChildIdentity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createChildIdentity.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/createChildIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAqB,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAS5F;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACrC,SAAS,OAAO,MAChB,SAAS,kBAAkB,KAAG,aAS9B,CAAC;AAEJ;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,SAAS,CACb,yBAAyB,EACzB,aAAa,EAAE,UAAU;AACzB,OAAO,CACR,EACD,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CACR,eAAe,CACb,aAAa,EAAE,UAAU;AAEzB,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,CACjC,CACF,CAoEA;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,SAAS,CACb,yBAAyB,EACzB,aAAa,EAAE,UAAU;AACzB,OAAO,CACR,GACA,OAAO,CAAC,sBAAsB,CAAC,CAoBjC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,SAAS,CACb,yBAAyB,EACzB,aAAa,EAAE,UAAU;AACzB,OAAO,CACR,GACA,OAAO,CAAC,OAAO,CAAC,CAYlB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAO,SAAS,CAC9C,yBAAyB,EACzB,aAAa,EAAE,UAAU;AACzB,OAAO,CACuE,CAAC"}
|
|
@@ -1,128 +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.createChildIdentity = exports.createChildIdentityResolver = void 0;
|
|
13
|
-
exports.prepareCreateChildIdentity = prepareCreateChildIdentity;
|
|
14
|
-
exports.getAuthorization = getAuthorization;
|
|
15
|
-
exports.prepareStorage = prepareStorage;
|
|
16
|
-
const internal_1 = require("../../internal");
|
|
17
|
-
const types_1 = require("../../types");
|
|
18
|
-
const conversion_1 = require("../../utils/conversion");
|
|
19
|
-
const internal_2 = require("../../utils/internal");
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
const createChildIdentityResolver = (context) => (receipt) => {
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
const [record] = (0, internal_2.filterEventRecords)(receipt, 'identity', 'ChildDidCreated');
|
|
26
|
-
const { data } = record;
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
const did = (0, conversion_1.identityIdToString)(data[1]);
|
|
29
|
-
return new internal_1.ChildIdentity({ did }, context); // NOSONAR
|
|
30
|
-
};
|
|
31
|
-
exports.createChildIdentityResolver = createChildIdentityResolver;
|
|
32
|
-
/**
|
|
33
|
-
* @hidden
|
|
34
|
-
*/
|
|
35
|
-
function prepareCreateChildIdentity(args) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const { context: { polymeshApi: { tx, query }, }, context, storage: { identity: { did: signingDid }, }, } = this;
|
|
38
|
-
if (!context.isV7) {
|
|
39
|
-
throw new internal_1.PolymeshError({
|
|
40
|
-
code: types_1.ErrorCode.NotSupported,
|
|
41
|
-
message: 'Child identities are no longer supported in v8',
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
const { secondaryKey } = args;
|
|
45
|
-
const childAccount = (0, internal_2.asAccount)(secondaryKey, context);
|
|
46
|
-
const rawIdentity = (0, conversion_1.stringToIdentityId)(signingDid, context);
|
|
47
|
-
const rawChildAccount = (0, conversion_1.stringToAccountId)(childAccount.address, context);
|
|
48
|
-
const childIdentity = new internal_1.ChildIdentity({ did: signingDid }, context); // NOSONAR
|
|
49
|
-
const [isSecondaryKey, multiSig, parentDid] = yield Promise.all([
|
|
50
|
-
query.identity.didKeys(rawIdentity, rawChildAccount),
|
|
51
|
-
childAccount.getMultiSig(),
|
|
52
|
-
childIdentity.getParentDid(), // NOSONAR
|
|
53
|
-
]);
|
|
54
|
-
if (!(0, conversion_1.boolToBoolean)(isSecondaryKey)) {
|
|
55
|
-
throw new internal_1.PolymeshError({
|
|
56
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
57
|
-
message: 'The `secondaryKey` provided is not a secondary key of the signing Identity',
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (multiSig) {
|
|
61
|
-
const { total } = yield multiSig.getBalance();
|
|
62
|
-
if (total.gt(0)) {
|
|
63
|
-
throw new internal_1.PolymeshError({
|
|
64
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
65
|
-
message: "The `secondaryKey` can't be unlinked from the signing Identity",
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (parentDid) {
|
|
70
|
-
throw new internal_1.PolymeshError({
|
|
71
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
72
|
-
message: 'The signing Identity is already a child Identity and cannot create further child identities',
|
|
73
|
-
data: {
|
|
74
|
-
parentDid,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
-
transaction: tx.identity.createChildIdentity,
|
|
81
|
-
args: [rawChildAccount],
|
|
82
|
-
resolver: (0, exports.createChildIdentityResolver)(context),
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* @hidden
|
|
88
|
-
*/
|
|
89
|
-
function getAuthorization() {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const { storage: { identity, actingAccount }, } = this;
|
|
92
|
-
const { account: primaryAccount } = yield identity.getPrimaryAccount();
|
|
93
|
-
if (!(0, internal_2.areSameAccounts)(actingAccount, primaryAccount)) {
|
|
94
|
-
return {
|
|
95
|
-
signerPermissions: "A child Identity can only be created by an Identity's primary Account",
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
permissions: {
|
|
100
|
-
transactions: [types_1.TxTags.identity.CreateChildIdentity],
|
|
101
|
-
assets: [],
|
|
102
|
-
portfolios: [],
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @hidden
|
|
109
|
-
*/
|
|
110
|
-
function prepareStorage() {
|
|
111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const { context } = this;
|
|
113
|
-
const [identity, actingAccount] = yield Promise.all([
|
|
114
|
-
context.getSigningIdentity(),
|
|
115
|
-
context.getActingAccount(),
|
|
116
|
-
]);
|
|
117
|
-
return {
|
|
118
|
-
identity,
|
|
119
|
-
actingAccount,
|
|
120
|
-
};
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @hidden
|
|
125
|
-
*/
|
|
126
|
-
const createChildIdentity = () => new internal_1.Procedure(prepareCreateChildIdentity, getAuthorization, prepareStorage);
|
|
127
|
-
exports.createChildIdentity = createChildIdentity;
|
|
128
|
-
//# sourceMappingURL=createChildIdentity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createChildIdentity.js","sourceRoot":"","sources":["../../../src/api/procedures/createChildIdentity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAwCA,gEAiFC;AAKD,4CA0BC;AAKD,wCAkBC;AA7KD,yCAAwF;AACxF,mCAAgF;AAEhF,mDAK4B;AAC5B,+CAAkF;AAUlF;;GAEG;AACI,MAAM,2BAA2B,GACtC,CAAC,OAAgB,EAAE,EAAE,CACrB,CAAC,OAA2B,EAAiB,EAAE;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,6BAAkB,EAAC,OAAO,EAAE,UAAiB,EAAE,iBAAiB,CAAC,CAAC;IA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0BAAe,EAAC,aAAa,EAAE,cAAc,CAAC,EAAE,CAAC;YACpD,OAAO;gBACL,iBAAiB,EAAE,uEAAuE;aAC3F,CAAC;QACJ,CAAC;QAED,OAAO;YACL,WAAW,EAAE;gBACX,YAAY,EAAE,CAAC,cAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBACnD,MAAM,EAAE,EAAE;gBACV,UAAU,EAAE,EAAE;aACf;SACF,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACH,SAAsB,cAAc;;QAOlC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAClD,OAAO,CAAC,kBAAkB,EAAE;YAC5B,OAAO,CAAC,gBAAgB,EAAE;SAC3B,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ;YACR,aAAa;SACd,CAAC;IACJ,CAAC;CAAA;AAED;;GAEG;AACI,MAAM,mBAAmB,GAAG,GAIjC,EAAE,CAAC,IAAI,oBAAS,CAAC,0BAA0B,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAJpE,QAAA,mBAAmB,uBAIiD"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Identity, Procedure } from '../../internal';
|
|
2
|
-
import { Account, UnlinkChildParams } from '../../types';
|
|
3
|
-
import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from '../../types/internal';
|
|
4
|
-
/**
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
export interface Storage {
|
|
8
|
-
identity: Identity;
|
|
9
|
-
actingAccount: Account;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
export declare function prepareUnlinkChildIdentity(this: Procedure<UnlinkChildParams, void, Storage>, args: UnlinkChildParams): Promise<TransactionSpec<void, ExtrinsicParams<'identity', any>>>;
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
export declare function getAuthorization(this: Procedure<UnlinkChildParams, void, Storage>): Promise<ProcedureAuthorization>;
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
export declare function prepareStorage(this: Procedure<UnlinkChildParams, void, Storage>): Promise<Storage>;
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
export declare const unlinkChildIdentity: () => Procedure<UnlinkChildParams, void, Storage>;
|
|
27
|
-
//# sourceMappingURL=unlinkChildIdentity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unlinkChildIdentity.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/unlinkChildIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,OAAO,EAAqB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAI5F;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,EACjD,IAAI,EAAE,iBAAiB,GAEtB,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CA+ClE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,GAChD,OAAO,CAAC,sBAAsB,CAAC,CAqBjC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,GAChD,OAAO,CAAC,OAAO,CAAC,CAYlB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAO,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,OAAO,CACJ,CAAC"}
|
|
@@ -1,101 +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.unlinkChildIdentity = void 0;
|
|
13
|
-
exports.prepareUnlinkChildIdentity = prepareUnlinkChildIdentity;
|
|
14
|
-
exports.getAuthorization = getAuthorization;
|
|
15
|
-
exports.prepareStorage = prepareStorage;
|
|
16
|
-
const internal_1 = require("../../internal");
|
|
17
|
-
const types_1 = require("../../types");
|
|
18
|
-
const conversion_1 = require("../../utils/conversion");
|
|
19
|
-
const internal_2 = require("../../utils/internal");
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
function prepareUnlinkChildIdentity(args
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const { context: { polymeshApi: { tx }, }, context, storage: { identity: { did: signingDid }, }, } = this;
|
|
28
|
-
if (!context.isV7) {
|
|
29
|
-
throw new internal_1.PolymeshError({
|
|
30
|
-
code: types_1.ErrorCode.NotSupported,
|
|
31
|
-
message: 'Child identities are no longer supported in chain v8',
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const { child } = args;
|
|
35
|
-
const childIdentity = (0, internal_2.asChildIdentity)(child, context);
|
|
36
|
-
const parentIdentity = yield childIdentity.getParentDid();
|
|
37
|
-
if (!parentIdentity) {
|
|
38
|
-
throw new internal_1.PolymeshError({
|
|
39
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
40
|
-
message: "The `child` doesn't have a parent identity",
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
const { did: parentDid } = parentIdentity;
|
|
44
|
-
const { did: childDid } = childIdentity;
|
|
45
|
-
if (![parentDid, childDid].includes(signingDid)) {
|
|
46
|
-
throw new internal_1.PolymeshError({
|
|
47
|
-
code: types_1.ErrorCode.UnmetPrerequisite,
|
|
48
|
-
message: 'Only the parent or the child identity is authorized to unlink a child identity',
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
-
transaction: tx.identity.unlinkChildIdentity,
|
|
54
|
-
args: [(0, conversion_1.stringToIdentityId)(childDid, context)],
|
|
55
|
-
resolver: undefined,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
|
-
function getAuthorization() {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const { storage: { identity, actingAccount }, } = this;
|
|
65
|
-
const { account: primaryAccount } = yield identity.getPrimaryAccount();
|
|
66
|
-
if (!(0, internal_2.areSameAccounts)(actingAccount, primaryAccount)) {
|
|
67
|
-
return {
|
|
68
|
-
signerPermissions: 'Child identity can only be unlinked by primary key of either the child Identity or parent Identity',
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
permissions: {
|
|
73
|
-
transactions: [types_1.TxTags.identity.UnlinkChildIdentity],
|
|
74
|
-
assets: [],
|
|
75
|
-
portfolios: [],
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @hidden
|
|
82
|
-
*/
|
|
83
|
-
function prepareStorage() {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
const { context } = this;
|
|
86
|
-
const [identity, actingAccount] = yield Promise.all([
|
|
87
|
-
context.getSigningIdentity(),
|
|
88
|
-
context.getActingAccount(),
|
|
89
|
-
]);
|
|
90
|
-
return {
|
|
91
|
-
identity,
|
|
92
|
-
actingAccount,
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @hidden
|
|
98
|
-
*/
|
|
99
|
-
const unlinkChildIdentity = () => new internal_1.Procedure(prepareUnlinkChildIdentity, getAuthorization, prepareStorage);
|
|
100
|
-
exports.unlinkChildIdentity = unlinkChildIdentity;
|
|
101
|
-
//# sourceMappingURL=unlinkChildIdentity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unlinkChildIdentity.js","sourceRoot":"","sources":["../../../src/api/procedures/unlinkChildIdentity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,gEAmDC;AAKD,4CAuBC;AAKD,wCAcC;AAnHD,yCAAgE;AAChE,mCAAwE;AAExE,mDAAwD;AACxD,+CAAoE;AAUpE;;GAEG;AACH,SAAsB,0BAA0B,CAE9C,IAAuB;AACvB,8DAA8D;;;QAE9D,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EAAE,EAAE,EAAE,GACpB,EACD,OAAO,EACP,OAAO,EAAE,EACP,QAAQ,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,GAC9B,GACF,GAAG,IAAI,CAA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