@polymeshassociation/polymesh-sdk 20.2.0-alpha.2 → 20.2.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/api/client/AccountManagement.d.ts +1 -10
  3. package/api/client/AccountManagement.d.ts.map +1 -1
  4. package/api/client/AccountManagement.js +0 -1
  5. package/api/client/AccountManagement.js.map +1 -1
  6. package/api/client/Identities.d.ts +2 -22
  7. package/api/client/Identities.d.ts.map +1 -1
  8. package/api/client/Identities.js +0 -2
  9. package/api/client/Identities.js.map +1 -1
  10. package/api/entities/Portfolio/index.d.ts.map +1 -1
  11. package/api/entities/Portfolio/index.js +5 -3
  12. package/api/entities/Portfolio/index.js.map +1 -1
  13. package/api/procedures/types.d.ts +1 -35
  14. package/api/procedures/types.d.ts.map +1 -1
  15. package/api/procedures/types.js.map +1 -1
  16. package/internal.d.ts +0 -3
  17. package/internal.d.ts.map +1 -1
  18. package/internal.js +3 -9
  19. package/internal.js.map +1 -1
  20. package/npm-package/polymeshassociation-polymesh-sdk-20.2.0-beta.2.tgz +0 -0
  21. package/package.json +4 -4
  22. package/types/index.d.ts +2 -6
  23. package/types/index.d.ts.map +1 -1
  24. package/types/index.js.map +1 -1
  25. package/utils/conversion.d.ts +0 -4
  26. package/utils/conversion.d.ts.map +1 -1
  27. package/utils/conversion.js +3 -21
  28. package/utils/conversion.js.map +1 -1
  29. package/api/procedures/acceptPrimaryKeyRotation.d.ts +0 -28
  30. package/api/procedures/acceptPrimaryKeyRotation.d.ts.map +0 -1
  31. package/api/procedures/acceptPrimaryKeyRotation.js +0 -92
  32. package/api/procedures/acceptPrimaryKeyRotation.js.map +0 -1
  33. package/api/procedures/attestPrimaryKeyRotation.d.ts +0 -12
  34. package/api/procedures/attestPrimaryKeyRotation.d.ts.map +0 -1
  35. package/api/procedures/attestPrimaryKeyRotation.js +0 -72
  36. package/api/procedures/attestPrimaryKeyRotation.js.map +0 -1
  37. package/api/procedures/rotatePrimaryKey.d.ts +0 -12
  38. package/api/procedures/rotatePrimaryKey.d.ts.map +0 -1
  39. package/api/procedures/rotatePrimaryKey.js +0 -68
  40. package/api/procedures/rotatePrimaryKey.js.map +0 -1
  41. package/npm-package/polymeshassociation-polymesh-sdk-20.2.0-alpha.2.tgz +0 -0
