@polymeshassociation/polymesh-sdk 20.1.0 → 20.2.0-alpha.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/CHANGELOG.md +2 -10
- package/api/client/AccountManagement.d.ts +10 -1
- package/api/client/AccountManagement.d.ts.map +1 -1
- package/api/client/AccountManagement.js +1 -0
- package/api/client/AccountManagement.js.map +1 -1
- package/api/client/Identities.d.ts +22 -2
- package/api/client/Identities.d.ts.map +1 -1
- package/api/client/Identities.js +2 -0
- package/api/client/Identities.js.map +1 -1
- package/api/procedures/acceptPrimaryKeyRotation.d.ts +28 -0
- package/api/procedures/acceptPrimaryKeyRotation.d.ts.map +1 -0
- package/api/procedures/acceptPrimaryKeyRotation.js +92 -0
- package/api/procedures/acceptPrimaryKeyRotation.js.map +1 -0
- package/api/procedures/attestPrimaryKeyRotation.d.ts +12 -0
- package/api/procedures/attestPrimaryKeyRotation.d.ts.map +1 -0
- package/api/procedures/attestPrimaryKeyRotation.js +72 -0
- package/api/procedures/attestPrimaryKeyRotation.js.map +1 -0
- package/api/procedures/rotatePrimaryKey.d.ts +12 -0
- package/api/procedures/rotatePrimaryKey.d.ts.map +1 -0
- package/api/procedures/rotatePrimaryKey.js +68 -0
- package/api/procedures/rotatePrimaryKey.js.map +1 -0
- package/api/procedures/setTransferRestrictions.d.ts +10 -1
- package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
- package/api/procedures/setTransferRestrictions.js +11 -9
- package/api/procedures/setTransferRestrictions.js.map +1 -1
- package/api/procedures/types.d.ts +35 -1
- package/api/procedures/types.d.ts.map +1 -1
- package/api/procedures/types.js.map +1 -1
- package/base/Context.d.ts.map +1 -1
- package/base/Context.js +38 -108
- package/base/Context.js.map +1 -1
- package/base/utils.d.ts +4 -0
- package/base/utils.d.ts.map +1 -0
- package/base/utils.js +85 -0
- package/base/utils.js.map +1 -0
- package/internal.d.ts +3 -0
- package/internal.d.ts.map +1 -1
- package/internal.js +10 -3
- package/internal.js.map +1 -1
- package/middleware/enumsV2.d.ts.map +1 -1
- package/middleware/enumsV2.js +1 -0
- package/middleware/enumsV2.js.map +1 -1
- package/npm-package/polymeshassociation-polymesh-sdk-20.2.0-alpha.2.tgz +0 -0
- package/package.json +4 -4
- package/types/index.d.ts +7 -2
- package/types/index.d.ts.map +1 -1
- package/types/index.js.map +1 -1
- package/utils/conversion.d.ts +4 -0
- package/utils/conversion.d.ts.map +1 -1
- package/utils/conversion.js +29 -9
- package/utils/conversion.js.map +1 -1
- package/npm-package/polymeshassociation-polymesh-sdk-20.1.0.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
# [20.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* 🐛 `next` field for ResultSet when size is not provided ([#962](https://github.com/PolymeshAssociation/polymesh-sdk/issues/962)) ([917fdf2](https://github.com/PolymeshAssociation/polymesh-sdk/commit/917fdf2772c22a58bc22434d575798d75ba8cb41))
|
|
7
|
-
* 🐛 Allows to affirm or reject failed instructions ([f18a8b6](https://github.com/PolymeshAssociation/polymesh-sdk/commit/f18a8b60492e42e40bdab6861e0540c1e01f956f))
|
|
8
|
-
* 🐛 multisig.getIdentity to return associated Identity ([#963](https://github.com/PolymeshAssociation/polymesh-sdk/issues/963)) ([584c2ba](https://github.com/PolymeshAssociation/polymesh-sdk/commit/584c2ba89a98cfd12620dcf271574c78f54a6161))
|
|
9
|
-
* 🐛 Ordering of data returned by Middleware V2 ([a18b893](https://github.com/PolymeshAssociation/polymesh-sdk/commit/a18b8936437cfc77db724544ac191564b3f5f6b5))
|
|
1
|
+
# [20.2.0-alpha.2](https://github.com/PolymeshAssociation/polymesh-sdk/compare/v20.2.0-alpha.1...v20.2.0-alpha.2) (2023-05-22)
|
|
10
2
|
|
|
11
3
|
|
|
12
4
|
### Features
|
|
13
5
|
|
|
14
|
-
* 🎸
|
|
6
|
+
* 🎸 Add procedures to rotate primary key ([044d5e9](https://github.com/PolymeshAssociation/polymesh-sdk/commit/044d5e91f9c579a9449e9c8446bcef4cb567a117))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MultiSig } from "../entities/Account/MultiSig";
|
|
2
2
|
import { Account, AuthorizationRequest, Context, Subsidy } from "../../internal";
|
|
3
|
-
import { AccountBalance, CreateMultiSigParams, InviteAccountParams, ModifySignerPermissionsParams, NoArgsProcedureMethod, ProcedureMethod, RemoveSecondaryAccountsParams, SubCallback, SubsidizeAccountParams, UnsubCallback } from "../../types";
|
|
3
|
+
import { AcceptPrimaryKeyRotationParams, AccountBalance, CreateMultiSigParams, InviteAccountParams, ModifySignerPermissionsParams, NoArgsProcedureMethod, ProcedureMethod, RemoveSecondaryAccountsParams, SubCallback, SubsidizeAccountParams, UnsubCallback } from "../../types";
|
|
4
4
|
/**
|
|
5
5
|
* Handles functionality related to Account Management
|
|
6
6
|
*/
|
|
@@ -107,5 +107,14 @@ export declare class AccountManagement {
|
|
|
107
107
|
isValidAddress(args: {
|
|
108
108
|
address: string;
|
|
109
109
|
}): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Accepts the authorization to become the new primary key of the issuing identity.
|
|
112
|
+
*
|
|
113
|
+
* If a CDD service provider approved this change (or this is not required), primary key of the Identity is updated.
|
|
114
|
+
*
|
|
115
|
+
* @note The caller (new primary key) must be either a secondary key of the issuing identity, or
|
|
116
|
+
* unlinked to any identity.
|
|
117
|
+
*/
|
|
118
|
+
acceptPrimaryKey: ProcedureMethod<AcceptPrimaryKeyRotationParams, void>;
|
|
110
119
|
}
|
|
111
120
|
//# sourceMappingURL=AccountManagement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountManagement.d.ts","sourceRoot":"","sources":["../../../src/api/client/AccountManagement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,qCAAwC;AAC3D,OAAO,
|
|
1
|
+
{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OAMG;IACI,iBAAiB,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAChF,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAChF,iBAAiB,CACtB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,EACnC,QAAQ,EAAE,WAAW,CAAC,cAAc,CAAC,GACpC,OAAO,CAAC,aAAa,CAAC;IAsCzB;;OAEG;IACU,UAAU,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,GAAG,QAAQ,CAAC;IAmB/E;;OAEG;IACI,iBAAiB,IAAI,OAAO,GAAG,IAAI;IAQ1C;;;;OAIG;IACU,kBAAkB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAIrD;;OAEG;IACI,UAAU,CAAC,IAAI,EAAE;QACtB,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAC9B,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;KAC9B,GAAG,OAAO;IAWX;;OAEG;IACI,cAAc,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO;IAUzD;;;;;;;OAOG;IACI,gBAAgB,EAAE,eAAe,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;CAChF"}
|
|
@@ -56,6 +56,7 @@ class AccountManagement {
|
|
|
56
56
|
}, context);
|
|
57
57
|
this.subsidizeAccount = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.subsidizeAccount, Object.assign({}, args)] }, context);
|
|
58
58
|
this.createMultiSigAccount = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.createMultiSigAccount, args] }, context);
|
|
59
|
+
this.acceptPrimaryKey = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.acceptPrimaryKeyRotation, args] }, context);
|
|
59
60
|
}
|
|
60
61
|
// eslint-disable-next-line require-jsdoc
|
|
61
62
|
getAccountBalance(args, callback) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountManagement.js","sourceRoot":"","sources":["../../../src/api/client/AccountManagement.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"AccountManagement.js","sourceRoot":"","sources":["../../../src/api/client/AccountManagement.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAA2D;AAC3D,6CAcoB;AACpB,uCAaiB;AACjB,uDAAuD;AACvD,mDAAwF;AAExF;;GAEG;AACH,MAAa,iBAAiB;IAG5B;;OAEG;IACH,YAAY,OAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,aAAa,GAAG,IAAA,gCAAqB,EACxC,EAAE,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC,wBAAa,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EACzE,OAAO,CACR,CAAC;QACF,IAAI,CAAC,uBAAuB,GAAG,IAAA,gCAAqB,EAClD;YACE,mBAAmB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kCAAuB,oBAAO,IAAI,EAAG;SACpE,EACD,OAAO,CACR,CAAC;QACF,IAAI,CAAC,iBAAiB,GAAG,IAAA,gCAAqB,EAM5C;YACE,mBAAmB,EAAE,IAAI,CAAC,EAAE;gBAC1B,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;gBACnC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;oBAC/C,OAAO;wBACL,OAAO;wBACP,WAAW,EAAE;4BACX,MAAM,EAAE,EAAE,IAAI,EAAE,sBAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE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AAO,CAAC,UAAU,CAAC,CAAC;SAC3D;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,KAAK,CAAC;SACd;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CAWF;AA/QD,8CA+QC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Context, Identity, NumberedPortfolio } from "../../internal";
|
|
2
|
-
import { ProcedureMethod, RegisterIdentityParams } from "../../types";
|
|
1
|
+
import { AuthorizationRequest, Context, Identity, NumberedPortfolio } from "../../internal";
|
|
2
|
+
import { AttestPrimaryKeyRotationParams, ProcedureMethod, RegisterIdentityParams, RotatePrimaryKeyParams } from "../../types";
|
|
3
3
|
/**
|
|
4
4
|
* Handles all Identity related functionality
|
|
5
5
|
*/
|
|
@@ -21,6 +21,26 @@ export declare class Identities {
|
|
|
21
21
|
* - Customer Due Diligence Provider
|
|
22
22
|
*/
|
|
23
23
|
registerIdentity: ProcedureMethod<RegisterIdentityParams, Identity>;
|
|
24
|
+
/**
|
|
25
|
+
* Get CDD Provider's attestation to change primary key
|
|
26
|
+
*
|
|
27
|
+
* @note the transaction signer must be a CDD provider
|
|
28
|
+
* @note this creates an {@link api/entities/AuthorizationRequest!AuthorizationRequest | Authorization Requests} which have to be accepted by the `targetAccount` along with the authorization for `RotatingPrimaryKey`.
|
|
29
|
+
* An {@link api/entities/Account!Account} or {@link api/entities/Identity!Identity} can fetch its pending Authorization Requests by calling {@link api/entities/common/namespaces/Authorizations!Authorizations.getReceived | authorizations.getReceived}.
|
|
30
|
+
* Also, an Account or Identity can directly fetch the details of an Authorization Request by calling {@link api/entities/common/namespaces/Authorizations!Authorizations.getOne | authorizations.getOne}
|
|
31
|
+
*
|
|
32
|
+
* @note required role:
|
|
33
|
+
* - Customer Due Diligence Provider
|
|
34
|
+
*/
|
|
35
|
+
attestPrimaryKeyRotation: ProcedureMethod<AttestPrimaryKeyRotationParams, AuthorizationRequest>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates an Authorization to rotate primary key of the signing Identity by the `targetAccount`
|
|
38
|
+
*
|
|
39
|
+
* @note this creates an {@link api/entities/AuthorizationRequest!AuthorizationRequest | Authorization Requests} which have to be accepted by the `targetAccount` along with the optional CDD authorization generated by CDD provider attesting the rotation of primary key
|
|
40
|
+
* An {@link api/entities/Account!Account} or {@link api/entities/Identity!Identity} can fetch its pending Authorization Requests by calling {@link api/entities/common/namespaces/Authorizations!Authorizations.getReceived | authorizations.getReceived}.
|
|
41
|
+
* Also, an Account or Identity can directly fetch the details of an Authorization Request by calling {@link api/entities/common/namespaces/Authorizations!Authorizations.getOne | authorizations.getOne}
|
|
42
|
+
*/
|
|
43
|
+
rotatePrimaryKey: ProcedureMethod<RotatePrimaryKeyParams, AuthorizationRequest>;
|
|
24
44
|
/**
|
|
25
45
|
* Create a new Portfolio under the ownership of the signing Identity
|
|
26
46
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Identities.d.ts","sourceRoot":"","sources":["../../../src/api/client/Identities.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Identities.d.ts","sourceRoot":"","sources":["../../../src/api/client/Identities.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,oBAAoB,EACpB,OAAO,EAEP,QAAQ,EACR,iBAAiB,EAGlB,uBAAmB;AACpB,OAAO,EACL,8BAA8B,EAC9B,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACvB,oBAAgB;AAGjB;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAU;IAEzB;;OAEG;gBACS,OAAO,EAAE,OAAO;IA4C5B;;;;;;;;;;OAUG;IACI,gBAAgB,EAAE,eAAe,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;IAE3E;;;;;;;;;;OAUG;IACI,wBAAwB,EAAE,eAAe,CAC9C,8BAA8B,EAC9B,oBAAoB,CACrB,CAAC;IAEF;;;;;;OAMG;IACI,gBAAgB,EAAE,eAAe,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;IAEvF;;OAEG;IACI,eAAe,EAAE,eAAe,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,iBAAiB,EAAE,EAAE,iBAAiB,CAAC,CAAC;IAElG;;OAEG;IACI,gBAAgB,EAAE,eAAe,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAEnF;;;;OAIG;IACI,WAAW,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI5D;;OAEG;IACI,eAAe,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAGhF"}
|
package/api/client/Identities.js
CHANGED
|
@@ -14,6 +14,8 @@ class Identities {
|
|
|
14
14
|
constructor(context) {
|
|
15
15
|
this.context = context;
|
|
16
16
|
this.registerIdentity = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.registerIdentity, args] }, context);
|
|
17
|
+
this.attestPrimaryKeyRotation = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.attestPrimaryKeyRotation, args] }, context);
|
|
18
|
+
this.rotatePrimaryKey = (0, internal_2.createProcedureMethod)({ getProcedureAndArgs: args => [internal_1.rotatePrimaryKey, args] }, context);
|
|
17
19
|
this.createPortfolio = (0, internal_2.createProcedureMethod)({
|
|
18
20
|
getProcedureAndArgs: args => [
|
|
19
21
|
internal_1.createPortfolios,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Identities.js","sourceRoot":"","sources":["../../../src/api/client/Identities.ts"],"names":[],"mappings":";;;AAAA,6CAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"Identities.js","sourceRoot":"","sources":["../../../src/api/client/Identities.ts"],"names":[],"mappings":";;;AAAA,6CAAkE;AACl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,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;CACF;AAjHD,gCAiHC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AuthorizationRequest, Procedure } from "../../internal";
|
|
2
|
+
import { AcceptPrimaryKeyRotationParams } from "../../types";
|
|
3
|
+
import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from "../../types/internal";
|
|
4
|
+
/**
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
export interface Storage {
|
|
8
|
+
calledByTarget: boolean;
|
|
9
|
+
ownerAuthRequest: AuthorizationRequest;
|
|
10
|
+
cddAuthRequest?: AuthorizationRequest;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export declare function prepareAcceptPrimaryKeyRotation(this: Procedure<AcceptPrimaryKeyRotationParams, void, Storage>): Promise<TransactionSpec<void, ExtrinsicParams<'identity', 'acceptPrimaryKey'>>>;
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export declare function getAuthorization(this: Procedure<AcceptPrimaryKeyRotationParams, void, Storage>): Promise<ProcedureAuthorization>;
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
export declare function prepareStorage(this: Procedure<AcceptPrimaryKeyRotationParams, void, Storage>, { ownerAuth, cddAuth }: AcceptPrimaryKeyRotationParams): Promise<Storage>;
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export declare const acceptPrimaryKeyRotation: () => Procedure<AcceptPrimaryKeyRotationParams, void, Storage>;
|
|
28
|
+
//# sourceMappingURL=acceptPrimaryKeyRotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acceptPrimaryKeyRotation.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/acceptPrimaryKeyRotation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,uBAAmB;AAC7D,OAAO,EAAE,8BAA8B,EAAqB,oBAAgB;AAC5E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,6BAAyB;AAI5F;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC;AAED;;GAEG;AACH,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,SAAS,CAAC,8BAA8B,EAAE,IAAI,EAAE,OAAO,CAAC,GAC7D,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC,CA4BjF;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,SAAS,CAAC,8BAA8B,EAAE,IAAI,EAAE,OAAO,CAAC,GAC7D,OAAO,CAAC,sBAAsB,CAAC,CAUjC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,SAAS,CAAC,8BAA8B,EAAE,IAAI,EAAE,OAAO,CAAC,EAC9D,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,8BAA8B,GACrD,OAAO,CAAC,OAAO,CAAC,CA6BlB;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAO,UAC1C,8BAA8B,EAC9B,IAAI,EACJ,OAAO,CAC4E,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.acceptPrimaryKeyRotation = exports.prepareStorage = exports.getAuthorization = exports.prepareAcceptPrimaryKeyRotation = void 0;
|
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
|
+
const internal_1 = require("../../internal");
|
|
19
|
+
const types_1 = require("../../types");
|
|
20
|
+
const conversion_1 = require("../../utils/conversion");
|
|
21
|
+
const internal_2 = require("../../utils/internal");
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
function prepareAcceptPrimaryKeyRotation() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { context: { polymeshApi: { tx: { identity }, }, }, storage: { ownerAuthRequest, cddAuthRequest }, context, } = this;
|
|
28
|
+
const validationPromises = [(0, utils_1.assertAuthorizationRequestValid)(ownerAuthRequest, context)];
|
|
29
|
+
if (cddAuthRequest) {
|
|
30
|
+
validationPromises.push((0, utils_1.assertAuthorizationRequestValid)(cddAuthRequest, context));
|
|
31
|
+
}
|
|
32
|
+
yield Promise.all(validationPromises);
|
|
33
|
+
const { authId: ownerAuthId, issuer } = ownerAuthRequest;
|
|
34
|
+
return {
|
|
35
|
+
transaction: identity.acceptPrimaryKey,
|
|
36
|
+
paidForBy: issuer,
|
|
37
|
+
args: [
|
|
38
|
+
(0, conversion_1.bigNumberToU64)(ownerAuthId, context),
|
|
39
|
+
(0, internal_2.optionize)(conversion_1.bigNumberToU64)(cddAuthRequest === null || cddAuthRequest === void 0 ? void 0 : cddAuthRequest.authId, context),
|
|
40
|
+
],
|
|
41
|
+
resolver: undefined,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.prepareAcceptPrimaryKeyRotation = prepareAcceptPrimaryKeyRotation;
|
|
46
|
+
/**
|
|
47
|
+
* @hidden
|
|
48
|
+
*/
|
|
49
|
+
function getAuthorization() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const { storage: { calledByTarget }, } = this;
|
|
52
|
+
return {
|
|
53
|
+
roles: calledByTarget ||
|
|
54
|
+
`"${types_1.AuthorizationType.RotatePrimaryKey}" Authorization Requests must be accepted by the target Account`,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.getAuthorization = getAuthorization;
|
|
59
|
+
/**
|
|
60
|
+
* @hidden
|
|
61
|
+
*/
|
|
62
|
+
function prepareStorage({ ownerAuth, cddAuth }) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const { context } = this;
|
|
65
|
+
const signingAccount = context.getSigningAccount();
|
|
66
|
+
const getAuthRequest = (auth) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
if (auth && auth instanceof bignumber_js_1.default) {
|
|
68
|
+
return signingAccount.authorizations.getOne({ id: auth });
|
|
69
|
+
}
|
|
70
|
+
return auth;
|
|
71
|
+
});
|
|
72
|
+
const ownerAuthRequest = yield getAuthRequest(ownerAuth);
|
|
73
|
+
let calledByTarget = signingAccount.isEqual(ownerAuthRequest.target);
|
|
74
|
+
let cddAuthRequest;
|
|
75
|
+
if (cddAuth) {
|
|
76
|
+
cddAuthRequest = yield getAuthRequest(cddAuth);
|
|
77
|
+
calledByTarget = calledByTarget && signingAccount.isEqual(cddAuthRequest.target);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
calledByTarget,
|
|
81
|
+
ownerAuthRequest,
|
|
82
|
+
cddAuthRequest,
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.prepareStorage = prepareStorage;
|
|
87
|
+
/**
|
|
88
|
+
* @hidden
|
|
89
|
+
*/
|
|
90
|
+
const acceptPrimaryKeyRotation = () => new internal_1.Procedure(prepareAcceptPrimaryKeyRotation, getAuthorization, prepareStorage);
|
|
91
|
+
exports.acceptPrimaryKeyRotation = acceptPrimaryKeyRotation;
|
|
92
|
+
//# sourceMappingURL=acceptPrimaryKeyRotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acceptPrimaryKeyRotation.js","sourceRoot":"","sources":["../../../src/api/procedures/acceptPrimaryKeyRotation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AAErC,mCAAyE;AACzE,6CAA6D;AAC7D,uCAA4E;AAE5E,uDAAoD;AACpD,mDAA6C;AAW7C;;GAEG;AACH,SAAsB,+BAA+B;;QAGnD,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,EAAE,EAAE,EAAE,QAAQ,EAAE,GACjB,GACF,EACD,OAAO,EAAE,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAC7C,OAAO,GACR,GAAG,IAAI,CAAC;QAET,MAAM,kBAAkB,GAAG,CAAC,IAAA,uCAA+B,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;QACxF,IAAI,cAAc,EAAE;YAClB,kBAAkB,CAAC,IAAI,CAAC,IAAA,uCAA+B,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;SACnF;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAEtC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC;QACzD,OAAO;YACL,WAAW,EAAE,QAAQ,CAAC,gBAAgB;YACtC,SAAS,EAAE,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AAC;SAClF;QAED,OAAO;YACL,cAAc;YACd,gBAAgB;YAChB,cAAc;SACf,CAAC;IACJ,CAAC;CAAA;AAhCD,wCAgCC;AAED;;GAEG;AACI,MAAM,wBAAwB,GAAG,GAItC,EAAE,CAAC,IAAI,oBAAS,CAAC,+BAA+B,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAJzE,QAAA,wBAAwB,4BAIiD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Procedure } from "../../internal";
|
|
2
|
+
import { AttestPrimaryKeyRotationParams, AuthorizationRequest } from "../../types";
|
|
3
|
+
import { ExtrinsicParams, TransactionSpec } from "../../types/internal";
|
|
4
|
+
/**
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
export declare function prepareAttestPrimaryKeyRotation(this: Procedure<AttestPrimaryKeyRotationParams, AuthorizationRequest>, args: AttestPrimaryKeyRotationParams): Promise<TransactionSpec<AuthorizationRequest, ExtrinsicParams<'identity', 'addAuthorization'>>>;
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare const attestPrimaryKeyRotation: () => Procedure<AttestPrimaryKeyRotationParams, AuthorizationRequest>;
|
|
12
|
+
//# sourceMappingURL=attestPrimaryKeyRotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attestPrimaryKeyRotation.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/attestPrimaryKeyRotation.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAE,uBAAmB;AACtD,OAAO,EAEL,8BAA8B,EAE9B,oBAAoB,EAKrB,oBAAgB;AACjB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,6BAAyB;AAQpE;;GAEG;AACH,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,SAAS,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,EACrE,IAAI,EAAE,8BAA8B,GACnC,OAAO,CAAC,eAAe,CAAC,oBAAoB,EAAE,eAAe,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC,CA2DjG;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAO,UAC1C,8BAA8B,EAC9B,oBAAoB,CASlB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,GAC/B,GACF,GACF,EACD,OAAO,GACR,GAAG,IAAI,CAAC;QACT,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAEjD,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAE1D,MAAM,MAAM,GAAG,IAAA,oBAAS,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACjD,MAAM,cAAc,GAAG,IAAA,qBAAU,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAErD,MAAM,qBAAqB,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC;YACpE,IAAI,EAAE,yBAAiB,CAAC,wBAAwB;YAChD,cAAc,EAAE,KAAK;SACtB,CAAC,CAAC;QAEH,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE;YAC7E,MAAM,EAAE,KAAK,EAAE,GAAG,oBAAoB,CAAC,IAAiD,CAAC;YACzF,OAAO,KAAK,CAAC,GAAG,K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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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;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AG,IAAA,2BAAc,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAElD,OAAO;YACL,WAAW,EAAE,gBAAgB;YAC7B,IAAI,EAAE,CAAC,YAAY,EAAE,oBAAoB,EAAE,SAAS,CAAC;YACrD,QAAQ,EAAE,IAAA,mCAA2B,EACnC,aAAa,EACb,cAAc,EACd,MAAM,EACN,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,EACd,OAAO,CACR;SACF,CAAC;IACJ,CAAC;CAAA;AAjED,0DAiEC;AAED;;GAEG;AACI,MAAM,gBAAgB,GAAG,GAA4D,EAAE,CAC5F,IAAI,oBAAS,CAAC,uBAAuB,EAAE;IACrC,WAAW,EAAE;QACX,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,CAAC,cAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC;KACjD;CACF,CAAC,CAAC;AAPQ,QAAA,gBAAgB,oBAOxB"}
|
|
@@ -8,7 +8,16 @@ import { BatchTransactionSpec, ProcedureAuthorization } from "../../types/intern
|
|
|
8
8
|
* @hidden
|
|
9
9
|
*/
|
|
10
10
|
declare type ClaimKey = StatClaimType | 'None';
|
|
11
|
-
declare type ExemptionRecords = Record<ClaimKey, Identity[]>;
|
|
11
|
+
export declare type ExemptionRecords = Record<ClaimKey, Identity[]>;
|
|
12
|
+
export declare const newExemptionRecord: () => ExemptionRecords;
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
* @param toInsertId - Identity to insert into the exemption records
|
|
16
|
+
* @param exemptionRecords - records that will be mutated if the Identity should be added
|
|
17
|
+
* @param claimType - type of Claim the Identity is exempt from
|
|
18
|
+
* @param filterSet - set of Identities that should not be added into exemption records if given
|
|
19
|
+
*/
|
|
20
|
+
export declare const addExemptionIfNotPresent: (toInsertId: Identity, exemptionRecords: ExemptionRecords, claimType: ClaimKey, filterSet?: Identity[]) => void;
|
|
12
21
|
export interface Storage {
|
|
13
22
|
currentRestrictions: PolymeshPrimitivesTransferComplianceTransferCondition[];
|
|
14
23
|
currentExemptions: ExemptionRecords;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setTransferRestrictions.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/setTransferRestrictions.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,qDAAqD,EAEtD,uCAA+B;AAChC,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,EAAE,6BAA6B,EAAE,uEAA0E;AAClH,OAAO,EAAkB,QAAQ,EAAiB,SAAS,EAAE,uBAAmB;AAChF,OAAO,EAUL,aAAa,EAKd,oBAAgB;AACjB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,6BAAyB;AAqBhF;;GAEG;AAEH,aAAK,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AACvC,
|
|
1
|
+
{"version":3,"file":"setTransferRestrictions.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/setTransferRestrictions.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,qDAAqD,EAEtD,uCAA+B;AAChC,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,EAAE,6BAA6B,EAAE,uEAA0E;AAClH,OAAO,EAAkB,QAAQ,EAAiB,SAAS,EAAE,uBAAmB;AAChF,OAAO,EAUL,aAAa,EAKd,oBAAgB;AACjB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,6BAAyB;AAqBhF;;GAEG;AAEH,aAAK,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AACvC,oBAAY,gBAAgB,GAAG,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC5D,eAAO,MAAM,kBAAkB,QAAO,gBAKpC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,eACvB,QAAQ,oBACF,gBAAgB,aACvB,QAAQ,cACR,QAAQ,EAAE,KACpB,IAKF,CAAC;AAEF,MAAM,WAAW,OAAO;IACtB,mBAAmB,EAAE,qDAAqD,EAAE,CAAC;IAC7E,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,aAAa,EAAE,SAAS,CAAC;CAC1B;AA4FD;;GAEG;AACH,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,SAAS,CAAC,6BAA6B,EAAE,SAAS,EAAE,OAAO,CAAC,EAClE,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAwEvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,6BAA6B,EAAE,SAAS,EAAE,OAAO,CAAC,EAClE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,6BAA6B,GACtD,sBAAsB,CAexB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,SAAS,CAAC,6BAA6B,EAAE,SAAS,EAAE,OAAO,CAAC,EAClE,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,OAAO,CAAC,CA0IlB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,UACzC,6BAA6B,EAC7B,SAAS,EACT,OAAO,CAC2E,CAAC"}
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.setTransferRestrictions = exports.prepareStorage = exports.getAuthorization = exports.prepareSetTransferRestrictions = void 0;
|
|
15
|
+
exports.setTransferRestrictions = exports.prepareStorage = exports.getAuthorization = exports.prepareSetTransferRestrictions = exports.addExemptionIfNotPresent = exports.newExemptionRecord = void 0;
|
|
16
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
17
17
|
const lodash_1 = require("lodash");
|
|
18
18
|
const internal_1 = require("../../internal");
|
|
@@ -25,6 +25,7 @@ const newExemptionRecord = () => ({
|
|
|
25
25
|
Jurisdiction: [],
|
|
26
26
|
None: [],
|
|
27
27
|
});
|
|
28
|
+
exports.newExemptionRecord = newExemptionRecord;
|
|
28
29
|
/**
|
|
29
30
|
* @hidden
|
|
30
31
|
* @param toInsertId - Identity to insert into the exemption records
|
|
@@ -38,6 +39,7 @@ const addExemptionIfNotPresent = (toInsertId, exemptionRecords, claimType, filte
|
|
|
38
39
|
exemptionRecords[claimType].push(toInsertId);
|
|
39
40
|
}
|
|
40
41
|
};
|
|
42
|
+
exports.addExemptionIfNotPresent = addExemptionIfNotPresent;
|
|
41
43
|
/**
|
|
42
44
|
* @hidden
|
|
43
45
|
*
|
|
@@ -45,11 +47,11 @@ const addExemptionIfNotPresent = (toInsertId, exemptionRecords, claimType, filte
|
|
|
45
47
|
* While clearing and building the restrictions would be simpler, it would be inefficient use of gas fees
|
|
46
48
|
*/
|
|
47
49
|
function transformInput(inputRestrictions, currentRestrictions, currentExemptions, type, context) {
|
|
48
|
-
const toSetExemptions = newExemptionRecord();
|
|
49
|
-
const toRemoveExemptions = newExemptionRecord();
|
|
50
|
+
const toSetExemptions = (0, exports.newExemptionRecord)();
|
|
51
|
+
const toRemoveExemptions = (0, exports.newExemptionRecord)();
|
|
50
52
|
let needDifferentConditions = inputRestrictions.length !== currentRestrictions.length;
|
|
51
53
|
const conditions = [];
|
|
52
|
-
const inputExemptions = newExemptionRecord();
|
|
54
|
+
const inputExemptions = (0, exports.newExemptionRecord)();
|
|
53
55
|
// for each restriction check if we need to make a condition and track all exemptions
|
|
54
56
|
inputRestrictions.forEach(restriction => {
|
|
55
57
|
var _a;
|
|
@@ -75,7 +77,7 @@ function transformInput(inputRestrictions, currentRestrictions, currentExemption
|
|
|
75
77
|
(_a = restriction.exemptedIdentities) === null || _a === void 0 ? void 0 : _a.forEach(exemption => {
|
|
76
78
|
const key = claimType || 'None';
|
|
77
79
|
const id = (0, internal_2.asIdentity)(exemption, context);
|
|
78
|
-
addExemptionIfNotPresent(id, inputExemptions, key);
|
|
80
|
+
(0, exports.addExemptionIfNotPresent)(id, inputExemptions, key);
|
|
79
81
|
});
|
|
80
82
|
});
|
|
81
83
|
// calculate exemptions to add — for each input exemption check if it already exists
|
|
@@ -83,7 +85,7 @@ function transformInput(inputRestrictions, currentRestrictions, currentExemption
|
|
|
83
85
|
const key = cType;
|
|
84
86
|
const currentIds = currentExemptions[key];
|
|
85
87
|
toAddIds.forEach(id => {
|
|
86
|
-
addExemptionIfNotPresent(id, toSetExemptions, key, currentIds);
|
|
88
|
+
(0, exports.addExemptionIfNotPresent)(id, toSetExemptions, key, currentIds);
|
|
87
89
|
});
|
|
88
90
|
});
|
|
89
91
|
// calculate exemptions to remove — for each current exemption check if it was in the input
|
|
@@ -91,7 +93,7 @@ function transformInput(inputRestrictions, currentRestrictions, currentExemption
|
|
|
91
93
|
const key = cType;
|
|
92
94
|
const given = inputExemptions[key];
|
|
93
95
|
currentIds.forEach(id => {
|
|
94
|
-
addExemptionIfNotPresent(id, toRemoveExemptions, key, given);
|
|
96
|
+
(0, exports.addExemptionIfNotPresent)(id, toRemoveExemptions, key, given);
|
|
95
97
|
});
|
|
96
98
|
});
|
|
97
99
|
const sizeOf = (obj) => (0, lodash_1.flatten)((0, lodash_1.entries)(obj).map(([, identities]) => identities)).length;
|
|
@@ -245,7 +247,7 @@ function prepareStorage(args) {
|
|
|
245
247
|
}));
|
|
246
248
|
});
|
|
247
249
|
const rawCurrentExemptions = (0, lodash_1.flatten)(yield Promise.all(exemptionFetchers));
|
|
248
|
-
const currentExemptions = newExemptionRecord();
|
|
250
|
+
const currentExemptions = (0, exports.newExemptionRecord)();
|
|
249
251
|
rawCurrentExemptions.forEach(([{ args: [{ claimType: rawClaimType }, rawDid], },]) => {
|
|
250
252
|
const did = (0, conversion_1.identityIdToString)(rawDid);
|
|
251
253
|
let claimType = 'None';
|
|
@@ -253,7 +255,7 @@ function prepareStorage(args) {
|
|
|
253
255
|
claimType = (0, conversion_1.meshClaimTypeToClaimType)(rawClaimType.unwrap());
|
|
254
256
|
}
|
|
255
257
|
const identity = new internal_1.Identity({ did }, context);
|
|
256
|
-
addExemptionIfNotPresent(identity, currentExemptions, claimType);
|
|
258
|
+
(0, exports.addExemptionIfNotPresent)(identity, currentExemptions, claimType);
|
|
257
259
|
});
|
|
258
260
|
const transformRestriction = (restriction) => {
|
|
259
261
|
return (0, conversion_1.transferRestrictionToPolymeshTransferCondition)(restriction, context);
|