@polymeshassociation/polymesh-sdk 22.0.0-alpha.2 → 22.0.0-alpha.4
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 +8 -3
- package/api/client/AccountManagement.d.ts +1 -1
- package/api/client/AccountManagement.js +1 -1
- package/api/client/Claims.d.ts +3 -58
- package/api/client/Claims.d.ts.map +1 -1
- package/api/client/Claims.js +13 -121
- package/api/client/Claims.js.map +1 -1
- package/api/client/Network.d.ts +9 -60
- package/api/client/Network.d.ts.map +1 -1
- package/api/client/Network.js +9 -141
- package/api/client/Network.js.map +1 -1
- package/api/client/Polymesh.d.ts +0 -9
- package/api/client/Polymesh.d.ts.map +1 -1
- package/api/client/Polymesh.js +2 -26
- package/api/client/Polymesh.js.map +1 -1
- package/api/entities/Account/index.d.ts +2 -24
- package/api/entities/Account/index.d.ts.map +1 -1
- package/api/entities/Account/index.js +10 -91
- package/api/entities/Account/index.js.map +1 -1
- package/api/entities/Account/types.d.ts +1 -1
- package/api/entities/Account/types.d.ts.map +1 -1
- package/api/entities/Asset/index.d.ts +2 -17
- package/api/entities/Asset/index.d.ts.map +1 -1
- package/api/entities/Asset/index.js +11 -93
- package/api/entities/Asset/index.js.map +1 -1
- package/api/entities/Asset/types.d.ts +1 -1
- package/api/entities/Asset/types.d.ts.map +1 -1
- package/api/entities/DefaultTrustedClaimIssuer.d.ts +1 -8
- package/api/entities/DefaultTrustedClaimIssuer.d.ts.map +1 -1
- package/api/entities/DefaultTrustedClaimIssuer.js +3 -24
- package/api/entities/DefaultTrustedClaimIssuer.js.map +1 -1
- package/api/entities/DividendDistribution/index.d.ts +2 -18
- package/api/entities/DividendDistribution/index.d.ts.map +1 -1
- package/api/entities/DividendDistribution/index.js +4 -90
- package/api/entities/DividendDistribution/index.js.map +1 -1
- package/api/entities/Identity/AssetPermissions.d.ts +5 -34
- package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
- package/api/entities/Identity/AssetPermissions.js +18 -106
- package/api/entities/Identity/AssetPermissions.js.map +1 -1
- package/api/entities/Identity/index.d.ts +4 -21
- package/api/entities/Identity/index.d.ts.map +1 -1
- package/api/entities/Identity/index.js +5 -56
- package/api/entities/Identity/index.js.map +1 -1
- package/api/entities/Instruction/index.d.ts +2 -13
- package/api/entities/Instruction/index.d.ts.map +1 -1
- package/api/entities/Instruction/index.js +28 -81
- package/api/entities/Instruction/index.js.map +1 -1
- package/api/entities/NumberedPortfolio.d.ts +1 -8
- package/api/entities/NumberedPortfolio.d.ts.map +1 -1
- package/api/entities/NumberedPortfolio.js +5 -28
- package/api/entities/NumberedPortfolio.js.map +1 -1
- package/api/entities/Offering/index.d.ts +1 -14
- package/api/entities/Offering/index.d.ts.map +1 -1
- package/api/entities/Offering/index.js +3 -48
- package/api/entities/Offering/index.js.map +1 -1
- package/api/entities/Portfolio/index.d.ts +2 -19
- package/api/entities/Portfolio/index.d.ts.map +1 -1
- package/api/entities/Portfolio/index.js +15 -92
- package/api/entities/Portfolio/index.js.map +1 -1
- package/api/entities/Portfolio/types.d.ts +2 -1
- package/api/entities/Portfolio/types.d.ts.map +1 -1
- package/api/entities/Venue/index.js +2 -2
- package/api/entities/Venue/index.js.map +1 -1
- package/api/entities/Venue/types.d.ts +1 -1
- package/api/entities/Venue/types.d.ts.map +1 -1
- package/api/entities/common/namespaces/Authorizations.js +2 -2
- package/api/entities/common/namespaces/Authorizations.js.map +1 -1
- package/api/procedures/modifyClaims.d.ts.map +1 -1
- package/api/procedures/modifyClaims.js +15 -21
- package/api/procedures/modifyClaims.js.map +1 -1
- package/base/Context.d.ts +5 -73
- package/base/Context.d.ts.map +1 -1
- package/base/Context.js +39 -206
- package/base/Context.js.map +1 -1
- package/base/PolymeshTransactionBase.d.ts.map +1 -1
- package/base/PolymeshTransactionBase.js +3 -20
- package/base/PolymeshTransactionBase.js.map +1 -1
- package/middleware/{enumsV2.d.ts → enums.d.ts} +3 -3
- package/middleware/enums.d.ts.map +1 -0
- package/middleware/{enumsV2.js → enums.js} +20 -20
- package/middleware/enums.js.map +1 -0
- package/middleware/queries.d.ts +105 -42
- package/middleware/queries.d.ts.map +1 -1
- package/middleware/queries.js +841 -397
- package/middleware/queries.js.map +1 -1
- package/middleware/types.d.ts +30888 -1459
- package/middleware/types.d.ts.map +1 -1
- package/middleware/types.js +3212 -904
- package/middleware/types.js.map +1 -1
- package/middleware/typesV1.d.ts +27 -0
- package/middleware/typesV1.d.ts.map +1 -0
- package/middleware/typesV1.js +28 -0
- package/middleware/typesV1.js.map +1 -0
- package/npm-package/polymeshassociation-polymesh-sdk-22.0.0-alpha.4.tgz +0 -0
- package/package.json +3 -4
- package/types/index.d.ts +4 -4
- package/types/index.d.ts.map +1 -1
- package/types/index.js +8 -13
- package/types/index.js.map +1 -1
- package/types/internal.d.ts +1 -6
- package/types/internal.d.ts.map +1 -1
- package/types/internal.js.map +1 -1
- package/types/utils/index.d.ts +1 -2
- package/types/utils/index.d.ts.map +1 -1
- package/types/utils/index.js.map +1 -1
- package/utils/conversion.d.ts +9 -25
- package/utils/conversion.d.ts.map +1 -1
- package/utils/conversion.js +385 -433
- package/utils/conversion.js.map +1 -1
- package/utils/internal.d.ts +1 -1
- package/utils/internal.d.ts.map +1 -1
- package/utils/internal.js +2 -2
- package/utils/internal.js.map +1 -1
- package/middleware/enumsV2.d.ts.map +0 -1
- package/middleware/enumsV2.js.map +0 -1
- package/middleware/queriesV2.d.ts +0 -192
- package/middleware/queriesV2.d.ts.map +0 -1
- package/middleware/queriesV2.js +0 -1145
- package/middleware/queriesV2.js.map +0 -1
- package/middleware/typesV2.d.ts +0 -31094
- package/middleware/typesV2.d.ts.map +0 -1
- package/middleware/typesV2.js +0 -3215
- package/middleware/typesV2.js.map +0 -1
- package/npm-package/polymeshassociation-polymesh-sdk-22.0.0-alpha.2.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modifyClaims.js","sourceRoot":"","sources":["../../../src/api/procedures/modifyClaims.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,
|
|
1
|
+
{"version":3,"file":"modifyClaims.js","sourceRoot":"","sources":["../../../src/api/procedures/modifyClaims.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,mCAAgD;AAEhD,6CAAyE;AACzE,sDAAmD;AAEnD,uCAWiB;AAEjB,6CAA+C;AAC/C,qDAAmD;AACnD,uDAM4B;AAC5B,mDAAyE;AACzE,uDAAmD;AAEnD,MAAM,aAAa,GAAG,CAAC,KAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAmB,EAAW,EAAE;IAChF,IAAI,WAAW,GAAG,IAAI,CAAC;IAEvB,IAAI,IAAA,0BAAa,EAAC,KAAK,CAAC,EAAE;QACxB,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,gBAAO,EAAC,IAAA,mCAAsB,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;KACnF;IAED,oCAAoC;IACpC,IACE,IAAI,KAAK,qBAAa,CAAC,MAAM;QAC7B,IAAI,KAAK,qBAAa,CAAC,MAAM;QAC7B,IAAI,KAAK,qBAAa,CAAC,kBAAkB;QACzC,IAAI,KAAK,qBAAa,CAAC,oBAAoB,EAC3C;QACA,OAAO,KAAK,CAAC;KACd;IAED,OAAO,WAAW,IAAI,iBAAS,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAC/B,MAAqB,EACrB,WAA8C,EACrC,EAAE,CACX,MAAM,CAAC,MAAM,CAAU,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;;IACjD,MAAM,YAAY,GAAG,MAAA,WAAW,CAAC,IAAA,2BAAc,EAAC,MAAM,CAAC,CAAC,mCAAI,EAAE,CAAC;IAE/D,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC,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AC,CAAC,cAAM,CAAC,QAAQ,CAAC,QAAQ;SAC7F;QACD,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,EAAE;KACf,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,iBAAS,CAAC,oBAAoB,CAAC,EAAE;QACjF,OAAO;YACL,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAQ,CAAC,WAAW,EAAE,CAAC;YACvC,WAAW;SACZ,CAAC;KACH;IACD,OAAO;QACL,WAAW;KACZ,CAAC;AACJ,CAAC;AApBD,4CAoBC;AAED;;GAEG;AACI,MAAM,YAAY,GAAG,GAAwC,EAAE,CACpE,IAAI,oBAAS,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAD1C,QAAA,YAAY,gBAC8B"}
|
package/base/Context.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import BigNumber from 'bignumber.js';
|
|
|
6
6
|
import { HistoricPolyxTransaction } from "../api/entities/Account/types";
|
|
7
7
|
import { Account, Asset, Identity } from "../internal";
|
|
8
8
|
import { Query } from "../middleware/types";
|
|
9
|
-
import { Query as QueryV2 } from "../middleware/typesV2";
|
|
10
9
|
import { AccountBalance, ClaimData, ClaimType, DistributionWithDetails, MiddlewareMetadata, ProtocolFees, ResultSet, SubCallback, SubsidyWithAllowance, TransactionArgument, TxTag, UnsubCallback } from "../types";
|
|
11
10
|
/**
|
|
12
11
|
* @hidden
|
|
@@ -27,7 +26,6 @@ export declare class Context {
|
|
|
27
26
|
isArchiveNode: boolean;
|
|
28
27
|
ss58Format: BigNumber;
|
|
29
28
|
private _middlewareApi;
|
|
30
|
-
private _middlewareApiV2;
|
|
31
29
|
private _polymeshApi;
|
|
32
30
|
private _signingManager?;
|
|
33
31
|
private signingAddress?;
|
|
@@ -45,7 +43,6 @@ export declare class Context {
|
|
|
45
43
|
*/
|
|
46
44
|
static create(params: {
|
|
47
45
|
polymeshApi: ApiPromise;
|
|
48
|
-
middlewareApi: ApolloClient<NormalizedCacheObject> | null;
|
|
49
46
|
middlewareApiV2: ApolloClient<NormalizedCacheObject> | null;
|
|
50
47
|
signingManager?: SigningManager;
|
|
51
48
|
}): Promise<Context>;
|
|
@@ -202,39 +199,6 @@ export declare class Context {
|
|
|
202
199
|
size?: BigNumber;
|
|
203
200
|
start?: BigNumber;
|
|
204
201
|
}): Promise<ResultSet<ClaimData>>;
|
|
205
|
-
/**
|
|
206
|
-
* @hidden
|
|
207
|
-
*/
|
|
208
|
-
getIdentityClaimsFromMiddlewareV2(args: {
|
|
209
|
-
targets?: (string | Identity)[];
|
|
210
|
-
trustedClaimIssuers?: (string | Identity)[];
|
|
211
|
-
claimTypes?: ClaimType[];
|
|
212
|
-
includeExpired?: boolean;
|
|
213
|
-
size?: BigNumber;
|
|
214
|
-
start?: BigNumber;
|
|
215
|
-
}): Promise<ResultSet<ClaimData>>;
|
|
216
|
-
/**
|
|
217
|
-
* @hidden
|
|
218
|
-
*
|
|
219
|
-
* Retrieve a list of claims. Can be filtered using parameters
|
|
220
|
-
*
|
|
221
|
-
* @param opts.targets - Identities (or Identity IDs) for which to fetch claims (targets). Defaults to all targets
|
|
222
|
-
* @param opts.trustedClaimIssuers - Identity IDs of claim issuers. Defaults to all claim issuers
|
|
223
|
-
* @param opts.claimTypes - types of the claims to fetch. Defaults to any type
|
|
224
|
-
* @param opts.includeExpired - whether to include expired claims. Defaults to true
|
|
225
|
-
* @param opts.size - page size
|
|
226
|
-
* @param opts.start - page offset
|
|
227
|
-
*
|
|
228
|
-
* @note uses the middleware (optional)
|
|
229
|
-
*/
|
|
230
|
-
issuedClaims(opts?: {
|
|
231
|
-
targets?: (string | Identity)[];
|
|
232
|
-
trustedClaimIssuers?: (string | Identity)[];
|
|
233
|
-
claimTypes?: ClaimType[];
|
|
234
|
-
includeExpired?: boolean;
|
|
235
|
-
size?: BigNumber;
|
|
236
|
-
start?: BigNumber;
|
|
237
|
-
}): Promise<ResultSet<ClaimData>>;
|
|
238
202
|
/**
|
|
239
203
|
* @hidden
|
|
240
204
|
*
|
|
@@ -249,7 +213,7 @@ export declare class Context {
|
|
|
249
213
|
*
|
|
250
214
|
* @note uses the middleware V2 (optional)
|
|
251
215
|
*/
|
|
252
|
-
|
|
216
|
+
issuedClaims(opts?: {
|
|
253
217
|
targets?: (string | Identity)[];
|
|
254
218
|
trustedClaimIssuers?: (string | Identity)[];
|
|
255
219
|
claimTypes?: ClaimType[];
|
|
@@ -258,61 +222,29 @@ export declare class Context {
|
|
|
258
222
|
start?: BigNumber;
|
|
259
223
|
}): Promise<ResultSet<ClaimData>>;
|
|
260
224
|
/**
|
|
261
|
-
* @hidden
|
|
262
|
-
*
|
|
263
225
|
* Retrieve the middleware client
|
|
264
226
|
*
|
|
265
|
-
* @throws if the middleware is not enabled
|
|
266
|
-
*/
|
|
267
|
-
get middlewareApi(): ApolloClient<NormalizedCacheObject>;
|
|
268
|
-
/**
|
|
269
|
-
* Retrieve the middleware v2 client
|
|
270
|
-
*
|
|
271
227
|
* @throws if the middleware V2 is not enabled
|
|
272
228
|
*/
|
|
273
|
-
get
|
|
274
|
-
/**
|
|
275
|
-
* @hidden
|
|
276
|
-
*
|
|
277
|
-
* Make a query to the middleware server using the apollo client
|
|
278
|
-
*/
|
|
279
|
-
queryMiddleware<Result extends Partial<Query>>(query: QueryOptions<OperationVariables, Result>): Promise<ApolloQueryResult<Result>>;
|
|
229
|
+
get middlewareApi(): ApolloClient<NormalizedCacheObject>;
|
|
280
230
|
/**
|
|
281
231
|
* @hidden
|
|
282
232
|
*
|
|
283
233
|
* Make a query to the middleware V2 server using the apollo client
|
|
284
234
|
*/
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* @hidden
|
|
288
|
-
*
|
|
289
|
-
* Return whether the middleware was enabled at startup
|
|
290
|
-
*/
|
|
291
|
-
isMiddlewareEnabled(): boolean;
|
|
235
|
+
queryMiddleware<Result extends Partial<Query>>(query: QueryOptions<OperationVariables, Result>): Promise<ApolloQueryResult<Result>>;
|
|
292
236
|
/**
|
|
293
237
|
* @hidden
|
|
294
238
|
*
|
|
295
239
|
* Return whether the middleware V2 was enabled at startup
|
|
296
240
|
*/
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* @hidden
|
|
300
|
-
*
|
|
301
|
-
* Return whether any middleware was enabled at startup
|
|
302
|
-
*/
|
|
303
|
-
isAnyMiddlewareEnabled(): boolean;
|
|
304
|
-
/**
|
|
305
|
-
* @hidden
|
|
306
|
-
*
|
|
307
|
-
* Return whether the middleware is enabled and online
|
|
308
|
-
*/
|
|
309
|
-
isMiddlewareAvailable(): Promise<boolean>;
|
|
241
|
+
isMiddlewareEnabled(): boolean;
|
|
310
242
|
/**
|
|
311
243
|
* @hidden
|
|
312
244
|
*
|
|
313
245
|
* Return whether the middleware V2 is enabled and online
|
|
314
246
|
*/
|
|
315
|
-
|
|
247
|
+
isMiddlewareAvailable(): Promise<boolean>;
|
|
316
248
|
/**
|
|
317
249
|
* @hidden
|
|
318
250
|
*
|
package/base/Context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/base/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAW3C,OAAO,EAAgB,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,SAAS,MAAM,cAAc,CAAC;AAIrC,OAAO,EAAE,wBAAwB,EAAE,sCAAqC;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAwB,QAAQ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,CAAC,SAAS,MAAM,GAAG,MAAM,EAClE,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,OAAO,GACd,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;IAYpB;;;;OAIG;IACI,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI;IAIxC;;;;OAIG;IACI,QAAQ,IAAI,SAAS;IAM5B;;;;;OAKG;IACU,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAgCxE;;;;;;OAMG;IACU,oBAAoB,CAAC,IAAI,EAAE;QACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;QAC7B,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,KAAK,CAAC,EAAE,SAAS,CAAC;KACnB,GAAG,OAAO,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;CAoEjD"}
|
package/base/Context.js
CHANGED
|
@@ -18,11 +18,9 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
|
18
18
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
19
19
|
const lodash_1 = require("lodash");
|
|
20
20
|
const internal_1 = require("../internal");
|
|
21
|
-
const
|
|
21
|
+
const enums_1 = require("../middleware/enums");
|
|
22
22
|
const queries_1 = require("../middleware/queries");
|
|
23
|
-
const
|
|
24
|
-
const types_2 = require("../middleware/types");
|
|
25
|
-
const types_3 = require("../types");
|
|
23
|
+
const types_2 = require("../types");
|
|
26
24
|
const constants_1 = require("../utils/constants");
|
|
27
25
|
const conversion_1 = require("../utils/conversion");
|
|
28
26
|
const internal_2 = require("../utils/internal");
|
|
@@ -48,9 +46,8 @@ class Context {
|
|
|
48
46
|
*/
|
|
49
47
|
this.isArchiveNode = false;
|
|
50
48
|
this.isV5 = false;
|
|
51
|
-
const { polymeshApi,
|
|
52
|
-
this._middlewareApi =
|
|
53
|
-
this._middlewareApiV2 = middlewareApiV2;
|
|
49
|
+
const { polymeshApi, middlewareApiV2, ss58Format } = params;
|
|
50
|
+
this._middlewareApi = middlewareApiV2;
|
|
54
51
|
this._polymeshApi = polymeshApi;
|
|
55
52
|
this.polymeshApi = polymeshApi;
|
|
56
53
|
this.ss58Format = ss58Format;
|
|
@@ -68,11 +65,10 @@ class Context {
|
|
|
68
65
|
*/
|
|
69
66
|
static create(params) {
|
|
70
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const { polymeshApi,
|
|
68
|
+
const { polymeshApi, middlewareApiV2, signingManager } = params;
|
|
72
69
|
const ss58Format = (0, conversion_1.u16ToBigNumber)(polymeshApi.consts.system.ss58Prefix);
|
|
73
70
|
const context = new Context({
|
|
74
71
|
polymeshApi,
|
|
75
|
-
middlewareApi,
|
|
76
72
|
middlewareApiV2,
|
|
77
73
|
signingManager,
|
|
78
74
|
ss58Format,
|
|
@@ -86,7 +82,7 @@ class Context {
|
|
|
86
82
|
get: (target, prop) => {
|
|
87
83
|
if (target.isDisconnected) {
|
|
88
84
|
throw new internal_1.PolymeshError({
|
|
89
|
-
code:
|
|
85
|
+
code: types_2.ErrorCode.FatalError,
|
|
90
86
|
message: 'Client disconnected. Please create a new instance via "Polymesh.connect()"',
|
|
91
87
|
});
|
|
92
88
|
}
|
|
@@ -148,7 +144,7 @@ class Context {
|
|
|
148
144
|
const { _signingManager: manager } = this;
|
|
149
145
|
if (!manager) {
|
|
150
146
|
throw new internal_1.PolymeshError({
|
|
151
|
-
code:
|
|
147
|
+
code: types_2.ErrorCode.General,
|
|
152
148
|
message: 'There is no Signing Manager attached to the SDK',
|
|
153
149
|
});
|
|
154
150
|
}
|
|
@@ -184,7 +180,7 @@ class Context {
|
|
|
184
180
|
});
|
|
185
181
|
if (!newSigningAddress) {
|
|
186
182
|
throw new internal_1.PolymeshError({
|
|
187
|
-
code:
|
|
183
|
+
code: types_2.ErrorCode.General,
|
|
188
184
|
message: 'The Account is not part of the Signing Manager attached to the SDK',
|
|
189
185
|
});
|
|
190
186
|
}
|
|
@@ -285,7 +281,7 @@ class Context {
|
|
|
285
281
|
const identity = yield account.getIdentity();
|
|
286
282
|
if (identity === null) {
|
|
287
283
|
throw new internal_1.PolymeshError({
|
|
288
|
-
code:
|
|
284
|
+
code: types_2.ErrorCode.DataUnavailable,
|
|
289
285
|
message: 'The signing Account does not have an associated Identity',
|
|
290
286
|
});
|
|
291
287
|
}
|
|
@@ -311,7 +307,7 @@ class Context {
|
|
|
311
307
|
const { signingAddress } = this;
|
|
312
308
|
if (!signingAddress) {
|
|
313
309
|
throw new internal_1.PolymeshError({
|
|
314
|
-
code:
|
|
310
|
+
code: types_2.ErrorCode.General,
|
|
315
311
|
message: 'There is no signing Account associated with the SDK instance',
|
|
316
312
|
});
|
|
317
313
|
}
|
|
@@ -362,7 +358,7 @@ class Context {
|
|
|
362
358
|
const exists = yield id.exists();
|
|
363
359
|
if (!exists) {
|
|
364
360
|
throw new internal_1.PolymeshError({
|
|
365
|
-
code:
|
|
361
|
+
code: types_2.ErrorCode.DataUnavailable,
|
|
366
362
|
message: 'The passed DID does not correspond to an on-chain user Identity. It may correspond to an Asset Identity',
|
|
367
363
|
});
|
|
368
364
|
}
|
|
@@ -431,15 +427,15 @@ class Context {
|
|
|
431
427
|
supportsSubsidy({ tag }) {
|
|
432
428
|
const moduleName = tag.split('.')[0];
|
|
433
429
|
return [
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
430
|
+
types_2.ModuleName.Asset,
|
|
431
|
+
types_2.ModuleName.ComplianceManager,
|
|
432
|
+
types_2.ModuleName.CorporateAction,
|
|
433
|
+
types_2.ModuleName.ExternalAgents,
|
|
434
|
+
types_2.ModuleName.Portfolio,
|
|
435
|
+
types_2.ModuleName.Settlement,
|
|
436
|
+
types_2.ModuleName.Statistics,
|
|
437
|
+
types_2.ModuleName.Sto,
|
|
438
|
+
types_2.ModuleName.Relayer,
|
|
443
439
|
].includes(moduleName);
|
|
444
440
|
}
|
|
445
441
|
/**
|
|
@@ -532,7 +528,7 @@ class Context {
|
|
|
532
528
|
getIdentityClaimsFromChain(args) {
|
|
533
529
|
return __awaiter(this, void 0, void 0, function* () {
|
|
534
530
|
const { polymeshApi: { query: { identity }, }, isV5, } = this;
|
|
535
|
-
const { targets, claimTypes = Object.values(
|
|
531
|
+
const { targets, claimTypes = Object.values(types_2.ClaimType), trustedClaimIssuers, includeExpired, } = args;
|
|
536
532
|
const claim1stKeys = (0, lodash_1.flatMap)(targets, target => claimTypes.map(claimType => {
|
|
537
533
|
return {
|
|
538
534
|
target: (0, conversion_1.signerToString)(target),
|
|
@@ -568,53 +564,16 @@ class Context {
|
|
|
568
564
|
* @hidden
|
|
569
565
|
*/
|
|
570
566
|
getIdentityClaimsFromMiddleware(args) {
|
|
571
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
572
|
-
const { targets, claimTypes, trustedClaimIssuers, includeExpired, size, start } = args;
|
|
573
|
-
const data = [];
|
|
574
|
-
const result = yield this.queryMiddleware((0, queries_1.didsWithClaims)({
|
|
575
|
-
dids: targets === null || targets === void 0 ? void 0 : targets.map(target => (0, conversion_1.signerToString)(target)),
|
|
576
|
-
trustedClaimIssuers: trustedClaimIssuers === null || trustedClaimIssuers === void 0 ? void 0 : trustedClaimIssuers.map(trustedClaimIssuer => (0, conversion_1.signerToString)(trustedClaimIssuer)),
|
|
577
|
-
claimTypes: claimTypes === null || claimTypes === void 0 ? void 0 : claimTypes.map(ct => types_2.ClaimTypeEnum[ct]),
|
|
578
|
-
includeExpired,
|
|
579
|
-
count: size === null || size === void 0 ? void 0 : size.toNumber(),
|
|
580
|
-
skip: start === null || start === void 0 ? void 0 : start.toNumber(),
|
|
581
|
-
}));
|
|
582
|
-
const { data: { didsWithClaims: { items: didsWithClaimsList, totalCount }, }, } = result;
|
|
583
|
-
const count = new bignumber_js_1.default(totalCount);
|
|
584
|
-
didsWithClaimsList.forEach(({ claims }) => {
|
|
585
|
-
claims.forEach(({ targetDID: target, issuer, issuance_date: issuanceDate, last_update_date: lastUpdateDate, expiry, type, jurisdiction, scope, cdd_id: cddId, }) => {
|
|
586
|
-
data.push({
|
|
587
|
-
target: new internal_1.Identity({ did: target }, this),
|
|
588
|
-
issuer: new internal_1.Identity({ did: issuer }, this),
|
|
589
|
-
issuedAt: new Date(issuanceDate),
|
|
590
|
-
lastUpdatedAt: new Date(lastUpdateDate),
|
|
591
|
-
expiry: expiry ? new Date(expiry) : null,
|
|
592
|
-
claim: (0, internal_2.createClaim)(type, jurisdiction, scope, cddId),
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
});
|
|
596
|
-
const next = (0, internal_2.calculateNextKey)(count, data.length, start);
|
|
597
|
-
return {
|
|
598
|
-
data,
|
|
599
|
-
next,
|
|
600
|
-
count,
|
|
601
|
-
};
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* @hidden
|
|
606
|
-
*/
|
|
607
|
-
getIdentityClaimsFromMiddlewareV2(args) {
|
|
608
567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
609
568
|
const { targets, claimTypes, trustedClaimIssuers, includeExpired, size = new bignumber_js_1.default(constants_1.DEFAULT_GQL_PAGE_SIZE), start = new bignumber_js_1.default(0), } = args;
|
|
610
|
-
const { data: { claims: { nodes: claimsList, totalCount }, }, } = yield this.
|
|
569
|
+
const { data: { claims: { nodes: claimsList, totalCount }, }, } = yield this.queryMiddleware((0, queries_1.claimsQuery)({
|
|
611
570
|
dids: targets === null || targets === void 0 ? void 0 : targets.map(target => (0, conversion_1.signerToString)(target)),
|
|
612
571
|
trustedClaimIssuers: trustedClaimIssuers === null || trustedClaimIssuers === void 0 ? void 0 : trustedClaimIssuers.map(trustedClaimIssuer => (0, conversion_1.signerToString)(trustedClaimIssuer)),
|
|
613
|
-
claimTypes: claimTypes === null || claimTypes === void 0 ? void 0 : claimTypes.map(ct =>
|
|
572
|
+
claimTypes: claimTypes === null || claimTypes === void 0 ? void 0 : claimTypes.map(ct => enums_1.ClaimTypeEnum[ct]),
|
|
614
573
|
includeExpired,
|
|
615
574
|
}, size, start));
|
|
616
575
|
const count = new bignumber_js_1.default(totalCount);
|
|
617
|
-
const data = claimsList.map(claim => (0, conversion_1.
|
|
576
|
+
const data = claimsList.map(claim => (0, conversion_1.middlewareClaimToClaimData)(claim, this));
|
|
618
577
|
const next = (0, internal_2.calculateNextKey)(count, data.length, start);
|
|
619
578
|
return {
|
|
620
579
|
data,
|
|
@@ -635,7 +594,7 @@ class Context {
|
|
|
635
594
|
* @param opts.size - page size
|
|
636
595
|
* @param opts.start - page offset
|
|
637
596
|
*
|
|
638
|
-
* @note uses the middleware (optional)
|
|
597
|
+
* @note uses the middleware V2 (optional)
|
|
639
598
|
*/
|
|
640
599
|
issuedClaims(opts = {}) {
|
|
641
600
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -653,54 +612,7 @@ class Context {
|
|
|
653
612
|
}
|
|
654
613
|
if (!targets) {
|
|
655
614
|
throw new internal_1.PolymeshError({
|
|
656
|
-
code:
|
|
657
|
-
message: 'Cannot perform this action without an active middleware connection',
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
const identityClaimsFromChain = yield this.getIdentityClaimsFromChain({
|
|
661
|
-
targets,
|
|
662
|
-
claimTypes,
|
|
663
|
-
trustedClaimIssuers,
|
|
664
|
-
includeExpired,
|
|
665
|
-
});
|
|
666
|
-
return {
|
|
667
|
-
data: identityClaimsFromChain,
|
|
668
|
-
next: null,
|
|
669
|
-
count: undefined,
|
|
670
|
-
};
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
/**
|
|
674
|
-
* @hidden
|
|
675
|
-
*
|
|
676
|
-
* Retrieve a list of claims. Can be filtered using parameters
|
|
677
|
-
*
|
|
678
|
-
* @param opts.targets - Identities (or Identity IDs) for which to fetch claims (targets). Defaults to all targets
|
|
679
|
-
* @param opts.trustedClaimIssuers - Identity IDs of claim issuers. Defaults to all claim issuers
|
|
680
|
-
* @param opts.claimTypes - types of the claims to fetch. Defaults to any type
|
|
681
|
-
* @param opts.includeExpired - whether to include expired claims. Defaults to true
|
|
682
|
-
* @param opts.size - page size
|
|
683
|
-
* @param opts.start - page offset
|
|
684
|
-
*
|
|
685
|
-
* @note uses the middleware V2 (optional)
|
|
686
|
-
*/
|
|
687
|
-
issuedClaimsV2(opts = {}) {
|
|
688
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
689
|
-
const { targets, trustedClaimIssuers, claimTypes, includeExpired = true, size, start } = opts;
|
|
690
|
-
const isMiddlewareV2Available = yield this.isMiddlewareV2Available();
|
|
691
|
-
if (isMiddlewareV2Available) {
|
|
692
|
-
return this.getIdentityClaimsFromMiddlewareV2({
|
|
693
|
-
targets,
|
|
694
|
-
trustedClaimIssuers,
|
|
695
|
-
claimTypes,
|
|
696
|
-
includeExpired,
|
|
697
|
-
size,
|
|
698
|
-
start,
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
if (!targets) {
|
|
702
|
-
throw new internal_1.PolymeshError({
|
|
703
|
-
code: types_3.ErrorCode.MiddlewareError,
|
|
615
|
+
code: types_2.ErrorCode.MiddlewareError,
|
|
704
616
|
message: 'Cannot perform this action without an active middleware V2 connection',
|
|
705
617
|
});
|
|
706
618
|
}
|
|
@@ -718,32 +630,15 @@ class Context {
|
|
|
718
630
|
});
|
|
719
631
|
}
|
|
720
632
|
/**
|
|
721
|
-
* @hidden
|
|
722
|
-
*
|
|
723
633
|
* Retrieve the middleware client
|
|
724
634
|
*
|
|
725
|
-
* @throws if the middleware is not enabled
|
|
635
|
+
* @throws if the middleware V2 is not enabled
|
|
726
636
|
*/
|
|
727
637
|
get middlewareApi() {
|
|
728
638
|
const { _middlewareApi: api } = this;
|
|
729
639
|
if (!api) {
|
|
730
640
|
throw new internal_1.PolymeshError({
|
|
731
|
-
code:
|
|
732
|
-
message: 'Cannot perform this action without an active middleware connection',
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
return api;
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Retrieve the middleware v2 client
|
|
739
|
-
*
|
|
740
|
-
* @throws if the middleware V2 is not enabled
|
|
741
|
-
*/
|
|
742
|
-
get middlewareApiV2() {
|
|
743
|
-
const { _middlewareApiV2: api } = this;
|
|
744
|
-
if (!api) {
|
|
745
|
-
throw new internal_1.PolymeshError({
|
|
746
|
-
code: types_3.ErrorCode.MiddlewareError,
|
|
641
|
+
code: types_2.ErrorCode.MiddlewareError,
|
|
747
642
|
message: 'Cannot perform this action without an active middleware v2 connection',
|
|
748
643
|
});
|
|
749
644
|
}
|
|
@@ -752,7 +647,7 @@ class Context {
|
|
|
752
647
|
/**
|
|
753
648
|
* @hidden
|
|
754
649
|
*
|
|
755
|
-
* Make a query to the middleware server using the apollo client
|
|
650
|
+
* Make a query to the middleware V2 server using the apollo client
|
|
756
651
|
*/
|
|
757
652
|
queryMiddleware(query) {
|
|
758
653
|
var _a, _b;
|
|
@@ -766,31 +661,7 @@ class Context {
|
|
|
766
661
|
const { message: errorMessage } = err;
|
|
767
662
|
const message = resultMessage !== null && resultMessage !== void 0 ? resultMessage : errorMessage;
|
|
768
663
|
throw new internal_1.PolymeshError({
|
|
769
|
-
code:
|
|
770
|
-
message: `Error in middleware query: ${message}`,
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
return result;
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* @hidden
|
|
778
|
-
*
|
|
779
|
-
* Make a query to the middleware V2 server using the apollo client
|
|
780
|
-
*/
|
|
781
|
-
queryMiddlewareV2(query) {
|
|
782
|
-
var _a, _b;
|
|
783
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
784
|
-
let result;
|
|
785
|
-
try {
|
|
786
|
-
result = yield this.middlewareApiV2.query(query);
|
|
787
|
-
}
|
|
788
|
-
catch (err) {
|
|
789
|
-
const resultMessage = (_b = (_a = err.networkError) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.message;
|
|
790
|
-
const { message: errorMessage } = err;
|
|
791
|
-
const message = resultMessage !== null && resultMessage !== void 0 ? resultMessage : errorMessage;
|
|
792
|
-
throw new internal_1.PolymeshError({
|
|
793
|
-
code: types_3.ErrorCode.MiddlewareError,
|
|
664
|
+
code: types_2.ErrorCode.MiddlewareError,
|
|
794
665
|
message: `Error in middleware V2 query: ${message}`,
|
|
795
666
|
});
|
|
796
667
|
}
|
|
@@ -800,52 +671,20 @@ class Context {
|
|
|
800
671
|
/**
|
|
801
672
|
* @hidden
|
|
802
673
|
*
|
|
803
|
-
* Return whether the middleware was enabled at startup
|
|
674
|
+
* Return whether the middleware V2 was enabled at startup
|
|
804
675
|
*/
|
|
805
676
|
isMiddlewareEnabled() {
|
|
806
677
|
return !!this._middlewareApi;
|
|
807
678
|
}
|
|
808
|
-
/**
|
|
809
|
-
* @hidden
|
|
810
|
-
*
|
|
811
|
-
* Return whether the middleware V2 was enabled at startup
|
|
812
|
-
*/
|
|
813
|
-
isMiddlewareV2Enabled() {
|
|
814
|
-
return !!this._middlewareApiV2;
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* @hidden
|
|
818
|
-
*
|
|
819
|
-
* Return whether any middleware was enabled at startup
|
|
820
|
-
*/
|
|
821
|
-
isAnyMiddlewareEnabled() {
|
|
822
|
-
return this.isMiddlewareV2Enabled() || this.isMiddlewareEnabled();
|
|
823
|
-
}
|
|
824
|
-
/**
|
|
825
|
-
* @hidden
|
|
826
|
-
*
|
|
827
|
-
* Return whether the middleware is enabled and online
|
|
828
|
-
*/
|
|
829
|
-
isMiddlewareAvailable() {
|
|
830
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
831
|
-
try {
|
|
832
|
-
yield this.middlewareApi.query((0, queries_1.heartbeat)());
|
|
833
|
-
}
|
|
834
|
-
catch (err) {
|
|
835
|
-
return false;
|
|
836
|
-
}
|
|
837
|
-
return true;
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
679
|
/**
|
|
841
680
|
* @hidden
|
|
842
681
|
*
|
|
843
682
|
* Return whether the middleware V2 is enabled and online
|
|
844
683
|
*/
|
|
845
|
-
|
|
684
|
+
isMiddlewareAvailable() {
|
|
846
685
|
return __awaiter(this, void 0, void 0, function* () {
|
|
847
686
|
try {
|
|
848
|
-
yield this.
|
|
687
|
+
yield this.middlewareApi.query((0, queries_1.heartbeatQuery)());
|
|
849
688
|
}
|
|
850
689
|
catch (err) {
|
|
851
690
|
return false;
|
|
@@ -902,22 +741,16 @@ class Context {
|
|
|
902
741
|
disconnect() {
|
|
903
742
|
return __awaiter(this, void 0, void 0, function* () {
|
|
904
743
|
const { polymeshApi } = this;
|
|
905
|
-
let middlewareApi
|
|
744
|
+
let middlewareApi;
|
|
906
745
|
const unsub = yield this.unsubChainVersion;
|
|
907
746
|
unsub();
|
|
908
747
|
if (this.isMiddlewareEnabled()) {
|
|
909
748
|
({ middlewareApi } = this);
|
|
910
749
|
}
|
|
911
|
-
if (this.isMiddlewareV2Enabled()) {
|
|
912
|
-
({ middlewareApiV2 } = this);
|
|
913
|
-
}
|
|
914
750
|
this.isDisconnected = true;
|
|
915
751
|
if (middlewareApi) {
|
|
916
752
|
middlewareApi.stop();
|
|
917
753
|
}
|
|
918
|
-
if (middlewareApiV2) {
|
|
919
|
-
middlewareApiV2.stop();
|
|
920
|
-
}
|
|
921
754
|
yield (0, internal_2.delay)(500); // allow pending requests to complete
|
|
922
755
|
return polymeshApi.disconnect();
|
|
923
756
|
});
|
|
@@ -943,7 +776,7 @@ class Context {
|
|
|
943
776
|
}
|
|
944
777
|
catch (error) {
|
|
945
778
|
throw new internal_1.PolymeshError({
|
|
946
|
-
code:
|
|
779
|
+
code: types_2.ErrorCode.UnexpectedError,
|
|
947
780
|
message: `Could not create internal Polymesh type: "${type}". Please report this error to the Polymesh team`,
|
|
948
781
|
data: { type, params, error },
|
|
949
782
|
});
|
|
@@ -975,10 +808,10 @@ class Context {
|
|
|
975
808
|
*/
|
|
976
809
|
getMiddlewareMetadata() {
|
|
977
810
|
return __awaiter(this, void 0, void 0, function* () {
|
|
978
|
-
if (!this.
|
|
811
|
+
if (!this.isMiddlewareEnabled()) {
|
|
979
812
|
return null;
|
|
980
813
|
}
|
|
981
|
-
const { data: { _metadata: { chain, specName, genesisHash, targetHeight, lastProcessedHeight, lastProcessedTimestamp, indexerHealthy, }, }, } = yield this.
|
|
814
|
+
const { data: { _metadata: { chain, specName, genesisHash, targetHeight, lastProcessedHeight, lastProcessedTimestamp, indexerHealthy, }, }, } = yield this.queryMiddleware((0, queries_1.metadataQuery)());
|
|
982
815
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
983
816
|
return {
|
|
984
817
|
chain: chain,
|
|
@@ -1002,7 +835,7 @@ class Context {
|
|
|
1002
835
|
getPolyxTransactions(args) {
|
|
1003
836
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1004
837
|
const { identity, accounts, size = new bignumber_js_1.default(constants_1.DEFAULT_GQL_PAGE_SIZE), start = new bignumber_js_1.default(0), } = args;
|
|
1005
|
-
const { data: { polyxTransactions: { nodes: transactions, totalCount }, }, } = yield this.
|
|
838
|
+
const { data: { polyxTransactions: { nodes: transactions, totalCount }, }, } = yield this.queryMiddleware((0, queries_1.polyxTransactionsQuery)({
|
|
1006
839
|
identityId: identity ? (0, internal_2.asDid)(identity) : undefined,
|
|
1007
840
|
addresses: accounts === null || accounts === void 0 ? void 0 : accounts.map(account => (0, conversion_1.signerToString)(account)),
|
|
1008
841
|
}, size, start));
|
|
@@ -1011,7 +844,7 @@ class Context {
|
|
|
1011
844
|
const { identityId, address, toId, toAddress, amount, type, memo, createdBlock, callId, eventId, moduleId, extrinsic, eventIdx, } = transaction;
|
|
1012
845
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1013
846
|
return Object.assign(Object.assign({ fromIdentity: identityId ? new internal_1.Identity({ did: identityId }, this) : undefined, fromAccount: address ? new internal_1.Account({ address }, this) : undefined, toIdentity: toId ? new internal_1.Identity({ did: toId }, this) : undefined, toAccount: toAddress ? new internal_1.Account({ address: toAddress }, this) : undefined, amount: new bignumber_js_1.default(amount).shiftedBy(-6), type,
|
|
1014
|
-
memo }, (0, conversion_1.
|
|
847
|
+
memo }, (0, conversion_1.middlewareEventDetailsToEventIdentifier)(createdBlock, eventIdx)), { callId, eventId: eventId, moduleId: moduleId, extrinsicIdx: extrinsic ? new bignumber_js_1.default(extrinsic.extrinsicIdx) : undefined });
|
|
1015
848
|
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
1016
849
|
});
|
|
1017
850
|
const next = (0, internal_2.calculateNextKey)(count, data.length, start);
|