@polymeshassociation/polymesh-sdk 27.8.0-beta.2 → 28.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +8 -3
  2. package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts +44 -13
  3. package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts.map +1 -1
  4. package/api/entities/Asset/Fungible/TransferRestrictions/index.js +60 -28
  5. package/api/entities/Asset/Fungible/TransferRestrictions/index.js.map +1 -1
  6. package/api/entities/Asset/types.d.ts +36 -1
  7. package/api/entities/Asset/types.d.ts.map +1 -1
  8. package/api/entities/Asset/types.js.map +1 -1
  9. package/api/entities/types.d.ts +4 -7
  10. package/api/entities/types.d.ts.map +1 -1
  11. package/api/entities/types.js +6 -1
  12. package/api/entities/types.js.map +1 -1
  13. package/api/procedures/setAssetStats.d.ts +22 -0
  14. package/api/procedures/setAssetStats.d.ts.map +1 -0
  15. package/api/procedures/setAssetStats.js +87 -0
  16. package/api/procedures/setAssetStats.js.map +1 -0
  17. package/api/procedures/setTransferRestrictionExemptions.d.ts +20 -0
  18. package/api/procedures/setTransferRestrictionExemptions.d.ts.map +1 -0
  19. package/api/procedures/setTransferRestrictionExemptions.js +102 -0
  20. package/api/procedures/setTransferRestrictionExemptions.js.map +1 -0
  21. package/api/procedures/setTransferRestrictions.d.ts +9 -34
  22. package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
  23. package/api/procedures/setTransferRestrictions.js +61 -257
  24. package/api/procedures/setTransferRestrictions.js.map +1 -1
  25. package/api/procedures/types.d.ts +40 -48
  26. package/api/procedures/types.d.ts.map +1 -1
  27. package/api/procedures/types.js.map +1 -1
  28. package/internal.d.ts +3 -6
  29. package/internal.d.ts.map +1 -1
  30. package/internal.js +7 -11
  31. package/internal.js.map +1 -1
  32. package/npm-package/polymeshassociation-polymesh-sdk-28.0.0-beta.1.tgz +0 -0
  33. package/package.json +1 -1
  34. package/utils/conversion.d.ts +27 -18
  35. package/utils/conversion.d.ts.map +1 -1
  36. package/utils/conversion.js +162 -129
  37. package/utils/conversion.js.map +1 -1
  38. package/utils/internal.d.ts +1 -14
  39. package/utils/internal.d.ts.map +1 -1
  40. package/utils/internal.js +3 -110
  41. package/utils/internal.js.map +1 -1
  42. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.d.ts +0 -69
  43. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.d.ts.map +0 -1
  44. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.js +0 -16
  45. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.js.map +0 -1
  46. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.d.ts +0 -60
  47. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.d.ts.map +0 -1
  48. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.js +0 -16
  49. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.js.map +0 -1
  50. package/api/entities/Asset/Fungible/TransferRestrictions/Count.d.ts +0 -81
  51. package/api/entities/Asset/Fungible/TransferRestrictions/Count.d.ts.map +0 -1
  52. package/api/entities/Asset/Fungible/TransferRestrictions/Count.js +0 -20
  53. package/api/entities/Asset/Fungible/TransferRestrictions/Count.js.map +0 -1
  54. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.d.ts +0 -59
  55. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.d.ts.map +0 -1
  56. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.js +0 -16
  57. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.js.map +0 -1
  58. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.d.ts +0 -62
  59. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.d.ts.map +0 -1
  60. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.js +0 -189
  61. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.js.map +0 -1
  62. package/api/procedures/addAssetStat.d.ts +0 -16
  63. package/api/procedures/addAssetStat.d.ts.map +0 -1
  64. package/api/procedures/addAssetStat.js +0 -87
  65. package/api/procedures/addAssetStat.js.map +0 -1
  66. package/api/procedures/addTransferRestriction.d.ts +0 -23
  67. package/api/procedures/addTransferRestriction.d.ts.map +0 -1
  68. package/api/procedures/addTransferRestriction.js +0 -122
  69. package/api/procedures/addTransferRestriction.js.map +0 -1
  70. package/api/procedures/removeAssetStat.d.ts +0 -16
  71. package/api/procedures/removeAssetStat.d.ts.map +0 -1
  72. package/api/procedures/removeAssetStat.js +0 -85
  73. package/api/procedures/removeAssetStat.js.map +0 -1
  74. package/npm-package/polymeshassociation-polymesh-sdk-27.8.0-beta.2.tgz +0 -0