@@ -1,72 +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.attestPrimaryKeyRotation = exports.prepareAttestPrimaryKeyRotation = void 0;
13
- const utils_1 = require("./utils");
14
- const internal_1 = require("../../internal");
15
- const types_1 = require("../../types");
16
- const conversion_1 = require("../../utils/conversion");
17
- const internal_2 = require("../../utils/internal");
18
- /**
19
- * @hidden
20
- */
21
- function prepareAttestPrimaryKeyRotation(args) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const { context: { polymeshApi: { tx: { identity: { addAuthorization }, }, }, }, context, } = this;
24
- const { targetAccount, identity, expiry } = args;
25
- const issuerIdentity = yield context.getSigningIdentity();
26
- const target = (0, internal_2.asAccount)(targetAccount, context);
27
- const targetIdentity = (0, internal_2.asIdentity)(identity, context);
28
- const authorizationRequests = yield target.authorizations.getReceived({
29
- type: types_1.AuthorizationType.AttestPrimaryKeyRotation,
30
- includeExpired: false,
31
- });
32
- const pendingAuthorization = authorizationRequests.find(authorizationRequest => {
33
- const { value } = authorizationRequest.data;
34
- return value.did === targetIdentity.did;
35
- });
36
- if (pendingAuthorization) {
37
- throw new internal_1.PolymeshError({
38
- code: types_1.ErrorCode.NoDataChange,
39
- message: 'The target Account already has a pending attestation to become the primary key of the target Identity',
40
- data: {
41
- pendingAuthorization,
42
- },
43
- });
44
- }
45
- const rawSignatory = (0, conversion_1.signerToSignatory)(target, context);
46
- const authRequest = {
47
- type: types_1.AuthorizationType.AttestPrimaryKeyRotation,
48
- value: targetIdentity,
49
- };
50
- const rawAuthorizationData = (0, conversion_1.authorizationToAuthorizationData)(authRequest, context);
51
- const rawExpiry = (0, conversion_1.expiryToMoment)(expiry, context);
52
- return {
53
- transaction: addAuthorization,
54
- args: [rawSignatory, rawAuthorizationData, rawExpiry],
55
- resolver: (0, utils_1.createAuthorizationResolver)(authRequest, issuerIdentity, target, expiry !== null && expiry !== void 0 ? expiry : null, context),
56
- };
57
- });
58
- }
59
- exports.prepareAttestPrimaryKeyRotation = prepareAttestPrimaryKeyRotation;
60
- /**
61
- * @hidden
62
- */
63
- const attestPrimaryKeyRotation = () => new internal_1.Procedure(prepareAttestPrimaryKeyRotation, {
64
- roles: [{ type: types_1.RoleType.CddProvider }],
65
- permissions: {
66
- assets: [],
67
- portfolios: [],
68
- transactions: [types_1.TxTags.identity.AddAuthorization],
69
- },
70
- });
71
- exports.attestPrimaryKeyRotation = attestPrimaryKeyRotation;
72
- //# sourceMappingURL=attestPrimaryKeyRotation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attestPrimaryKeyRotation.js","sourceRoot":"","sources":["../../../src/api/procedures/attestPrimaryKeyRotation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAqE;AACrE,6CAAsD;AACtD,uCASiB;AAEjB,uDAI4B;AAC5B,mDAAyD;AAEzD;;GAEG;AACH,SAAsB,+BAA+B,CAEnD,IAAoC;;QAEpC,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,EAAE,EAAE,EACF,QAAQ,EAAE,EAAE,gBAAgB,EAA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D,OAAO;YACL,WAAW,EAAE,gBAAgB;YAC7B,IAAI,EAAE,CAAC,YAAY,EAAE,oBAAoB,EAAE,SAAS,CAAC;YACrD,QAAQ,EAAE,IAAA,mCAA2B,EACnC,WAAW,EACX,cAAc,EACd,MAAM,EACN,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,EACd,OAAO,CACR;SACF,CAAC;IACJ,CAAC;CAAA;AA9DD,0EA8DC;AAED;;GAEG;AACI,MAAM,wBAAwB,GAAG,GAGtC,EAAE,CACF,IAAI,oBAAS,CAAC,+BAA+B,EAAE;IAC7C,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAQ,CAAC,WAAW,EAAE,CAAC;IACvC,WAAW,EAAE;QACX,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,CAAC,cAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC;KACjD;CACF,CAAC,CAAC;AAXQ,QAAA,wBAAwB,4BAWhC"}
@@ -1,12 +0,0 @@
1
- import { Procedure } from "../../internal";
2
- import { AuthorizationRequest, RotatePrimaryKeyParams } from "../../types";
3
- import { ExtrinsicParams, TransactionSpec } from "../../types/internal";
4
- /**
5
- * @hidden
6
- */
7
- export declare function prepareRotatePrimaryKey(this: Procedure<RotatePrimaryKeyParams, AuthorizationRequest>, args: RotatePrimaryKeyParams): Promise<TransactionSpec<AuthorizationRequest, ExtrinsicParams<'identity', 'addAuthorization'>>>;
8
- /**
9
- * @hidden
10
- */
11
- export declare const rotatePrimaryKey: () => Procedure<RotatePrimaryKeyParams, AuthorizationRequest>;
12
- //# sourceMappingURL=rotatePrimaryKey.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rotatePrimaryKey.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/rotatePrimaryKey.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAE,uBAAmB;AACtD,OAAO,EAEL,oBAAoB,EAGpB,sBAAsB,EAEvB,oBAAgB;AACjB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,6BAAyB;AASpE;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,SAAS,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,EAC7D,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,eAAe,CAAC,oBAAoB,EAAE,eAAe,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC,CA8DjG;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,UAAU,sBAAsB,EAAE,oBAAoB,CAOtF,CAAC"}
@@ -1,68 +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.rotatePrimaryKey = exports.prepareRotatePrimaryKey = void 0;
13
- const utils_1 = require("./utils");
14
- const internal_1 = require("../../internal");
15
- const types_1 = require("../../types");
16
- const conversion_1 = require("../../utils/conversion");
17
- const internal_2 = require("../../utils/internal");
18
- /**
19
- * @hidden
20
- */
21
- function prepareRotatePrimaryKey(args) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const { context: { polymeshApi: { tx: { identity: { addAuthorization }, }, }, }, context, } = this;
24
- const { targetAccount, expiry } = args;
25
- const issuerIdentity = yield context.getSigningIdentity();
26
- const target = (0, internal_2.asAccount)(targetAccount, context);
27
- const authorizationRequests = yield issuerIdentity.authorizations.getSent();
28
- const pendingAuthorization = authorizationRequests.data.find(authorizationRequest => {
29
- const { target: targetSigner, data: { type }, } = authorizationRequest;
30
- return ((0, conversion_1.signerToString)(targetSigner) === targetAccount &&
31
- !authorizationRequest.isExpired() &&
32
- type === types_1.AuthorizationType.RotatePrimaryKey);
33
- });
34
- if (pendingAuthorization) {
35
- throw new internal_1.PolymeshError({
36
- code: types_1.ErrorCode.NoDataChange,
37
- message: 'The target Account already has a pending invitation to become the primary key of the given Identity',
38
- data: {
39
- pendingAuthorization,
40
- },
41
- });
42
- }
43
- const rawSignatory = (0, conversion_1.signerToSignatory)(target, context);
44
- const authorization = {
45
- type: types_1.AuthorizationType.RotatePrimaryKey,
46
- };
47
- const rawAuthorizationData = (0, conversion_1.authorizationToAuthorizationData)(authorization, context);
48
- const rawExpiry = (0, conversion_1.expiryToMoment)(expiry, context);
49
- return {
50
- transaction: addAuthorization,
51
- args: [rawSignatory, rawAuthorizationData, rawExpiry],
52
- resolver: (0, utils_1.createAuthorizationResolver)(authorization, issuerIdentity, target, expiry !== null && expiry !== void 0 ? expiry : null, context),
53
- };
54
- });
55
- }
56
- exports.prepareRotatePrimaryKey = prepareRotatePrimaryKey;
57
- /**
58
- * @hidden
59
- */
60
- const rotatePrimaryKey = () => new internal_1.Procedure(prepareRotatePrimaryKey, {
61
- permissions: {
62
- assets: [],
63
- portfolios: [],
64
- transactions: [types_1.TxTags.identity.AddAuthorization],
65
- },
66
- });
67
- exports.rotatePrimaryKey = rotatePrimaryKey;
68
- //# sourceMappingURL=rotatePrimaryKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rotatePrimaryKey.js","sourceRoot":"","sources":["../../../src/api/procedures/rotatePrimaryKey.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAqE;AACrE,6CAAsD;AACtD,uCAOiB;AAEjB,uDAK4B;AAC5B,mDAA6C;AAE7C;;GAEG;AACH,SAAsB,uBAAuB,CAE3C,IAA4B;;QAE5B,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,EAAE,EAAE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