@polymeshassociation/polymesh-sdk 27.8.0-beta.2 → 28.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +8 -2
  2. package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts +47 -11
  3. package/api/entities/Asset/Fungible/TransferRestrictions/index.d.ts.map +1 -1
  4. package/api/entities/Asset/Fungible/TransferRestrictions/index.js +214 -21
  5. package/api/entities/Asset/Fungible/TransferRestrictions/index.js.map +1 -1
  6. package/api/entities/Asset/types.d.ts +86 -5
  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/DefaultTrustedClaimIssuer.d.ts +2 -2
  10. package/api/entities/DefaultTrustedClaimIssuer.d.ts.map +1 -1
  11. package/api/entities/DefaultTrustedClaimIssuer.js.map +1 -1
  12. package/api/entities/types.d.ts +11 -9
  13. package/api/entities/types.d.ts.map +1 -1
  14. package/api/entities/types.js +6 -1
  15. package/api/entities/types.js.map +1 -1
  16. package/api/procedures/setAssetStats.d.ts +22 -0
  17. package/api/procedures/setAssetStats.d.ts.map +1 -0
  18. package/api/procedures/setAssetStats.js +87 -0
  19. package/api/procedures/setAssetStats.js.map +1 -0
  20. package/api/procedures/setTransferRestrictionExemptions.d.ts +20 -0
  21. package/api/procedures/setTransferRestrictionExemptions.d.ts.map +1 -0
  22. package/api/procedures/setTransferRestrictionExemptions.js +102 -0
  23. package/api/procedures/setTransferRestrictionExemptions.js.map +1 -0
  24. package/api/procedures/setTransferRestrictions.d.ts +9 -34
  25. package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
  26. package/api/procedures/setTransferRestrictions.js +61 -257
  27. package/api/procedures/setTransferRestrictions.js.map +1 -1
  28. package/api/procedures/types.d.ts +40 -48
  29. package/api/procedures/types.d.ts.map +1 -1
  30. package/api/procedures/types.js.map +1 -1
  31. package/internal.d.ts +3 -6
  32. package/internal.d.ts.map +1 -1
  33. package/internal.js +7 -11
  34. package/internal.js.map +1 -1
  35. package/npm-package/polymeshassociation-polymesh-sdk-28.0.0-beta.2.tgz +0 -0
  36. package/package.json +1 -1
  37. package/utils/conversion.d.ts +31 -22
  38. package/utils/conversion.d.ts.map +1 -1
  39. package/utils/conversion.js +181 -164
  40. package/utils/conversion.js.map +1 -1
  41. package/utils/internal.d.ts +1 -14
  42. package/utils/internal.d.ts.map +1 -1
  43. package/utils/internal.js +3 -110
  44. package/utils/internal.js.map +1 -1
  45. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.d.ts +0 -69
  46. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.d.ts.map +0 -1
  47. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.js +0 -16
  48. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimCount.js.map +0 -1
  49. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.d.ts +0 -60
  50. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.d.ts.map +0 -1
  51. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.js +0 -16
  52. package/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.js.map +0 -1
  53. package/api/entities/Asset/Fungible/TransferRestrictions/Count.d.ts +0 -81
  54. package/api/entities/Asset/Fungible/TransferRestrictions/Count.d.ts.map +0 -1
  55. package/api/entities/Asset/Fungible/TransferRestrictions/Count.js +0 -20
  56. package/api/entities/Asset/Fungible/TransferRestrictions/Count.js.map +0 -1
  57. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.d.ts +0 -59
  58. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.d.ts.map +0 -1
  59. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.js +0 -16
  60. package/api/entities/Asset/Fungible/TransferRestrictions/Percentage.js.map +0 -1
  61. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.d.ts +0 -62
  62. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.d.ts.map +0 -1
  63. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.js +0 -189
  64. package/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.js.map +0 -1
  65. package/api/procedures/addAssetStat.d.ts +0 -16
  66. package/api/procedures/addAssetStat.d.ts.map +0 -1
  67. package/api/procedures/addAssetStat.js +0 -87
  68. package/api/procedures/addAssetStat.js.map +0 -1
  69. package/api/procedures/addTransferRestriction.d.ts +0 -23
  70. package/api/procedures/addTransferRestriction.d.ts.map +0 -1
  71. package/api/procedures/addTransferRestriction.js +0 -122
  72. package/api/procedures/addTransferRestriction.js.map +0 -1
  73. package/api/procedures/removeAssetStat.d.ts +0 -16
  74. package/api/procedures/removeAssetStat.d.ts.map +0 -1
  75. package/api/procedures/removeAssetStat.js +0 -85
  76. package/api/procedures/removeAssetStat.js.map +0 -1
  77. package/npm-package/polymeshassociation-polymesh-sdk-27.8.0-beta.2.tgz +0 -0
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClaimPercentage = void 0;
4
- const internal_1 = require("../../../../../internal");
5
- const types_1 = require("../../../../../types");
6
- /**
7
- * Handles all Claim Percentage Transfer Restriction related functionality
8
- */
9
- class ClaimPercentage extends internal_1.TransferRestrictionBase {
10
- constructor() {
11
- super(...arguments);
12
- this.type = types_1.TransferRestrictionType.ClaimPercentage;
13
- }
14
- }
15
- exports.ClaimPercentage = ClaimPercentage;
16
- //# sourceMappingURL=ClaimPercentage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClaimPercentage.js","sourceRoot":"","sources":["../../../../../../src/api/entities/Asset/Fungible/TransferRestrictions/ClaimPercentage.ts"],"names":[],"mappings":";;;AAEA,sDAAqD;AACrD,gDAWiB;AAEjB;;GAEG;AACH,MAAa,eAAgB,SAAQ,kCAAgE;IAArG;;QACY,SAAI,GAAG,+BAAuB,CAAC,eAAwB,CAAC;IAgEpE,CAAC;CAAA;AAjED,0CAiEC"}
@@ -1,81 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { Context, FungibleAsset, TransferRestrictionBase } from "../../../../../internal";
3
- import { ActiveStats, ActiveTransferRestrictions, AddCountStatParams, AddCountTransferRestrictionParams, CountTransferRestriction, NoArgsProcedureMethod, ProcedureMethod, SetCountTransferRestrictionsParams, TransferRestrictionType } from "../../../../../types";
4
- /**
5
- * Handles all Count Transfer Restriction related functionality
6
- */
7
- export declare class Count extends TransferRestrictionBase<TransferRestrictionType.Count> {
8
- /**
9
- * @hidden
10
- */
11
- constructor(parent: FungibleAsset, context: Context);
12
- protected type: TransferRestrictionType.Count;
13
- /**
14
- * Add a Count Transfer Restriction to this Asset. This limits to total number of individual
15
- * investors that may hold the Asset. In some jurisdictions once a threshold of investors is
16
- * passed, different regulations may apply. Count Transfer Restriction can ensure such limits are not exceeded
17
- *
18
- * @returns the total amount of restrictions after the procedure has run
19
- *
20
- * @throws if a count statistic is not enabled for the Asset. {@link api/entities/Asset/Fungible/TransferRestrictions/Count!Count.enableStat | Count.enableStat } should be called before this method
21
- */
22
- addRestriction: ProcedureMethod<Omit<AddCountTransferRestrictionParams, 'type'>, BigNumber>;
23
- /**
24
- * Sets all Count Transfer Restrictions on this Asset
25
- *
26
- * @note this method sets exempted Identities for restrictions as well. If an Identity is currently exempted from a Count Transfer Restriction
27
- * but not passed into this call then it will be removed
28
- *
29
- * @note the result is the total amount of restrictions after the procedure has run
30
- */
31
- setRestrictions: ProcedureMethod<Omit<SetCountTransferRestrictionsParams, 'type'>, BigNumber>;
32
- /**
33
- * Removes all Count Transfer Restrictions from this Asset
34
- *
35
- * @note the result is the total amount of restrictions after the procedure has run
36
- */
37
- removeRestrictions: NoArgsProcedureMethod<BigNumber>;
38
- /**
39
- * Enables an investor count statistic for the Asset, which is required before creating restrictions
40
- *
41
- * The counter is only updated automatically with each transfer of tokens after the stat has been enabled.
42
- * As such the initial value for the stat should be passed in, which can be fetched with {@link api/entities/Asset/Fungible/TransferRestrictions/Count!Count.investorCount | Count.investorCount }
43
- *
44
- * @note Currently there is a potential race condition if passing in counts values when the Asset is being traded.
45
- * It is recommended to call this method during the initial configuration of the Asset, before people are trading it.
46
- * Otherwise the Asset should be frozen, or the stat checked after being set to ensure the correct value is used. Future
47
- * versions of the chain may expose a new extrinsic to avoid this issue
48
- */
49
- enableStat: ProcedureMethod<Pick<AddCountStatParams, 'count'>, void>;
50
- /**
51
- * Disables the investor count statistic for the Asset. Since statistics introduce slight overhead to each transaction
52
- * involving the Asset, disabling unused stats will reduce gas fees for investors when they transact with the Asset
53
- *
54
- * @throws if the stat is being used by a restriction or is not set
55
- */
56
- disableStat: NoArgsProcedureMethod<void>;
57
- /**
58
-
59
- /**
60
- * Retrieve all active Count Transfer Restrictions
61
- *
62
- * @note there is a maximum number of restrictions allowed across all types.
63
- * The `availableSlots` property of the result represents how many more restrictions can be added
64
- * before reaching that limit
65
- */
66
- get: () => Promise<ActiveTransferRestrictions<CountTransferRestriction>>;
67
- /**
68
- * Returns the count of individual holders of the Asset
69
- *
70
- * @note This value can be used to initialize `enableStat`. If used for this purpose there is a potential race condition
71
- * if Asset transfers happen between the time of check and time of use. Either pause Asset transfers, or check after stat
72
- * creation and try again if a race occurred. Future versions of the chain should introduce an extrinsic to avoid this issue
73
- */
74
- investorCount: () => Promise<BigNumber>;
75
- /**
76
- * Retrieve current Count Transfer Restriction investor balance statistic for the Asset
77
- *
78
- */
79
- getStat: () => Promise<ActiveStats>;
80
- }
81
- //# sourceMappingURL=Count.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Count.d.ts","sourceRoot":"","sources":["../../../../../../src/api/entities/Asset/Fungible/TransferRestrictions/Count.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,gCAAmB;AAC7E,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,kBAAkB,EAClB,iCAAiC,EACjC,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,kCAAkC,EAClC,uBAAuB,EACxB,6BAAgB;AAEjB;;GAEG;AACH,qBAAa,KAAM,SAAQ,uBAAuB,CAAC,uBAAuB,CAAC,KAAK,CAAC;IAC/E;;OAEG;gBACS,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO;IAKnD,SAAS,CAAC,IAAI,gCAA0C;IAExD;;;;;;;;OAQG;IACY,cAAc,EAAE,eAAe,CAC5C,IAAI,CAAC,iCAAiC,EAAE,MAAM,CAAC,EAC/C,SAAS,CACV,CAAC;IAEF;;;;;;;OAOG;IACY,eAAe,EAAE,eAAe,CAC7C,IAAI,CAAC,kCAAkC,EAAE,MAAM,CAAC,EAChD,SAAS,CACV,CAAC;IAEF;;;;OAIG;IACY,kBAAkB,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAEpE;;;;;;;;;;OAUG;IACY,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC;IAEpF;;;;;OAKG;IACY,WAAW,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAExD;;;;;;;;OAQG;IACY,GAAG,EAAE,MAAM,OAAO,CAAC,0BAA0B,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAExF;;;;;;OAMG;IACI,aAAa,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IAE/C;;;OAGG;IACY,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;CACpD"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Count = void 0;
4
- const internal_1 = require("../../../../../internal");
5
- const types_1 = require("../../../../../types");
6
- /**
7
- * Handles all Count Transfer Restriction related functionality
8
- */
9
- class Count extends internal_1.TransferRestrictionBase {
10
- /**
11
- * @hidden
12
- */
13
- constructor(parent, context) {
14
- super(parent, context);
15
- this.type = types_1.TransferRestrictionType.Count;
16
- this.investorCount = parent.investorCount.bind(parent);
17
- }
18
- }
19
- exports.Count = Count;
20
- //# sourceMappingURL=Count.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Count.js","sourceRoot":"","sources":["../../../../../../src/api/entities/Asset/Fungible/TransferRestrictions/Count.ts"],"names":[],"mappings":";;;AAEA,sDAA6E;AAC7E,gDAUiB;AAEjB;;GAEG;AACH,MAAa,KAAM,SAAQ,kCAAsD;IAC/E;;OAEG;IACH,YAAY,MAAqB,EAAE,OAAgB;QACjD,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAIf,SAAI,GAAG,+BAAuB,CAAC,KAAc,CAAC;QAHtD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;CAoFF;AA3FD,sBA2FC"}
@@ -1,59 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { TransferRestrictionBase } from "../../../../../internal";
3
- import { ActiveStats, ActiveTransferRestrictions, AddPercentageTransferRestrictionParams, NoArgsProcedureMethod, PercentageTransferRestriction, ProcedureMethod, SetPercentageTransferRestrictionsParams, TransferRestrictionType } from "../../../../../types";
4
- /**
5
- * Handles all Percentage Transfer Restriction related functionality
6
- */
7
- export declare class Percentage extends TransferRestrictionBase<TransferRestrictionType.Percentage> {
8
- protected type: TransferRestrictionType.Percentage;
9
- /**
10
- * Add a Percentage Transfer Restriction to this Asset. This limits the total percentage of the supply
11
- * a single investor can acquire without an exemption
12
- *
13
- * @returns the total amount of restrictions after the procedure has run
14
- *
15
- * @throws if the Balance statistic is not enabled for this Asset. {@link Percentage.enableStat} should be called before this method
16
- */
17
- addRestriction: ProcedureMethod<Omit<AddPercentageTransferRestrictionParams, 'type'>, BigNumber>;
18
- /**
19
- * Sets all Percentage Transfer Restrictions on this Asset
20
- *
21
- * @note this method sets exempted Identities for restrictions as well. If an Identity is currently exempted from a Percentage Transfer Restriction
22
- * but not passed into this call then it will be removed
23
- *
24
- * @note the result is the total amount of restrictions after the procedure has run
25
- */
26
- setRestrictions: ProcedureMethod<Omit<SetPercentageTransferRestrictionsParams, 'type'>, BigNumber>;
27
- /**
28
- * Removes all Percentage Transfer Restrictions from this Asset
29
- *
30
- * @note the result is the total amount of restrictions after the procedure has run
31
- */
32
- removeRestrictions: NoArgsProcedureMethod<BigNumber>;
33
- /**
34
- * Enables investor balance statistic for the Asset, which is required before creating restrictions
35
- * that limit the total ownership of the Assets' supply
36
- */
37
- enableStat: NoArgsProcedureMethod<void>;
38
- /**
39
- * Disables the investor balance statistic for the Asset. Since statistics introduce slight overhead to each transaction
40
- * involving the Asset, disabling unused stats will reduce gas fees for investors when they transact with the Asset
41
- *
42
- * @throws if the stat is being used by a restriction or is not set
43
- */
44
- disableStat: NoArgsProcedureMethod<void>;
45
- /**
46
- * Retrieve all active Percentage Transfer Restrictions
47
- *
48
- * @note there is a maximum number of restrictions allowed across all types.
49
- * The `availableSlots` property of the result represents how many more restrictions can be added
50
- * before reaching that limit
51
- */
52
- get: () => Promise<ActiveTransferRestrictions<PercentageTransferRestriction>>;
53
- /**
54
- * Retrieve current Percentage Transfer Restriction investor balance statistic for the Asset
55
- *
56
- */
57
- getStat: () => Promise<ActiveStats>;
58
- }
59
- //# sourceMappingURL=Percentage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Percentage.d.ts","sourceRoot":"","sources":["../../../../../../src/api/entities/Asset/Fungible/TransferRestrictions/Percentage.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,uBAAuB,EAAE,gCAAmB;AACrD,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,sCAAsC,EACtC,qBAAqB,EACrB,6BAA6B,EAC7B,eAAe,EACf,uCAAuC,EACvC,uBAAuB,EACxB,6BAAgB;AAEjB;;GAEG;AACH,qBAAa,UAAW,SAAQ,uBAAuB,CAAC,uBAAuB,CAAC,UAAU,CAAC;IACzF,SAAS,CAAC,IAAI,qCAA+C;IAE7D;;;;;;;OAOG;IACY,cAAc,EAAE,eAAe,CAC5C,IAAI,CAAC,sCAAsC,EAAE,MAAM,CAAC,EACpD,SAAS,CACV,CAAC;IAEF;;;;;;;OAOG;IACY,eAAe,EAAE,eAAe,CAC7C,IAAI,CAAC,uCAAuC,EAAE,MAAM,CAAC,EACrD,SAAS,CACV,CAAC;IAEF;;;;OAIG;IACY,kBAAkB,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAEpE;;;OAGG;IACY,UAAU,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAEvD;;;;;OAKG;IACY,WAAW,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAExD;;;;;;OAMG;IACY,GAAG,EAAE,MAAM,OAAO,CAAC,0BAA0B,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAE7F;;;OAGG;IACY,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;CACpD"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Percentage = void 0;
4
- const internal_1 = require("../../../../../internal");
5
- const types_1 = require("../../../../../types");
6
- /**
7
- * Handles all Percentage Transfer Restriction related functionality
8
- */
9
- class Percentage extends internal_1.TransferRestrictionBase {
10
- constructor() {
11
- super(...arguments);
12
- this.type = types_1.TransferRestrictionType.Percentage;
13
- }
14
- }
15
- exports.Percentage = Percentage;
16
- //# sourceMappingURL=Percentage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Percentage.js","sourceRoot":"","sources":["../../../../../../src/api/entities/Asset/Fungible/TransferRestrictions/Percentage.ts"],"names":[],"mappings":";;;AAEA,sDAAqD;AACrD,gDASiB;AAEjB;;GAEG;AACH,MAAa,UAAW,SAAQ,kCAA2D;IAA3F;;QACY,SAAI,GAAG,+BAAuB,CAAC,UAAmB,CAAC;IA+D/D,CAAC;CAAA;AAhED,gCAgEC"}
@@ -1,62 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { Context, FungibleAsset, Namespace } from "../../../../../internal";
3
- import { ActiveStats, AddRestrictionParams, GetTransferRestrictionReturnType, NoArgsProcedureMethod, ProcedureMethod, RemoveBalanceStatParams, RemoveCountStatParams, RemoveScopedBalanceParams, RemoveScopedCountParams, SetAssetStatParams, SetClaimCountTransferRestrictionsParams, SetClaimPercentageTransferRestrictionsParams, SetCountTransferRestrictionsParams, SetPercentageTransferRestrictionsParams, SetRestrictionsParams, TransferRestrictionType } from "../../../../../types";
4
- export declare type SetTransferRestrictionsParams = {
5
- asset: FungibleAsset;
6
- } & (SetCountTransferRestrictionsParams | SetPercentageTransferRestrictionsParams | SetClaimCountTransferRestrictionsParams | SetClaimPercentageTransferRestrictionsParams);
7
- export declare type RemoveAssetStatParamsBase<T> = Omit<T extends TransferRestrictionType.Count ? RemoveCountStatParams : T extends TransferRestrictionType.Percentage ? RemoveBalanceStatParams : T extends TransferRestrictionType.ClaimCount ? RemoveScopedCountParams : RemoveScopedBalanceParams, 'type'>;
8
- /**
9
- * Base class for managing Transfer Restrictions
10
- */
11
- export declare abstract class TransferRestrictionBase<T extends TransferRestrictionType> extends Namespace<FungibleAsset> {
12
- protected abstract type: T;
13
- /**
14
- * @hidden
15
- */
16
- constructor(parent: FungibleAsset, context: Context);
17
- /**
18
- * Add a Transfer Restriction of the corresponding type to this Asset
19
- *
20
- * @note the result is the total amount of restrictions after the procedure has run
21
- */
22
- addRestriction: ProcedureMethod<AddRestrictionParams<T>, BigNumber>;
23
- /**
24
- * Sets all Transfer Restrictions of the corresponding type on this Asset
25
- *
26
- * @note the result is the total amount of restrictions after the procedure has run
27
- */
28
- setRestrictions: ProcedureMethod<SetRestrictionsParams<T>, BigNumber>;
29
- /**
30
- * Removes all Transfer Restrictions of the corresponding type from this Asset
31
- *
32
- * @note the result is the total amount of restrictions after the procedure has run
33
- */
34
- removeRestrictions: NoArgsProcedureMethod<BigNumber>;
35
- /**
36
- * Enables statistic of the corresponding type for this Asset, which are required for restrictions to be created
37
- */
38
- enableStat: ProcedureMethod<SetAssetStatParams<T>, void>;
39
- /**
40
- * Removes an Asset statistic
41
- *
42
- * @throws if the statistic is being used or is not set
43
- */
44
- disableStat: ProcedureMethod<RemoveAssetStatParamsBase<T>, void>;
45
- /**
46
- * Retrieve all active Transfer Restrictions of the corresponding type
47
- *
48
- * @note there is a maximum number of restrictions allowed across all types.
49
- * The `availableSlots` property of the result represents how many more restrictions can be added
50
- * before reaching that limit
51
- */
52
- get(): Promise<GetTransferRestrictionReturnType<T>>;
53
- /**
54
- * Retrieve all active Transfer Restrictions of the corresponding type
55
- *
56
- * @note there is a maximum number of restrictions allowed across all types.
57
- * The `availableSlots` property of the result represents how many more restrictions can be added
58
- * before reaching that limit
59
- */
60
- getStat(): Promise<ActiveStats>;
61
- }
62
- //# sourceMappingURL=TransferRestrictionBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransferRestrictionBase.d.ts","sourceRoot":"","sources":["../../../../../../src/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAIL,OAAO,EACP,aAAa,EAEb,SAAS,EAIV,gCAAmB;AACpB,OAAO,EACL,WAAW,EAEX,oBAAoB,EAGpB,gCAAgC,EAChC,qBAAqB,EACrB,eAAe,EAEf,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,uCAAuC,EACvC,4CAA4C,EAC5C,kCAAkC,EAClC,uCAAuC,EACvC,qBAAqB,EAErB,uBAAuB,EACxB,6BAAgB;AAajB,oBAAY,6BAA6B,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG,CACnE,kCAAkC,GAClC,uCAAuC,GACvC,uCAAuC,GACvC,4CAA4C,CAC/C,CAAC;AAEF,oBAAY,yBAAyB,CAAC,CAAC,IAAI,IAAI,CAC7C,CAAC,SAAS,uBAAuB,CAAC,KAAK,GACnC,qBAAqB,GACrB,CAAC,SAAS,uBAAuB,CAAC,UAAU,GAC5C,uBAAuB,GACvB,CAAC,SAAS,uBAAuB,CAAC,UAAU,GAC5C,uBAAuB,GACvB,yBAAyB,EAC7B,MAAM,CACP,CAAC;AASF;;GAEG;AACH,8BAAsB,uBAAuB,CAC3C,CAAC,SAAS,uBAAuB,CACjC,SAAQ,SAAS,CAAC,aAAa,CAAC;IAChC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3B;;OAEG;gBACS,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO;IAoFnD;;;;OAIG;IACI,cAAc,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAE3E;;;;OAIG;IACI,eAAe,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAE7E;;;;OAIG;IACI,kBAAkB,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAE5D;;OAEG;IACI,UAAU,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAEhE;;;;OAIG;IACI,WAAW,EAAE,eAAe,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAExE;;;;;;OAMG;IACU,GAAG,IAAI,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC;IA8GhE;;;;;;OAMG;IACU,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;CAkD7C"}
@@ -1,189 +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.TransferRestrictionBase = void 0;
13
- const internal_1 = require("../../../../../internal");
14
- const types_1 = require("../../../../../types");
15
- const conversion_1 = require("../../../../../utils/conversion");
16
- const internal_2 = require("../../../../../utils/internal");
17
- const restrictionTypeToStatType = {
18
- [types_1.TransferRestrictionType.Count]: types_1.StatType.Count,
19
- [types_1.TransferRestrictionType.Percentage]: types_1.StatType.Balance,
20
- [types_1.TransferRestrictionType.ClaimCount]: types_1.StatType.ScopedCount,
21
- [types_1.TransferRestrictionType.ClaimPercentage]: types_1.StatType.ScopedBalance,
22
- };
23
- /**
24
- * Base class for managing Transfer Restrictions
25
- */
26
- class TransferRestrictionBase extends internal_1.Namespace {
27
- /**
28
- * @hidden
29
- */
30
- constructor(parent, context) {
31
- super(parent, context);
32
- this.addRestriction = (0, internal_2.createProcedureMethod)({
33
- getProcedureAndArgs: args => [
34
- internal_1.addTransferRestriction,
35
- Object.assign(Object.assign({}, args), { type: this.type, asset: parent }),
36
- ],
37
- }, context);
38
- this.setRestrictions = (0, internal_2.createProcedureMethod)({
39
- getProcedureAndArgs: args => [
40
- internal_1.setTransferRestrictions,
41
- Object.assign(Object.assign({}, args), { type: this.type, asset: parent }),
42
- ],
43
- }, context);
44
- this.removeRestrictions = (0, internal_2.createProcedureMethod)({
45
- getProcedureAndArgs: () => [
46
- internal_1.setTransferRestrictions,
47
- {
48
- restrictions: [],
49
- type: this.type,
50
- asset: parent,
51
- },
52
- ],
53
- voidArgs: true,
54
- }, context);
55
- this.enableStat = (0, internal_2.createProcedureMethod)({
56
- getProcedureAndArgs: args => [
57
- internal_1.addAssetStat,
58
- Object.assign(Object.assign({}, args), { type: restrictionTypeToStatType[this.type], asset: parent }),
59
- ],
60
- }, context);
61
- this.disableStat = (0, internal_2.createProcedureMethod)({
62
- getProcedureAndArgs: args => [
63
- internal_1.removeAssetStat,
64
- Object.assign(Object.assign({}, args), { type: restrictionTypeToStatType[this.type], asset: parent }),
65
- ],
66
- }, context);
67
- }
68
- /**
69
- * Retrieve all active Transfer Restrictions of the corresponding type
70
- *
71
- * @note there is a maximum number of restrictions allowed across all types.
72
- * The `availableSlots` property of the result represents how many more restrictions can be added
73
- * before reaching that limit
74
- */
75
- get() {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const { parent, context: { polymeshApi: { query: { statistics }, consts, }, }, context, type, } = this;
78
- const rawAssetId = (0, conversion_1.stringToAssetId)(parent.id, context);
79
- const { requirements } = yield statistics.assetTransferCompliances(rawAssetId);
80
- const existingRequirementCount = [...requirements].length;
81
- const filteredRequirements = [...requirements].filter(requirement => {
82
- if (type === types_1.TransferRestrictionType.Count) {
83
- return requirement.isMaxInvestorCount;
84
- }
85
- else if (type === types_1.TransferRestrictionType.Percentage) {
86
- return requirement.isMaxInvestorOwnership;
87
- }
88
- else if (type === types_1.TransferRestrictionType.ClaimCount) {
89
- return requirement.isClaimCount;
90
- }
91
- else {
92
- return requirement.isClaimOwnership;
93
- }
94
- });
95
- const rawAssetKey = { assetId: rawAssetId };
96
- const rawExemptedLists = yield Promise.all(filteredRequirements.map(req => {
97
- const { value } = (0, conversion_1.transferConditionToTransferRestriction)(req, context);
98
- if (req.isClaimCount) {
99
- const { claim } = value;
100
- return statistics.transferConditionExemptEntities.entries(Object.assign(Object.assign({}, rawAssetKey), { op: (0, conversion_1.transferRestrictionTypeToStatOpType)(types_1.TransferRestrictionType.ClaimCount, context), claimType: claim.type }));
101
- }
102
- else if (req.isClaimOwnership) {
103
- const { claim } = value;
104
- return statistics.transferConditionExemptEntities.entries(Object.assign(Object.assign({}, rawAssetKey), { op: (0, conversion_1.transferRestrictionTypeToStatOpType)(types_1.TransferRestrictionType.ClaimPercentage, context), claimType: claim.type }));
105
- }
106
- else {
107
- return statistics.transferConditionExemptEntities.entries(Object.assign(Object.assign({}, rawAssetKey), { op: (0, conversion_1.transferRestrictionTypeToStatOpType)(type, context) }));
108
- }
109
- }));
110
- const restrictions = rawExemptedLists.map((list, index) => {
111
- const exemptedIds = list.map(([{ args: [, scopeId], },]) => (0, conversion_1.identityIdToString)(scopeId) // `ScopeId` and `PolymeshPrimitivesIdentityId` are the same type, so this is fine
112
- );
113
- const { value } = (0, conversion_1.transferConditionToTransferRestriction)(filteredRequirements[index], context);
114
- let restriction;
115
- if (type === types_1.TransferRestrictionType.Count) {
116
- restriction = {
117
- count: value,
118
- };
119
- }
120
- else if (type === types_1.TransferRestrictionType.Percentage) {
121
- restriction = {
122
- percentage: value,
123
- };
124
- }
125
- else {
126
- const { min, max, claim, issuer } = value;
127
- restriction = {
128
- min,
129
- max,
130
- claim,
131
- issuer,
132
- };
133
- }
134
- if (exemptedIds.length) {
135
- return Object.assign(Object.assign({}, restriction), { exemptedIds });
136
- }
137
- return restriction;
138
- });
139
- const maxTransferConditions = (0, conversion_1.u32ToBigNumber)(consts.statistics.maxTransferConditionsPerAsset);
140
- return {
141
- restrictions,
142
- availableSlots: maxTransferConditions.minus(existingRequirementCount),
143
- };
144
- });
145
- }
146
- /**
147
- * Retrieve all active Transfer Restrictions of the corresponding type
148
- *
149
- * @note there is a maximum number of restrictions allowed across all types.
150
- * The `availableSlots` property of the result represents how many more restrictions can be added
151
- * before reaching that limit
152
- */
153
- getStat() {
154
- return __awaiter(this, void 0, void 0, function* () {
155
- const { parent, context, context: { polymeshApi: { query: { statistics }, }, }, type, } = this;
156
- const rawAssetId = (0, conversion_1.assetToMeshAssetId)(parent, context);
157
- const currentStats = yield statistics.activeAssetStats(rawAssetId);
158
- let isSet = false;
159
- const claims = [];
160
- const pushClaims = (stat) => {
161
- const [rawClaimType, rawIssuer] = stat.claimIssuer.unwrap();
162
- const claimType = (0, conversion_1.meshClaimTypeToClaimType)(rawClaimType);
163
- const issuer = new internal_1.Identity({ did: (0, conversion_1.identityIdToString)(rawIssuer) }, context);
164
- claims.push({ claimType, issuer });
165
- };
166
- [...currentStats].forEach(stat => {
167
- const statType = (0, conversion_1.meshStatToStatType)(stat);
168
- if (type === types_1.TransferRestrictionType.ClaimCount && statType === types_1.StatType.ScopedCount) {
169
- isSet = true;
170
- pushClaims(stat);
171
- }
172
- else if (type === types_1.TransferRestrictionType.ClaimPercentage &&
173
- statType === types_1.StatType.ScopedBalance) {
174
- isSet = true;
175
- pushClaims(stat);
176
- }
177
- else if (type === types_1.TransferRestrictionType.Percentage && statType === types_1.StatType.Balance) {
178
- isSet = true;
179
- }
180
- else if (type === types_1.TransferRestrictionType.Count && statType === types_1.StatType.Count) {
181
- isSet = true;
182
- }
183
- });
184
- return Object.assign({ isSet }, (claims.length ? { claims } : {}));
185
- });
186
- }
187
- }
188
- exports.TransferRestrictionBase = TransferRestrictionBase;
189
- //# sourceMappingURL=TransferRestrictionBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransferRestrictionBase.js","sourceRoot":"","sources":["../../../../../../src/api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAWoB;AACpB,gDAsBiB;AACjB,gEAS4B;AAC5B,4DAAyD;AAoBzD,MAAM,yBAAyB,GAAG;IAChC,CAAC,+BAAuB,CAAC,KAAK,CAAC,EAAE,gBAAQ,CAAC,KAAK;IAC/C,CAAC,+BAAuB,CAAC,UAAU,CAAC,EAAE,gBAAQ,CAAC,OAAO;IACtD,CAAC,+BAAuB,CAAC,UAAU,CAAC,EAAE,gBAAQ,CAAC,WAAW;IAC1D,CAAC,+BAAuB,CAAC,eAAe,CAAC,EAAE,gBAAQ,CAAC,aAAa;CAClE,CAAC;AAEF;;GAEG;A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../internal";
2
- import { AddAssetStatParams } from "../../types";
3
- import { BatchTransactionSpec, ProcedureAuthorization } from "../../types/internal";
4
- /**
5
- * @hidden
6
- */
7
- export declare function prepareAddAssetStat(this: Procedure<AddAssetStatParams, void>, args: AddAssetStatParams): Promise<BatchTransactionSpec<void, unknown[][]>>;
8
- /**
9
- * @hidden
10
- */
11
- export declare function getAuthorization(this: Procedure<AddAssetStatParams, void>, { type, asset }: AddAssetStatParams): ProcedureAuthorization;
12
- /**
13
- * @hidden
14
- */
15
- export declare const addAssetStat: () => Procedure<AddAssetStatParams, void>;
16
- //# sourceMappingURL=addAssetStat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addAssetStat.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/addAssetStat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,uBAAmB;AACtD,OAAO,EAAE,kBAAkB,EAA+B,oBAAgB;AAC1E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,6BAAyB;AAYhF;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,EACzC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAgElD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,EACzC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,kBAAkB,GAClC,sBAAsB,CAYxB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,QAAO,UAAU,kBAAkB,EAAE,IAAI,CACZ,CAAC"}
@@ -1,87 +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.addAssetStat = exports.getAuthorization = exports.prepareAddAssetStat = void 0;
13
- const internal_1 = require("../../internal");
14
- const types_1 = require("../../types");
15
- const conversion_1 = require("../../utils/conversion");
16
- const internal_2 = require("../../utils/internal");
17
- /**
18
- * @hidden
19
- */
20
- function prepareAddAssetStat(args) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const { context: { polymeshApi: { query: { statistics: statisticsQuery }, tx: { statistics }, }, }, context, } = this;
23
- const { asset, type } = args;
24
- const rawAssetId = (0, conversion_1.assetToMeshAssetId)(asset, context);
25
- const currentStats = yield statisticsQuery.activeAssetStats(rawAssetId);
26
- const needStat = ![...currentStats].find(s => (0, internal_2.compareStatsToInput)(s, args));
27
- if (!needStat) {
28
- throw new internal_1.PolymeshError({
29
- code: types_1.ErrorCode.NoDataChange,
30
- message: 'Stat is already enabled',
31
- });
32
- }
33
- const operationType = (0, conversion_1.statTypeToStatOpType)(type, context);
34
- const transactions = [];
35
- let rawClaimIssuer;
36
- if (type === types_1.StatType.ScopedCount || type === types_1.StatType.ScopedBalance) {
37
- rawClaimIssuer = (0, conversion_1.claimIssuerToMeshClaimIssuer)(args, context);
38
- }
39
- const newStat = (0, conversion_1.statisticsOpTypeToStatType)({ operationType, claimIssuer: rawClaimIssuer }, context);
40
- const newStats = (0, conversion_1.statisticStatTypesToBtreeStatType)([...currentStats, newStat], context);
41
- transactions.push((0, internal_2.checkTxType)({
42
- transaction: statistics.setActiveAssetStats,
43
- args: [rawAssetId, newStats],
44
- }));
45
- // Count stats need the user to provide the initial value for the counter as computing may cause prohibitive gas charges on the chain
46
- // We require users to provide initial stats in this method so they won't miss setting initial values. It could be its own step
47
- if (args.type === types_1.StatType.Count) {
48
- const statValue = (0, conversion_1.countStatInputToStatUpdates)(args, context);
49
- transactions.push((0, internal_2.checkTxType)({
50
- transaction: statistics.batchUpdateAssetStats,
51
- args: [rawAssetId, newStat, statValue],
52
- }));
53
- }
54
- else if (args.type === types_1.StatType.ScopedCount) {
55
- const statValue = (0, conversion_1.claimCountStatInputToStatUpdates)(args, context);
56
- transactions.push((0, internal_2.checkTxType)({
57
- transaction: statistics.batchUpdateAssetStats,
58
- args: [rawAssetId, newStat, statValue],
59
- }));
60
- }
61
- return { transactions, resolver: undefined };
62
- });
63
- }
64
- exports.prepareAddAssetStat = prepareAddAssetStat;
65
- /**
66
- * @hidden
67
- */
68
- function getAuthorization({ type, asset }) {
69
- const transactions = [types_1.TxTags.statistics.SetActiveAssetStats];
70
- if (type === types_1.StatType.Count || type === types_1.StatType.ScopedCount) {
71
- transactions.push(types_1.TxTags.statistics.BatchUpdateAssetStats);
72
- }
73
- return {
74
- permissions: {
75
- transactions,
76
- assets: [asset],
77
- portfolios: [],
78
- },
79
- };
80
- }
81
- exports.getAuthorization = getAuthorization;
82
- /**
83
- * @hidden
84
- */
85
- const addAssetStat = () => new internal_1.Procedure(prepareAddAssetStat, getAuthorization);
86
- exports.addAssetStat = addAssetStat;
87
- //# sourceMappingURL=addAssetStat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addAssetStat.js","sourceRoot":"","sources":["../../../src/api/procedures/addAssetStat.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,uCAA0E;AAE1E,uDAQ4B;AAC5B,mDAAoE;AAEpE;;GAEG;AACH,SAAsB,mBAAmB,CAEvC,IAAwB;;QAExB,MAAM,EACJ,OAAO,EAAE,EACP,WAAW,EAAE,EACX,KAAK,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,EACtC,EAAE,EAAE,EAAE,UAAU,EAAE,GACnB,GACF,EACD,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AG,GAAwC,EAAE,CACpE,IAAI,oBAAS,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAD1C,QAAA,YAAY,gBAC8B"}
@@ -1,23 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { FungibleAsset, Procedure } from "../../internal";
3
- import { AddClaimCountTransferRestrictionParams, AddClaimPercentageTransferRestrictionParams, AddCountTransferRestrictionParams, AddPercentageTransferRestrictionParams } from "../../types";
4
- import { BatchTransactionSpec, ProcedureAuthorization } from "../../types/internal";
5
- /**
6
- * @hidden
7
- */
8
- export declare type AddTransferRestrictionParams = {
9
- asset: FungibleAsset;
10
- } & (AddCountTransferRestrictionParams | AddPercentageTransferRestrictionParams | AddClaimCountTransferRestrictionParams | AddClaimPercentageTransferRestrictionParams);
11
- /**
12
- * @hidden
13
- */
14
- export declare function prepareAddTransferRestriction(this: Procedure<AddTransferRestrictionParams, BigNumber>, args: AddTransferRestrictionParams): Promise<BatchTransactionSpec<BigNumber, unknown[][]>>;
15
- /**
16
- * @hidden
17
- */
18
- export declare function getAuthorization(this: Procedure<AddTransferRestrictionParams, BigNumber>, { asset, exemptedIdentities }: AddTransferRestrictionParams): ProcedureAuthorization;
19
- /**
20
- * @hidden
21
- */
22
- export declare const addTransferRestriction: () => Procedure<AddTransferRestrictionParams, BigNumber>;
23
- //# sourceMappingURL=addTransferRestriction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addTransferRestriction.d.ts","sourceRoot":"","sources":["../../../src/api/procedures/addTransferRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,uBAAmB;AACrE,OAAO,EACL,sCAAsC,EACtC,2CAA2C,EAC3C,iCAAiC,EACjC,sCAAsC,EAKvC,oBAAgB;AACjB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,6BAAyB;AAiBhF;;GAEG;AACH,oBAAY,4BAA4B,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG,CAClE,iCAAiC,GACjC,sCAAsC,GACtC,sCAAsC,GACtC,2CAA2C,CAC9C,CAAC;AAEF;;GAEG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,SAAS,CAAC,4BAA4B,EAAE,SAAS,CAAC,EACxD,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAwGvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,4BAA4B,EAAE,SAAS,CAAC,EACxD,EAAE,KAAK,EAAE,kBAAuB,EAAE,EAAE,4BAA4B,GAC/D,sBAAsB,CAcxB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO,UAAU,4BAA4B,EAAE,SAAS,CAC3B,CAAC"}