@@ -0,0 +1,102 @@
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.setTransferRestrictionsExemptions = exports.getAuthorization = exports.prepareSetTransferRestrictionExemptions = void 0;
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const internal_1 = require("../../internal");
18
+ const types_1 = require("../../types");
19
+ const utils_1 = require("../../types/utils");
20
+ const conversion_1 = require("../../utils/conversion");
21
+ const internal_2 = require("../../utils/internal");
22
+ /**
23
+ * @hidden
24
+ */
25
+ function prepareSetTransferRestrictionExemptions(args) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const { context: { polymeshApi: { query, tx: { statistics }, }, }, context, } = this;
28
+ const { asset, type, identities: entities, claim, isExempt } = args;
29
+ const identities = entities.map(id => {
30
+ return (0, internal_2.asIdentity)(id, context);
31
+ });
32
+ const rawEntities = (0, conversion_1.identitiesToBtreeSet)(identities, context);
33
+ const rawIsExempt = (0, conversion_1.booleanToBool)(isExempt, context);
34
+ const rawAssetId = (0, conversion_1.assetToMeshAssetId)(asset, context);
35
+ const rawType = (0, conversion_1.statTypeToStatOpType)(type, context);
36
+ const exemptKey = (0, conversion_1.toExemptKey)(rawAssetId, rawType, claim);
37
+ // Ensure entities are not already set
38
+ if (isExempt) {
39
+ const multiParams = identities.map(({ did }) => (0, utils_1.tuple)(exemptKey, (0, conversion_1.stringToIdentityId)(did, context)));
40
+ const result = yield query.statistics.transferConditionExemptEntities.multi(multiParams);
41
+ const exemptedDids = result.reduce((ids, rawResult, index) => {
42
+ const isSet = (0, conversion_1.boolToBoolean)(rawResult);
43
+ if (isSet) {
44
+ ids.push(identities[index].did);
45
+ }
46
+ return ids;
47
+ }, []);
48
+ if (exemptedDids.length) {
49
+ throw new internal_1.PolymeshError({
50
+ code: types_1.ErrorCode.NoDataChange,
51
+ message: 'Some identities are already exempted',
52
+ data: { exemptedDids },
53
+ });
54
+ }
55
+ }
56
+ else {
57
+ // Ensure entities are already set
58
+ const multiParams = identities.map(({ did }) => (0, utils_1.tuple)(exemptKey, (0, conversion_1.stringToIdentityId)(did, context)));
59
+ const result = yield query.statistics.transferConditionExemptEntities.multi(multiParams);
60
+ const unsetDids = result.reduce((ids, rawResult, index) => {
61
+ const isSet = (0, conversion_1.boolToBoolean)(rawResult);
62
+ if (!isSet) {
63
+ ids.push(identities[index].did);
64
+ }
65
+ return ids;
66
+ }, []);
67
+ if (unsetDids.length) {
68
+ throw new internal_1.PolymeshError({
69
+ code: types_1.ErrorCode.NoDataChange,
70
+ message: 'Some identities are not exemptions',
71
+ data: { isExempt, unsetDids },
72
+ });
73
+ }
74
+ }
75
+ return {
76
+ transaction: statistics.setEntitiesExempt,
77
+ feeMultiplier: new bignumber_js_1.default(rawEntities.size),
78
+ args: [rawIsExempt, exemptKey, rawEntities],
79
+ resolver: undefined,
80
+ };
81
+ });
82
+ }
83
+ exports.prepareSetTransferRestrictionExemptions = prepareSetTransferRestrictionExemptions;
84
+ /**
85
+ * @hidden
86
+ */
87
+ function getAuthorization({ asset }) {
88
+ return {
89
+ permissions: {
90
+ assets: [asset],
91
+ transactions: [types_1.TxTags.statistics.SetEntitiesExempt],
92
+ portfolios: [],
93
+ },
94
+ };
95
+ }
96
+ exports.getAuthorization = getAuthorization;
97
+ /**
98
+ * @hidden
99
+ */
100
+ const setTransferRestrictionsExemptions = () => new internal_1.Procedure(prepareSetTransferRestrictionExemptions, getAuthorization);
101
+ exports.setTransferRestrictionsExemptions = setTransferRestrictionsExemptions;
102
+ //# sourceMappingURL=setTransferRestrictionExemptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setTransferRestrictionExemptions.js","sourceRoot":"","sources":["../../../src/api/procedures/setTransferRestrictionExemptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AAErC,6CAAqE;AACrE,uCAAgF;AAEhF,6CAAsC;AACtC,uDAQ4B;AAC5B,mDAA8C;AAO9C;;GAEG;AACH,SAAsB,uCAAuC,CAE3D,IAAY;;QAEZ,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,KAAK,EACL,EAAE,EAAE,EAAE,UAAU,EAAE,GACnB,GACF,EACD,OAAO,GACR,GAAG,IAAI,CAAC;QACT,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEpE,MAAM,UAAU,GAAG,QAAQ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iFC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAE9B,EAAE,KAAK,EAAU;IAEjB,OAAO;QACL,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,KAAK,CAAC;YACf,YAAY,EAAE,CAAC,cAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC;YACnD,UAAU,EAAE,EAAE;SACf;KACF,CAAC;AACJ,CAAC;AAXD,4CAWC;AAED;;GAEG;AACI,MAAM,iCAAiC,GAAG,GAA4B,EAAE,CAC7E,IAAI,oBAAS,CAAC,uCAAuC,EAAE,gBAAgB,CAAC,CAAC;AAD9D,QAAA,iCAAiC,qCAC6B"}
@@ -1,44 +1,19 @@
1
- import { PolymeshPrimitivesTransferComplianceTransferCondition } from "../../../node_modules/@polymeshassociation/polymesh-types/polkadot/types-lookup";
2
- import BigNumber from 'bignumber.js';
3
- import { SetTransferRestrictionsParams } from "../entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase";
4
- import { Identity, Procedure } from "../../internal";
5
- import { StatClaimType } from "../../types";
6
- import { BatchTransactionSpec, ProcedureAuthorization } from "../../types/internal";
1
+ import { FungibleAsset, Procedure } from "../../internal";
2
+ import { TransferRestrictionParams } from "../../types";
3
+ import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from "../../types/internal";
4
+ export declare type Params = {
5
+ asset: FungibleAsset;
6
+ } & TransferRestrictionParams;
7
7
  /**
8
8
  * @hidden
9
9
  */
10
- declare type ClaimKey = StatClaimType | 'None';
11
- export declare type ExemptionRecords = Record<ClaimKey, Identity[]>;
12
- export declare const newExemptionRecord: () => ExemptionRecords;
10
+ export declare function prepareSetTransferRestrictions(this: Procedure<Params, void>, args: Params): Promise<TransactionSpec<void, ExtrinsicParams<'statistics', 'setAssetTransferCompliance'>>>;
13
11
  /**
14
12
  * @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
13
  */
20
- export declare const addExemptionIfNotPresent: (toInsertId: Identity, exemptionRecords: ExemptionRecords, claimType: ClaimKey, filterSet?: Identity[]) => void;
21
- export interface Storage {
22
- currentExemptions: ExemptionRecords;
23
- filteredRestrictions: PolymeshPrimitivesTransferComplianceTransferCondition[];
24
- currentTypeRestrictions: PolymeshPrimitivesTransferComplianceTransferCondition[];
25
- occupiedSlots: BigNumber;
26
- }
14
+ export declare function getAuthorization(this: Procedure<Params, void>, { asset }: Params): ProcedureAuthorization;
27
15
  /**
28
16
  * @hidden
29
17
  */
30
- export declare function prepareSetTransferRestrictions(this: Procedure<SetTransferRestrictionsParams, BigNumber, Storage>, args: SetTransferRestrictionsParams): Promise<BatchTransactionSpec<BigNumber, unknown[][]>>;
31
- /**
32
- * @hidden
33
- */
34
- export declare function getAuthorization(this: Procedure<SetTransferRestrictionsParams, BigNumber, Storage>, { asset, restrictions }: SetTransferRestrictionsParams): ProcedureAuthorization;
35
- /**
36
- * @hidden
37
- */
38
- export declare function prepareStorage(this: Procedure<SetTransferRestrictionsParams, BigNumber, Storage>, args: SetTransferRestrictionsParams): Promise<Storage>;
39
- /**
40
- * @hidden
41
- */
42
- export declare const setTransferRestrictions: () => Procedure<SetTransferRestrictionsParams, BigNumber, Storage>;
43
- export {};
18
+ export declare const setTransferRestrictions: () => Procedure<Params, void>;
44
19
  //# sourceMappingURL=setTransferRestrictions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setTransferRestrictions.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/setTransferRestrictions.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,qDAAqD,EAEtD,wFAA+B;AAChC,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,EAAE,6BAA6B,EAAE,gFAAmF;AAC3H,OAAO,EAAW,QAAQ,EAAiB,SAAS,EAAE,uBAAmB;AACzE,OAAO,EAUL,aAAa,EAKd,oBAAgB;AACjB,OAAO,EAAE,oB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api/procedures/setTransferRestrictions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,uBAAmB;AACrE,OAAO,EAOL,yBAAyB,EAG1B,oBAAgB;AACjB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,6BAAyB;AAQ5F,oBAAY,MAAM,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG,yBAAyB,CAAC;AA8C1E;;GAEG;AACH,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,EAC7B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,YAAY,EAAE,4BAA4B,CAAC,CAAC,CAAC,CA2C7F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,EAC7B,EAAE,KAAK,EAAE,EAAE,MAAM,GAChB,sBAAsB,CAQxB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,UAAU,MAAM,EAAE,IAAI,CACA,CAAC"}
@@ -8,215 +8,97 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.setTransferRestrictions = exports.prepareStorage = exports.getAuthorization = exports.prepareSetTransferRestrictions = exports.addExemptionIfNotPresent = exports.newExemptionRecord = void 0;
16
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
- const lodash_1 = require("lodash");
12
+ exports.setTransferRestrictions = exports.getAuthorization = exports.prepareSetTransferRestrictions = void 0;
18
13
  const internal_1 = require("../../internal");
19
14
  const types_1 = require("../../types");
20
15
  const conversion_1 = require("../../utils/conversion");
21
16
  const internal_2 = require("../../utils/internal");
22
- const newExemptionRecord = () => ({
23
- Accredited: [],
24
- Affiliate: [],
25
- Jurisdiction: [],
26
- None: [],
27
- });
28
- exports.newExemptionRecord = newExemptionRecord;
29
- /**
30
- * @hidden
31
- * @param toInsertId - Identity to insert into the exemption records
32
- * @param exemptionRecords - records that will be mutated if the Identity should be added
33
- * @param claimType - type of Claim the Identity is exempt from
34
- * @param filterSet - set of Identities that should not be added into exemption records if given
35
- */
36
- const addExemptionIfNotPresent = (toInsertId, exemptionRecords, claimType, filterSet = []) => {
37
- const found = filterSet.some(currentId => currentId.did === toInsertId.did);
38
- if (!found) {
39
- exemptionRecords[claimType].push(toInsertId);
40
- }
41
- };
42
- exports.addExemptionIfNotPresent = addExemptionIfNotPresent;
43
17
  /**
44
18
  * @hidden
45
19
  * Checks if the input restrictions are valid
46
20
  */
47
- function assertInputValid(inputRestrictions, type) {
48
- if ([types_1.TransferRestrictionType.Percentage, types_1.TransferRestrictionType.Count].includes(type) &&
49
- inputRestrictions.length > 1) {
50
- throw new internal_1.PolymeshError({
51
- code: types_1.ErrorCode.ValidationError,
52
- message: 'Only one of provided Transfer Type Restriction can be set at a time',
53
- data: { type },
54
- });
55
- }
56
- if (type === types_1.TransferRestrictionType.ClaimCount) {
57
- const seenJurisdictions = new Set();
58
- const seenClaimTypes = new Set();
59
- inputRestrictions.forEach(restriction => {
60
- var _a;
61
- const { claim } = restriction;
62
- if (claim.type === types_1.ClaimType.Jurisdiction) {
63
- // cannot add two claims with same country code restrictions will result in internal error
64
- if (seenJurisdictions.has(claim.countryCode || 'none')) {
65
- throw new internal_1.PolymeshError({
66
- code: types_1.ErrorCode.ValidationError,
67
- message: 'Duplicate Jurisdiction CountryCode found in input',
68
- data: { countryCode: claim.countryCode },
69
- });
21
+ function assertInputValid(input) {
22
+ input.restrictions.forEach(restriction => {
23
+ const type = restriction.type;
24
+ if (type === types_1.TransferRestrictionType.ClaimCount) {
25
+ const seenJurisdictions = new Set();
26
+ const seenClaimTypes = new Set();
27
+ input.restrictions.forEach(rest => {
28
+ var _a;
29
+ const { claim } = rest;
30
+ if (!claim) {
31
+ return;
70
32
  }
71
- seenJurisdictions.add((_a = claim.countryCode) !== null && _a !== void 0 ? _a : 'none');
72
- }
73
- else {
74
- // cannot add two ClaimType.Accredited or ClaimType.Affiliate restrictions will result in internal error
75
- if (seenClaimTypes.has(claim.type)) {
76
- throw new internal_1.PolymeshError({
77
- code: types_1.ErrorCode.ValidationError,
78
- message: 'Duplicate ClaimType found in input',
79
- data: { claimType: claim.type },
80
- });
33
+ if (claim.type === types_1.ClaimType.Jurisdiction) {
34
+ // cannot add two claims with same country code restrictions will result in internal error
35
+ if (seenJurisdictions.has(claim.countryCode || 'none')) {
36
+ throw new internal_1.PolymeshError({
37
+ code: types_1.ErrorCode.ValidationError,
38
+ message: 'Duplicate Jurisdiction CountryCode found in input',
39
+ data: { countryCode: claim.countryCode },
40
+ });
41
+ }
42
+ seenJurisdictions.add((_a = claim.countryCode) !== null && _a !== void 0 ? _a : 'none');
81
43
  }
82
- seenClaimTypes.add(claim.type);
83
- }
84
- });
85
- }
86
- }
87
- /**
88
- * @hidden
89
- *
90
- * Calculates the smallest change needed to get to the requested state from the current state.
91
- * While clearing and building the restrictions would be simpler, it would be inefficient use of gas fees
92
- */
93
- function transformInput(inputRestrictions, currentRestrictions, currentExemptions, type, context) {
94
- const toSetExemptions = (0, exports.newExemptionRecord)();
95
- const toRemoveExemptions = (0, exports.newExemptionRecord)();
96
- let needDifferentConditions = inputRestrictions.length !== currentRestrictions.length;
97
- const conditions = [];
98
- const inputExemptions = (0, exports.newExemptionRecord)();
99
- // for each restriction check if we need to make a condition and track all exemptions
100
- inputRestrictions.forEach(restriction => {
101
- var _a;
102
- let value;
103
- let claimType;
104
- if ('count' in restriction) {
105
- value = restriction.count;
106
- }
107
- else if ('percentage' in restriction) {
108
- value = restriction.percentage;
109
- }
110
- else {
111
- value = restriction;
112
- claimType = restriction.claim.type;
113
- }
114
- const condition = { type, value };
115
- const compareConditions = (transferCondition) => (0, internal_2.compareTransferRestrictionToInput)(transferCondition, condition);
116
- if (!needDifferentConditions) {
117
- needDifferentConditions = ![...currentRestrictions].find(compareConditions);
44
+ else {
45
+ // cannot add two ClaimType.Accredited or ClaimType.Affiliate restrictions will result in internal error
46
+ if (seenClaimTypes.has(claim.type)) {
47
+ throw new internal_1.PolymeshError({
48
+ code: types_1.ErrorCode.ValidationError,
49
+ message: 'Duplicate ClaimType found in input',
50
+ data: { claimType: claim.type },
51
+ });
52
+ }
53
+ seenClaimTypes.add(claim.type);
54
+ }
55
+ });
118
56
  }
119
- const rawCondition = (0, conversion_1.transferRestrictionToPolymeshTransferCondition)(condition, context);
120
- conditions.push(rawCondition);
121
- (_a = restriction.exemptedIdentities) === null || _a === void 0 ? void 0 : _a.forEach(exemption => {
122
- const key = claimType || 'None';
123
- const id = (0, internal_2.asIdentity)(exemption, context);
124
- (0, exports.addExemptionIfNotPresent)(id, inputExemptions, key);
125
- });
126
- });
127
- // calculate exemptions to add — for each input exemption check if it already exists
128
- (0, lodash_1.forEach)(inputExemptions, (toAddIds, cType) => {
129
- const key = cType;
130
- const currentIds = currentExemptions[key];
131
- toAddIds.forEach(id => {
132
- (0, exports.addExemptionIfNotPresent)(id, toSetExemptions, key, currentIds);
133
- });
134
- });
135
- // calculate exemptions to remove — for each current exemption check if it was in the input
136
- (0, lodash_1.forEach)(currentExemptions, (currentIds, cType) => {
137
- const key = cType;
138
- const given = inputExemptions[key];
139
- currentIds.forEach(id => {
140
- (0, exports.addExemptionIfNotPresent)(id, toRemoveExemptions, key, given);
141
- });
142
57
  });
143
- const sizeOf = (obj) => (0, lodash_1.flatten)((0, lodash_1.entries)(obj).map(([, identities]) => identities)).length;
144
- const needDifferentExemptions = sizeOf(toSetExemptions) > 0 || sizeOf(toRemoveExemptions) > 0;
145
- if (!needDifferentConditions && !needDifferentExemptions) {
146
- throw new internal_1.PolymeshError({
147
- code: types_1.ErrorCode.NoDataChange,
148
- message: inputRestrictions.length
149
- ? 'The restrictions and exemptions are already in place'
150
- : 'No restrictions to remove',
151
- });
152
- }
153
- return { conditions, toSetExemptions, toRemoveExemptions };
154
58
  }
155
59
  /**
156
60
  * @hidden
157
61
  */
158
62
  function prepareSetTransferRestrictions(args) {
159
63
  return __awaiter(this, void 0, void 0, function* () {
160
- const { context: { polymeshApi: { tx: { statistics }, consts, }, }, storage: { occupiedSlots, currentExemptions, filteredRestrictions, currentTypeRestrictions }, context, } = this;
161
- const { restrictions: { length: newRestrictionAmount }, restrictions, type, asset, } = args;
64
+ const { context: { polymeshApi: { query, tx: { statistics }, }, }, context, } = this;
65
+ const { restrictions, asset } = args;
162
66
  const rawAssetId = (0, conversion_1.assetToMeshAssetId)(asset, context);
163
- assertInputValid(restrictions, type);
164
- const { conditions, toSetExemptions, toRemoveExemptions } = transformInput(restrictions, currentTypeRestrictions, currentExemptions, type, context);
165
- const maxTransferConditions = (0, conversion_1.u32ToBigNumber)(consts.statistics.maxTransferConditionsPerAsset);
166
- const finalCount = occupiedSlots.plus(newRestrictionAmount);
167
- if (finalCount.isGreaterThan(maxTransferConditions)) {
168
- throw new internal_1.PolymeshError({
169
- code: types_1.ErrorCode.LimitExceeded,
170
- message: 'Cannot set more Transfer Restrictions than there are slots available',
171
- data: {
172
- availableSlots: maxTransferConditions.minus(occupiedSlots),
173
- },
174
- });
175
- }
176
- const transactions = [];
177
- const op = (0, conversion_1.transferRestrictionTypeToStatOpType)(type, context);
178
- transactions.push((0, internal_2.checkTxType)({
67
+ assertInputValid(args);
68
+ const currentStats = yield query.statistics.activeAssetStats(rawAssetId);
69
+ const conditions = restrictions.map(restriction => {
70
+ let value;
71
+ if ('count' in restriction) {
72
+ value = restriction.count;
73
+ }
74
+ else if ('percentage' in restriction) {
75
+ value = restriction.percentage;
76
+ }
77
+ else {
78
+ value = restriction;
79
+ }
80
+ const condition = { type: restriction.type, value };
81
+ const neededStat = (0, internal_2.neededStatTypeForRestrictionInput)(restriction, context);
82
+ (0, internal_2.assertStatIsSet)(currentStats, neededStat);
83
+ return (0, conversion_1.transferRestrictionToPolymeshTransferCondition)(condition, context);
84
+ });
85
+ const rawConditions = (0, conversion_1.complianceConditionsToBtreeSet)(conditions, context);
86
+ return {
179
87
  transaction: statistics.setAssetTransferCompliance,
180
- args: [
181
- rawAssetId,
182
- (0, conversion_1.complianceConditionsToBtreeSet)([...filteredRestrictions, ...conditions], context),
183
- ],
184
- }));
185
- const pushExemptions = (exemptions, exempt) => {
186
- (0, lodash_1.forEach)(exemptions, (exempted, claimType) => {
187
- if (exempted.length === 0) {
188
- return;
189
- }
190
- const rawClaimType = claimType === 'None' ? undefined : claimType;
191
- const exemptKey = (0, conversion_1.toExemptKey)(rawAssetId, op, rawClaimType);
192
- const exemptedBtreeSet = (0, conversion_1.identitiesToBtreeSet)(exempted, context);
193
- const rawExempt = (0, conversion_1.booleanToBool)(exempt, context);
194
- transactions.push((0, internal_2.checkTxType)({
195
- transaction: statistics.setEntitiesExempt,
196
- feeMultiplier: new bignumber_js_1.default(exemptedBtreeSet.size),
197
- args: [rawExempt, exemptKey, exemptedBtreeSet],
198
- }));
199
- });
88
+ args: [rawAssetId, rawConditions],
89
+ resolver: undefined,
200
90
  };
201
- pushExemptions(toSetExemptions, true);
202
- pushExemptions(toRemoveExemptions, false);
203
- return { transactions, resolver: finalCount };
204
91
  });
205
92
  }
206
93
  exports.prepareSetTransferRestrictions = prepareSetTransferRestrictions;
207
94
  /**
208
95
  * @hidden
209
96
  */
210
- function getAuthorization({ asset, restrictions }) {
211
- const transactions = [types_1.TxTags.statistics.SetAssetTransferCompliance];
212
- const needExemptionsPermission = restrictions.some(r => { var _a; return (_a = r.exemptedIdentities) === null || _a === void 0 ? void 0 : _a.length; });
213
- if (needExemptionsPermission) {
214
- transactions.push(types_1.TxTags.statistics.SetEntitiesExempt);
215
- }
97
+ function getAuthorization({ asset }) {
216
98
  return {
217
99
  permissions: {
218
100
  assets: [asset],
219
- transactions,
101
+ transactions: [types_1.TxTags.statistics.SetAssetTransferCompliance],
220
102
  portfolios: [],
221
103
  },
222
104
  };
@@ -225,84 +107,6 @@ exports.getAuthorization = getAuthorization;
225
107
  /**
226
108
  * @hidden
227
109
  */
228
- function prepareStorage(args) {
229
- return __awaiter(this, void 0, void 0, function* () {
230
- const { context, context: { polymeshApi: { query: { statistics }, }, }, } = this;
231
- const { asset, type } = args;
232
- const rawAssetId = (0, conversion_1.assetToMeshAssetId)(asset, context);
233
- const [currentStats, { requirements: currentRestrictions }] = yield (0, internal_2.requestMulti)(context, [
234
- [statistics.activeAssetStats, rawAssetId],
235
- [statistics.assetTransferCompliances, rawAssetId],
236
- ]);
237
- args.restrictions.forEach(restriction => {
238
- let claimIssuer;
239
- if (type === types_1.TransferRestrictionType.ClaimCount ||
240
- type === types_1.TransferRestrictionType.ClaimPercentage) {
241
- const { claim: { type: claimType }, issuer, } = restriction;
242
- claimIssuer = { claimType, issuer };
243
- }
244
- const neededStat = (0, internal_2.neededStatTypeForRestrictionInput)({ type, claimIssuer }, context);
245
- (0, internal_2.assertStatIsSet)(currentStats, neededStat);
246
- });
247
- const filteredRestrictions = [...currentRestrictions].filter(requirement => {
248
- if (type === types_1.TransferRestrictionType.Count) {
249
- return !requirement.isMaxInvestorCount;
250
- }
251
- else if (type === types_1.TransferRestrictionType.Percentage) {
252
- return !requirement.isMaxInvestorOwnership;
253
- }
254
- else if (type === types_1.TransferRestrictionType.ClaimCount) {
255
- return !requirement.isClaimCount;
256
- }
257
- else {
258
- return !requirement.isClaimOwnership;
259
- }
260
- });
261
- const currentTypeRestrictions = [...currentRestrictions].filter(requirement => {
262
- if (type === types_1.TransferRestrictionType.Count) {
263
- return requirement.isMaxInvestorCount;
264
- }
265
- else if (type === types_1.TransferRestrictionType.Percentage) {
266
- return requirement.isMaxInvestorOwnership;
267
- }
268
- else if (type === types_1.TransferRestrictionType.ClaimCount) {
269
- return requirement.isClaimCount;
270
- }
271
- else {
272
- return requirement.isClaimOwnership;
273
- }
274
- });
275
- const op = (0, conversion_1.transferRestrictionTypeToStatOpType)(type, context);
276
- const claimTypes = type === types_1.TransferRestrictionType.Count || type === types_1.TransferRestrictionType.Percentage
277
- ? [undefined]
278
- : [types_1.ClaimType.Accredited, types_1.ClaimType.Affiliate, types_1.ClaimType.Jurisdiction];
279
- const exemptionFetchers = [];
280
- claimTypes.forEach(claimType => {
281
- exemptionFetchers.push(statistics.transferConditionExemptEntities.entries((0, conversion_1.toExemptKey)(rawAssetId, op, claimType)));
282
- });
283
- const rawCurrentExemptions = (0, lodash_1.flatten)(yield Promise.all(exemptionFetchers));
284
- const currentExemptions = (0, exports.newExemptionRecord)();
285
- rawCurrentExemptions.forEach(([{ args: [{ claimType: rawClaimType }, rawDid], },]) => {
286
- const did = (0, conversion_1.identityIdToString)(rawDid);
287
- let claimType = 'None';
288
- if (rawClaimType.isSome) {
289
- claimType = (0, conversion_1.meshClaimTypeToClaimType)(rawClaimType.unwrap());
290
- }
291
- const identity = new internal_1.Identity({ did }, context);
292
- (0, exports.addExemptionIfNotPresent)(identity, currentExemptions, claimType);
293
- });
294
- return {
295
- occupiedSlots: new bignumber_js_1.default(filteredRestrictions.length),
296
- currentTypeRestrictions,
297
- filteredRestrictions,
298
- currentExemptions,
299
- };
300
- });
301
- }
302
- exports.prepareStorage = prepareStorage;
303
- /**
304
- * @hidden
305
- */
306
- const setTransferRestrictions = () => new internal_1.Procedure(prepareSetTransferRestrictions, getAuthorization, prepareStorage);
110
+ const setTransferRestrictions = () => new internal_1.Procedure(prepareSetTransferRestrictions, getAuthorization);
307
111
  exports.setTransferRestrictions = setTransferRestrictions;
308
112
  //# sourceMappingURL=setTransferRestrictions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setTransferRestrictions.js","sourceRoot":"","sources":["../../../src/api/procedures/setTransferRestrictions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,gEAAqC;AACrC,mCAAmD;AAGnD,6CAAy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;YAChD,IAAA,gCAAwB,EAAC,QAAQ,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;QACnE,CAAC,CACF,CAAC;QAEF,OAAO;YACL,aAAa,EAAE,IAAI,sBAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC;YACzD,uBAAuB;YACvB,oBAAoB;YACpB,iBAAiB;SAClB,CAAC;IACJ,CAAC;CAAA;AA9GD,wCA8GC;AAED;;GAEG;AACI,MAAM,uBAAuB,GAAG,GAIrC,EAAE,CAAC,IAAI,oBAAS,CAAC,8BAA8B,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAJxE,QAAA,uBAAuB,2BAIiD"}
1
+ {"version":3,"file":"setTransferRestrictions.js","sourceRoot":"","sources":["../../../src/api/procedures/setTransferRestrictions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,6CAAqE;AACrE,uCAUiB;AAEjB,uDAI4B;AAC5B,mDAAsF;AAItF;;;GAGG;AACH,SAAS,gBAAgB,CAAC,KAAgC;IACxD,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACvC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;QAC9B,IAAI,IAAI,KAAK,+BAAuB,CAAC,UAAU,EAAE;YAC/C,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;YAC5C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;YAEzC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;;gBAChC,MAAM,EAAE,KAAK,EAAE,GAAG,IAA0C,CAAC;gBAE7D,IAAI,CAAC,KAAK,EAAE;oBACV,OAAO;iBACR;gBAED,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAS,CAAC,YAAY,EAAE;oBACzC,0FAA0F;oBAC1F,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,MAAM,CAAC,EAAE;wBACtD,MAAM,IAAI,wB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