@polymeshassociation/polymesh-sdk 22.0.0-alpha.3 → 22.0.0-alpha.5

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 (124) hide show
  1. package/CHANGELOG.md +9 -3
  2. package/api/client/AccountManagement.d.ts +1 -1
  3. package/api/client/AccountManagement.js +1 -1
  4. package/api/client/Claims.d.ts +3 -58
  5. package/api/client/Claims.d.ts.map +1 -1
  6. package/api/client/Claims.js +13 -121
  7. package/api/client/Claims.js.map +1 -1
  8. package/api/client/Network.d.ts +9 -60
  9. package/api/client/Network.d.ts.map +1 -1
  10. package/api/client/Network.js +9 -141
  11. package/api/client/Network.js.map +1 -1
  12. package/api/client/Polymesh.d.ts +0 -9
  13. package/api/client/Polymesh.d.ts.map +1 -1
  14. package/api/client/Polymesh.js +2 -26
  15. package/api/client/Polymesh.js.map +1 -1
  16. package/api/entities/Account/index.d.ts +5 -25
  17. package/api/entities/Account/index.d.ts.map +1 -1
  18. package/api/entities/Account/index.js +9 -92
  19. package/api/entities/Account/index.js.map +1 -1
  20. package/api/entities/Account/types.d.ts +1 -1
  21. package/api/entities/Account/types.d.ts.map +1 -1
  22. package/api/entities/Asset/index.d.ts +2 -17
  23. package/api/entities/Asset/index.d.ts.map +1 -1
  24. package/api/entities/Asset/index.js +11 -93
  25. package/api/entities/Asset/index.js.map +1 -1
  26. package/api/entities/Asset/types.d.ts +1 -1
  27. package/api/entities/Asset/types.d.ts.map +1 -1
  28. package/api/entities/DefaultTrustedClaimIssuer.d.ts +1 -8
  29. package/api/entities/DefaultTrustedClaimIssuer.d.ts.map +1 -1
  30. package/api/entities/DefaultTrustedClaimIssuer.js +3 -24
  31. package/api/entities/DefaultTrustedClaimIssuer.js.map +1 -1
  32. package/api/entities/DividendDistribution/index.d.ts +2 -18
  33. package/api/entities/DividendDistribution/index.d.ts.map +1 -1
  34. package/api/entities/DividendDistribution/index.js +4 -90
  35. package/api/entities/DividendDistribution/index.js.map +1 -1
  36. package/api/entities/Identity/AssetPermissions.d.ts +5 -34
  37. package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
  38. package/api/entities/Identity/AssetPermissions.js +18 -106
  39. package/api/entities/Identity/AssetPermissions.js.map +1 -1
  40. package/api/entities/Identity/index.d.ts +4 -21
  41. package/api/entities/Identity/index.d.ts.map +1 -1
  42. package/api/entities/Identity/index.js +5 -56
  43. package/api/entities/Identity/index.js.map +1 -1
  44. package/api/entities/Instruction/index.d.ts +2 -13
  45. package/api/entities/Instruction/index.d.ts.map +1 -1
  46. package/api/entities/Instruction/index.js +28 -81
  47. package/api/entities/Instruction/index.js.map +1 -1
  48. package/api/entities/NumberedPortfolio.d.ts +1 -8
  49. package/api/entities/NumberedPortfolio.d.ts.map +1 -1
  50. package/api/entities/NumberedPortfolio.js +5 -28
  51. package/api/entities/NumberedPortfolio.js.map +1 -1
  52. package/api/entities/Offering/index.d.ts +1 -14
  53. package/api/entities/Offering/index.d.ts.map +1 -1
  54. package/api/entities/Offering/index.js +2 -47
  55. package/api/entities/Offering/index.js.map +1 -1
  56. package/api/entities/Portfolio/index.d.ts +2 -19
  57. package/api/entities/Portfolio/index.d.ts.map +1 -1
  58. package/api/entities/Portfolio/index.js +15 -92
  59. package/api/entities/Portfolio/index.js.map +1 -1
  60. package/api/entities/Portfolio/types.d.ts +2 -1
  61. package/api/entities/Portfolio/types.d.ts.map +1 -1
  62. package/api/entities/Venue/index.js +2 -2
  63. package/api/entities/Venue/index.js.map +1 -1
  64. package/api/entities/Venue/types.d.ts +1 -1
  65. package/api/entities/Venue/types.d.ts.map +1 -1
  66. package/api/entities/common/namespaces/Authorizations.js +2 -2
  67. package/api/entities/common/namespaces/Authorizations.js.map +1 -1
  68. package/api/procedures/modifyClaims.d.ts.map +1 -1
  69. package/api/procedures/modifyClaims.js +15 -21
  70. package/api/procedures/modifyClaims.js.map +1 -1
  71. package/base/Context.d.ts +5 -73
  72. package/base/Context.d.ts.map +1 -1
  73. package/base/Context.js +39 -206
  74. package/base/Context.js.map +1 -1
  75. package/base/PolymeshTransactionBase.d.ts.map +1 -1
  76. package/base/PolymeshTransactionBase.js +3 -20
  77. package/base/PolymeshTransactionBase.js.map +1 -1
  78. package/middleware/{enumsV2.d.ts → enums.d.ts} +3 -3
  79. package/middleware/enums.d.ts.map +1 -0
  80. package/middleware/{enumsV2.js → enums.js} +20 -20
  81. package/middleware/enums.js.map +1 -0
  82. package/middleware/queries.d.ts +105 -42
  83. package/middleware/queries.d.ts.map +1 -1
  84. package/middleware/queries.js +841 -397
  85. package/middleware/queries.js.map +1 -1
  86. package/middleware/types.d.ts +30888 -1459
  87. package/middleware/types.d.ts.map +1 -1
  88. package/middleware/types.js +3212 -904
  89. package/middleware/types.js.map +1 -1
  90. package/middleware/typesV1.d.ts +13 -0
  91. package/middleware/typesV1.d.ts.map +1 -0
  92. package/middleware/typesV1.js +16 -0
  93. package/middleware/typesV1.js.map +1 -0
  94. package/npm-package/polymeshassociation-polymesh-sdk-22.0.0-alpha.5.tgz +0 -0
  95. package/package.json +3 -4
  96. package/types/index.d.ts +4 -4
  97. package/types/index.d.ts.map +1 -1
  98. package/types/index.js +7 -13
  99. package/types/index.js.map +1 -1
  100. package/types/internal.d.ts +1 -6
  101. package/types/internal.d.ts.map +1 -1
  102. package/types/internal.js.map +1 -1
  103. package/types/utils/index.d.ts +1 -2
  104. package/types/utils/index.d.ts.map +1 -1
  105. package/types/utils/index.js.map +1 -1
  106. package/utils/conversion.d.ts +9 -25
  107. package/utils/conversion.d.ts.map +1 -1
  108. package/utils/conversion.js +385 -433
  109. package/utils/conversion.js.map +1 -1
  110. package/utils/internal.d.ts +1 -1
  111. package/utils/internal.d.ts.map +1 -1
  112. package/utils/internal.js +2 -2
  113. package/utils/internal.js.map +1 -1
  114. package/middleware/enumsV2.d.ts.map +0 -1
  115. package/middleware/enumsV2.js.map +0 -1
  116. package/middleware/queriesV2.d.ts +0 -192
  117. package/middleware/queriesV2.d.ts.map +0 -1
  118. package/middleware/queriesV2.js +0 -1145
  119. package/middleware/queriesV2.js.map +0 -1
  120. package/middleware/typesV2.d.ts +0 -31094
  121. package/middleware/typesV2.d.ts.map +0 -1
  122. package/middleware/typesV2.js +0 -3215
  123. package/middleware/typesV2.js.map +0 -1
  124. package/npm-package/polymeshassociation-polymesh-sdk-22.0.0-alpha.3.tgz +0 -0
@@ -1,1145 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.authorizationsQuery = exports.polyxTransactionsQuery = exports.assetTransactionQuery = exports.portfolioMovementsQuery = exports.settlementsQuery = exports.assetHoldersQuery = exports.distributionPaymentsQuery = exports.distributionQuery = exports.tickerExternalAgentActionsQuery = exports.tickerExternalAgentHistoryQuery = exports.tickerExternalAgentsQuery = exports.assetQuery = exports.portfolioQuery = exports.trustingAssetsQuery = exports.trustedClaimIssuerQuery = exports.extrinsicsByArgs = exports.extrinsicByHash = exports.eventsByArgs = exports.instructionsByDidQuery = exports.instructionsQuery = exports.investmentsQuery = exports.claimsQuery = exports.claimsGroupingQuery = exports.latestSqVersionQuery = exports.metadataQuery = exports.heartbeatQuery = exports.latestBlockQuery = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const enumsV2_1 = require("./enumsV2");
9
- const typesV2_1 = require("./typesV2");
10
- /**
11
- * @hidden
12
- *
13
- * Get the latest processed block number
14
- */
15
- function latestBlockQuery() {
16
- const query = (0, graphql_tag_1.default) `
17
- query latestBlock {
18
- blocks(first: 1, orderBy: [${typesV2_1.BlocksOrderBy.BlockIdDesc}]) {
19
- nodes {
20
- blockId
21
- }
22
- }
23
- }
24
- `;
25
- return {
26
- query,
27
- variables: undefined,
28
- };
29
- }
30
- exports.latestBlockQuery = latestBlockQuery;
31
- /**
32
- * @hidden
33
- *
34
- * Middleware V2 heartbeat
35
- */
36
- function heartbeatQuery() {
37
- const query = (0, graphql_tag_1.default) `
38
- query {
39
- block(id: "1") {
40
- id
41
- }
42
- }
43
- `;
44
- return {
45
- query,
46
- variables: undefined,
47
- };
48
- }
49
- exports.heartbeatQuery = heartbeatQuery;
50
- /**
51
- * @hidden
52
- *
53
- * Get details about the SubQuery indexer
54
- */
55
- function metadataQuery() {
56
- const query = (0, graphql_tag_1.default) `
57
- query Metadata {
58
- _metadata {
59
- chain
60
- specName
61
- genesisHash
62
- lastProcessedHeight
63
- lastProcessedTimestamp
64
- targetHeight
65
- indexerHealthy
66
- indexerNodeVersion
67
- queryNodeVersion
68
- dynamicDatasources
69
- }
70
- }
71
- `;
72
- return {
73
- query,
74
- variables: undefined,
75
- };
76
- }
77
- exports.metadataQuery = metadataQuery;
78
- /**
79
- * @hidden
80
- *
81
- * Get details about the latest Subquery version
82
- */
83
- function latestSqVersionQuery() {
84
- const query = (0, graphql_tag_1.default) `
85
- query SubqueryVersions {
86
- subqueryVersions(orderBy: [${typesV2_1.SubqueryVersionsOrderBy.UpdatedAtDesc}], first: 1) {
87
- nodes {
88
- id
89
- version
90
- createdAt
91
- updatedAt
92
- }
93
- }
94
- }
95
- `;
96
- return {
97
- query,
98
- variables: undefined,
99
- };
100
- }
101
- exports.latestSqVersionQuery = latestSqVersionQuery;
102
- /**
103
- * @hidden
104
- */
105
- function createClaimsFilters(variables) {
106
- const args = ['$size: Int, $start: Int'];
107
- const filters = ['revokeDate: { isNull: true }'];
108
- const { dids, claimTypes, trustedClaimIssuers, scope, includeExpired } = variables;
109
- if (dids && dids.length) {
110
- args.push('$dids: [String!]');
111
- filters.push('targetId: { in: $dids }');
112
- }
113
- if (claimTypes) {
114
- args.push('$claimTypes: [ClaimTypeEnum!]!');
115
- filters.push('type: { in: $claimTypes }');
116
- }
117
- if (trustedClaimIssuers && trustedClaimIssuers.length) {
118
- args.push('$trustedClaimIssuers: [String!]');
119
- filters.push('issuerId: { in: $trustedClaimIssuers }');
120
- }
121
- if (scope !== undefined) {
122
- args.push('$scope: JSON!');
123
- filters.push('scope: { contains: $scope }');
124
- }
125
- if (!includeExpired) {
126
- args.push('$expiryTimestamp: BigFloat');
127
- filters.push('or: [{ filterExpiry: { lessThan: $expiryTimestamp } }, { expiry: { isNull: true } }]');
128
- }
129
- return {
130
- args: `(${args.join()})`,
131
- filter: `filter: { ${filters.join()} },`,
132
- };
133
- }
134
- /**
135
- * @hidden
136
- *
137
- * Get all dids with at least one claim for a given scope and from one of the given trusted claim issuers
138
- */
139
- function claimsGroupingQuery(variables, orderBy = typesV2_1.ClaimsOrderBy.TargetIdAsc, groupBy = typesV2_1.ClaimsGroupBy.TargetId) {
140
- const { args, filter } = createClaimsFilters(variables);
141
- const query = (0, graphql_tag_1.default) `
142
- query claimsGroupingQuery
143
- ${args}
144
- {
145
- claims(
146
- ${filter}
147
- orderBy: [${orderBy}]
148
- first: $size
149
- offset: $start
150
- ) {
151
- groupedAggregates(groupBy: [${groupBy}], having: {}) {
152
- keys
153
- }
154
- }
155
- }
156
- `;
157
- return {
158
- query,
159
- variables,
160
- };
161
- }
162
- exports.claimsGroupingQuery = claimsGroupingQuery;
163
- /**
164
- * @hidden
165
- *
166
- * Get all claims that a given target DID has, with a given scope and from one of the given trustedClaimIssuers
167
- */
168
- function claimsQuery(filters, size, start) {
169
- const { args, filter } = createClaimsFilters(filters);
170
- const query = (0, graphql_tag_1.default) `
171
- query ClaimsQuery
172
- ${args}
173
- {
174
- claims(
175
- ${filter}
176
- orderBy: [${typesV2_1.ClaimsOrderBy.TargetIdAsc}, ${typesV2_1.ClaimsOrderBy.CreatedAtAsc}, ${typesV2_1.ClaimsOrderBy.CreatedBlockIdAsc}, ${typesV2_1.ClaimsOrderBy.EventIdxAsc}]
177
- first: $size
178
- offset: $start
179
- ) {
180
- totalCount
181
- nodes {
182
- targetId
183
- type
184
- scope
185
- cddId
186
- issuerId
187
- issuanceDate
188
- lastUpdateDate
189
- expiry
190
- jurisdiction
191
- }
192
- }
193
- }
194
- `;
195
- return {
196
- query,
197
- variables: Object.assign(Object.assign({}, filters), { expiryTimestamp: filters.includeExpired ? undefined : new Date().getTime(), size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
198
- };
199
- }
200
- exports.claimsQuery = claimsQuery;
201
- /**
202
- * @hidden
203
- *
204
- * Get all investments for a given offering
205
- */
206
- function investmentsQuery(filters, size, start) {
207
- const query = (0, graphql_tag_1.default) `
208
- query InvestmentsQuery($stoId: Int!, $offeringToken: String!, $size: Int, $start: Int) {
209
- investments(
210
- filter: { stoId: { equalTo: $stoId }, offeringToken: { equalTo: $offeringToken } }
211
- first: $size
212
- offset: $start
213
- orderBy: [${typesV2_1.InvestmentsOrderBy.CreatedAtAsc}, ${typesV2_1.InvestmentsOrderBy.CreatedBlockIdAsc}]
214
- ) {
215
- totalCount
216
- nodes {
217
- investorId
218
- offeringToken
219
- raiseToken
220
- offeringTokenAmount
221
- raiseTokenAmount
222
- }
223
- }
224
- }
225
- `;
226
- return {
227
- query,
228
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
229
- };
230
- }
231
- exports.investmentsQuery = investmentsQuery;
232
- /**
233
- * Create args and filters to be supplied to GQL query
234
- *
235
- * @param filters - filters to be applied
236
- * @param typeMap - Map defining the types corresponding to each attribute. All missing attributes whose types are not defined are considered to be `String`
237
- *
238
- * @hidden
239
- */
240
- function createArgsAndFilters(filters, typeMap) {
241
- const args = ['$start: Int', '$size: Int'];
242
- const gqlFilters = [];
243
- Object.keys(filters).forEach(attribute => {
244
- if (filters[attribute]) {
245
- const type = typeMap[attribute] || 'String';
246
- const middlewareType = enumsV2_1.middlewareV2EnumMap[type] || type;
247
- args.push(`$${attribute}: ${middlewareType}!`);
248
- gqlFilters.push(`${attribute}: { equalTo: $${attribute} }`);
249
- }
250
- });
251
- return {
252
- args: `(${args.join()})`,
253
- filter: gqlFilters.length ? `filter: { ${gqlFilters.join()} }` : '',
254
- };
255
- }
256
- /**
257
- * @hidden
258
- *
259
- * Get a specific instruction within a venue for a specific event
260
- */
261
- function instructionsQuery(filters, size, start) {
262
- const { args, filter } = createArgsAndFilters(filters, {
263
- eventId: 'EventIdEnum',
264
- status: 'InstructionStatusEnum',
265
- });
266
- const query = (0, graphql_tag_1.default) `
267
- query InstructionsQuery
268
- ${args}
269
- {
270
- instructions(
271
- ${filter}
272
- first: $size
273
- offset: $start
274
- orderBy: [${typesV2_1.InstructionsOrderBy.CreatedAtDesc}, ${typesV2_1.InstructionsOrderBy.IdDesc}]
275
- ) {
276
- totalCount
277
- nodes {
278
- id
279
- eventIdx
280
- eventId
281
- status
282
- settlementType
283
- venueId
284
- endBlock
285
- tradeDate
286
- valueDate
287
- legs {
288
- nodes {
289
- fromId
290
- from {
291
- identityId
292
- number
293
- }
294
- toId
295
- to {
296
- identityId
297
- number
298
- }
299
- assetId
300
- amount
301
- addresses
302
- }
303
- }
304
- memo
305
- createdBlock {
306
- blockId
307
- hash
308
- datetime
309
- }
310
- updatedBlock {
311
- blockId
312
- hash
313
- datetime
314
- }
315
- }
316
- }
317
- }
318
- `;
319
- return {
320
- query,
321
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
322
- };
323
- }
324
- exports.instructionsQuery = instructionsQuery;
325
- /**
326
- * @hidden
327
- *
328
- * Get Instructions where an identity is involved
329
- */
330
- function instructionsByDidQuery(identityId) {
331
- const query = (0, graphql_tag_1.default) `
332
- query InstructionsByDidQuery($fromId: String!, $toId: String!)
333
- {
334
- legs(
335
- filter: { or: [{ fromId: { startsWith: $fromId } }, { toId: { startsWith: $toId } }] }
336
- orderBy: [${typesV2_1.LegsOrderBy.CreatedAtAsc}, ${typesV2_1.LegsOrderBy.InstructionIdAsc}]
337
- ) {
338
- nodes {
339
- instruction {
340
- id
341
- eventIdx
342
- eventId
343
- status
344
- settlementType
345
- venueId
346
- endBlock
347
- tradeDate
348
- valueDate
349
- legs {
350
- nodes {
351
- fromId
352
- from {
353
- identityId
354
- number
355
- }
356
- toId
357
- to {
358
- identityId
359
- number
360
- }
361
- assetId
362
- amount
363
- addresses
364
- }
365
- }
366
- memo
367
- createdBlock {
368
- blockId
369
- hash
370
- datetime
371
- }
372
- updatedBlock {
373
- blockId
374
- hash
375
- datetime
376
- }
377
- }
378
- }
379
- }
380
- }
381
- `;
382
- return {
383
- query,
384
- variables: { fromId: `${identityId}/`, toId: `${identityId}/` },
385
- };
386
- }
387
- exports.instructionsByDidQuery = instructionsByDidQuery;
388
- /**
389
- * @hidden
390
- *
391
- * Get a single event by any of its indexed arguments
392
- */
393
- function eventsByArgs(filters, size, start) {
394
- const { args, filter } = createArgsAndFilters(filters, {
395
- moduleId: 'ModuleIdEnum',
396
- eventId: 'EventIdEnum',
397
- });
398
- const query = (0, graphql_tag_1.default) `
399
- query EventsQuery
400
- ${args}
401
- {
402
- events(
403
- ${filter}
404
- orderBy: [${typesV2_1.EventsOrderBy.CreatedAtAsc}, ${typesV2_1.EventsOrderBy.BlockIdAsc}]
405
- first: $size
406
- offset: $start
407
- ) {
408
- nodes {
409
- eventIdx
410
- block {
411
- blockId
412
- hash
413
- datetime
414
- }
415
- }
416
- }
417
- }
418
- `;
419
- return {
420
- query,
421
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
422
- };
423
- }
424
- exports.eventsByArgs = eventsByArgs;
425
- /**
426
- * @hidden
427
- *
428
- * Get a transaction by hash
429
- */
430
- function extrinsicByHash(variables) {
431
- const query = (0, graphql_tag_1.default) `
432
- query TransactionByHashQuery($extrinsicHash: String!) {
433
- extrinsics(filter: { extrinsicHash: { equalTo: $extrinsicHash } }) {
434
- nodes {
435
- extrinsicIdx
436
- address
437
- nonce
438
- moduleId
439
- callId
440
- paramsTxt
441
- success
442
- specVersionId
443
- extrinsicHash
444
- block {
445
- blockId
446
- hash
447
- datetime
448
- }
449
- }
450
- }
451
- }
452
- `;
453
- return {
454
- query,
455
- variables,
456
- };
457
- }
458
- exports.extrinsicByHash = extrinsicByHash;
459
- /**
460
- * @hidden
461
- *
462
- * Get transactions
463
- */
464
- function extrinsicsByArgs(filters, size, start, orderBy = typesV2_1.ExtrinsicsOrderBy.BlockIdAsc) {
465
- const { args, filter } = createArgsAndFilters(filters, {
466
- moduleId: 'ModuleIdEnum',
467
- callId: 'CallIdEnum',
468
- success: 'Int',
469
- });
470
- const query = (0, graphql_tag_1.default) `
471
- query TransactionsQuery
472
- ${args}
473
- {
474
- extrinsics(
475
- ${filter}
476
- orderBy: [${orderBy}]
477
- first: $size
478
- offset: $start
479
- ) {
480
- totalCount
481
- nodes {
482
- blockId
483
- extrinsicIdx
484
- address
485
- nonce
486
- moduleId
487
- callId
488
- paramsTxt
489
- success
490
- specVersionId
491
- extrinsicHash
492
- block {
493
- hash
494
- }
495
- }
496
- }
497
- }
498
- `;
499
- return {
500
- query,
501
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
502
- };
503
- }
504
- exports.extrinsicsByArgs = extrinsicsByArgs;
505
- /**
506
- * @hidden
507
- *
508
- * Get an trusted claim issuer event for an asset and an issuer
509
- */
510
- function trustedClaimIssuerQuery(variables) {
511
- const query = (0, graphql_tag_1.default) `
512
- query TrustedClaimIssuerQuery($assetId: String!, $issuer: String!) {
513
- trustedClaimIssuers(
514
- filter: { assetId: { equalTo: $assetId }, issuer: { equalTo: $issuer } },
515
- orderBy: [${typesV2_1.TrustedClaimIssuersOrderBy.CreatedAtDesc}, ${typesV2_1.TrustedClaimIssuersOrderBy.CreatedBlockIdDesc}]
516
- ) {
517
- nodes {
518
- eventIdx
519
- createdBlock {
520
- blockId
521
- datetime
522
- hash
523
- }
524
- }
525
- }
526
- }
527
- `;
528
- return {
529
- query,
530
- variables,
531
- };
532
- }
533
- exports.trustedClaimIssuerQuery = trustedClaimIssuerQuery;
534
- /**
535
- * @hidden
536
- *
537
- * Get an trusted claim issuer event for an asset and an issuer
538
- */
539
- function trustingAssetsQuery(variables) {
540
- const query = (0, graphql_tag_1.default) `
541
- query TrustedClaimIssuerQuery($issuer: String!) {
542
- trustedClaimIssuers(
543
- filter: { issuer: { equalTo: $issuer } },
544
- orderBy: [${typesV2_1.TrustedClaimIssuersOrderBy.AssetIdAsc}]
545
- ) {
546
- nodes {
547
- assetId
548
- }
549
- }
550
- }
551
- `;
552
- return {
553
- query,
554
- variables,
555
- };
556
- }
557
- exports.trustingAssetsQuery = trustingAssetsQuery;
558
- /**
559
- * @hidden
560
- *
561
- * Get portfolio details for a given DID and portfolio number
562
- */
563
- function portfolioQuery(variables) {
564
- const query = (0, graphql_tag_1.default) `
565
- query PortfolioQuery($identityId: String!, $number: Int!) {
566
- portfolios(filter: { identityId: { equalTo: $identityId }, number: { equalTo: $number } }) {
567
- nodes {
568
- eventIdx
569
- createdBlock {
570
- blockId
571
- datetime
572
- hash
573
- }
574
- }
575
- }
576
- }
577
- `;
578
- return {
579
- query,
580
- variables,
581
- };
582
- }
583
- exports.portfolioQuery = portfolioQuery;
584
- /**
585
- * @hidden
586
- *
587
- * Get Asset details for a given ticker
588
- */
589
- function assetQuery(variables) {
590
- const query = (0, graphql_tag_1.default) `
591
- query AssetQuery($ticker: String!) {
592
- assets(filter: { ticker: { equalTo: $ticker } }) {
593
- nodes {
594
- eventIdx
595
- createdBlock {
596
- blockId
597
- datetime
598
- hash
599
- }
600
- }
601
- }
602
- }
603
- `;
604
- return {
605
- query,
606
- variables,
607
- };
608
- }
609
- exports.assetQuery = assetQuery;
610
- /**
611
- * @hidden
612
- *
613
- * Get the event details when external agent added for a ticker
614
- */
615
- function tickerExternalAgentsQuery(variables) {
616
- const query = (0, graphql_tag_1.default) `
617
- query TickerExternalAgentQuery($assetId: String!) {
618
- tickerExternalAgents(
619
- filter: { assetId: { equalTo: $assetId } }
620
- orderBy: [${typesV2_1.TickerExternalAgentsOrderBy.CreatedAtDesc}, ${typesV2_1.TickerExternalAgentsOrderBy.CreatedBlockIdDesc}]
621
- first: 1
622
- ) {
623
- nodes {
624
- eventIdx
625
- createdBlock {
626
- blockId
627
- datetime
628
- hash
629
- }
630
- }
631
- }
632
- }
633
- `;
634
- return {
635
- query,
636
- variables,
637
- };
638
- }
639
- exports.tickerExternalAgentsQuery = tickerExternalAgentsQuery;
640
- /**
641
- * @hidden
642
- *
643
- * Get the transaction history of each external agent of an Asset
644
- */
645
- function tickerExternalAgentHistoryQuery(variables) {
646
- const query = (0, graphql_tag_1.default) `
647
- query TickerExternalAgentHistoryQuery($assetId: String!) {
648
- tickerExternalAgentHistories(
649
- filter: { assetId: { equalTo: $assetId } }
650
- orderBy: [${typesV2_1.TickerExternalAgentHistoriesOrderBy.CreatedAtAsc}, ${typesV2_1.TickerExternalAgentHistoriesOrderBy.CreatedBlockIdAsc}]
651
- ) {
652
- nodes {
653
- identityId
654
- assetId
655
- eventIdx
656
- createdBlock {
657
- blockId
658
- hash
659
- datetime
660
- }
661
- }
662
- }
663
- }
664
- `;
665
- return {
666
- query,
667
- variables,
668
- };
669
- }
670
- exports.tickerExternalAgentHistoryQuery = tickerExternalAgentHistoryQuery;
671
- /**
672
- * @hidden
673
- *
674
- * Get list of Events triggered by actions (from the set of actions that can only be performed by external agents) that have been performed on a specific Asset
675
- */
676
- function tickerExternalAgentActionsQuery(filters, size, start) {
677
- const { args, filter } = createArgsAndFilters(filters, { eventId: 'EventIdEnum' });
678
- const query = (0, graphql_tag_1.default) `
679
- query TickerExternalAgentActionsQuery
680
- ${args}
681
- {
682
- tickerExternalAgentActions(
683
- ${filter}
684
- first: $size
685
- offset: $start
686
- orderBy: [${typesV2_1.TickerExternalAgentActionsOrderBy.CreatedAtDesc}, ${typesV2_1.TickerExternalAgentActionsOrderBy.CreatedBlockIdDesc}]
687
- ) {
688
- totalCount
689
- nodes {
690
- eventIdx
691
- palletName
692
- eventId
693
- callerId
694
- createdBlock {
695
- blockId
696
- datetime
697
- hash
698
- }
699
- }
700
- }
701
- }
702
- `;
703
- return {
704
- query,
705
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
706
- };
707
- }
708
- exports.tickerExternalAgentActionsQuery = tickerExternalAgentActionsQuery;
709
- /**
710
- * @hidden
711
- *
712
- * Get distribution details for a CAId
713
- */
714
- function distributionQuery(variables) {
715
- const query = (0, graphql_tag_1.default) `
716
- query DistributionQuery($id: String!) {
717
- distribution(id: $id) {
718
- taxes
719
- }
720
- }
721
- `;
722
- return {
723
- query,
724
- variables,
725
- };
726
- }
727
- exports.distributionQuery = distributionQuery;
728
- /**
729
- * @hidden
730
- *
731
- * Get history of claims for a distribution
732
- */
733
- function distributionPaymentsQuery(filters, size, start) {
734
- const query = (0, graphql_tag_1.default) `
735
- query DistributionPaymentQuery($distributionId: String!, $size: Int, $start: Int) {
736
- distributionPayments(
737
- filter: { distributionId: { equalTo: $distributionId } }
738
- first: $size
739
- offset: $start
740
- ) {
741
- totalCount
742
- nodes {
743
- eventId
744
- targetId
745
- datetime
746
- amount
747
- tax
748
- createdBlock {
749
- blockId
750
- hash
751
- }
752
- }
753
- }
754
- }
755
- `;
756
- return {
757
- query,
758
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
759
- };
760
- }
761
- exports.distributionPaymentsQuery = distributionPaymentsQuery;
762
- /**
763
- * @hidden
764
- *
765
- * Get asset held by a DID
766
- */
767
- function assetHoldersQuery(filters, size, start, orderBy = typesV2_1.AssetHoldersOrderBy.AssetIdAsc) {
768
- const query = (0, graphql_tag_1.default) `
769
- query AssetHoldersQuery($identityId: String!, $size: Int, $start: Int) {
770
- assetHolders(
771
- filter: { identityId: { equalTo: $identityId } }
772
- first: $size
773
- offset: $start
774
- orderBy: [${orderBy}]
775
- ) {
776
- totalCount
777
- nodes {
778
- assetId
779
- }
780
- }
781
- }
782
- `;
783
- return {
784
- query,
785
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
786
- };
787
- }
788
- exports.assetHoldersQuery = assetHoldersQuery;
789
- /**
790
- * @hidden
791
- */
792
- function createLegFilters({ identityId, portfolioId, ticker, address }) {
793
- const args = ['$fromId: String!, $toId: String!'];
794
- const fromIdFilters = ['fromId: { equalTo: $fromId }'];
795
- const toIdFilters = ['toId: { equalTo: $toId }'];
796
- const portfolioNumber = portfolioId ? portfolioId.toNumber() : 0;
797
- const variables = {
798
- fromId: `${identityId}/${portfolioNumber}`,
799
- toId: `${identityId}/${portfolioNumber}`,
800
- };
801
- if (ticker) {
802
- variables.assetId = ticker;
803
- args.push('$assetId: String!');
804
- const assetIdFilter = 'assetId: { equalTo: $assetId }';
805
- toIdFilters.push(assetIdFilter);
806
- fromIdFilters.push(assetIdFilter);
807
- }
808
- if (address) {
809
- variables.addresses = [address];
810
- args.push('$addresses: [String!]!');
811
- const addressFilter = 'addresses: { in: $addresses }';
812
- toIdFilters.push(addressFilter);
813
- fromIdFilters.push(addressFilter);
814
- }
815
- return {
816
- args: `(${args.join()})`,
817
- filter: `filter: { or: [{ ${fromIdFilters.join()}, settlementId: { isNull: false } }, { ${toIdFilters.join()}, settlementId: { isNull: false } } ] }`,
818
- variables,
819
- };
820
- }
821
- /**
822
- * @hidden
823
- *
824
- * Get Settlements where a Portfolio is involved
825
- */
826
- function settlementsQuery(filters) {
827
- const { args, filter, variables } = createLegFilters(filters);
828
- const query = (0, graphql_tag_1.default) `
829
- query SettlementsQuery
830
- ${args}
831
- {
832
- legs(
833
- ${filter}
834
- orderBy: [${typesV2_1.LegsOrderBy.CreatedAtAsc}, ${typesV2_1.LegsOrderBy.InstructionIdAsc}]
835
- ) {
836
- nodes {
837
- settlement {
838
- id
839
- createdBlock {
840
- blockId
841
- datetime
842
- hash
843
- }
844
- result
845
- legs {
846
- nodes {
847
- fromId
848
- from {
849
- identityId
850
- number
851
- }
852
- toId
853
- to {
854
- identityId
855
- number
856
- }
857
- assetId
858
- amount
859
- addresses
860
- }
861
- }
862
- }
863
- }
864
- }
865
- }
866
- `;
867
- return {
868
- query,
869
- variables,
870
- };
871
- }
872
- exports.settlementsQuery = settlementsQuery;
873
- /**
874
- * @hidden
875
- */
876
- function createPortfolioMovementFilters({ identityId, portfolioId, ticker, address, }) {
877
- const args = ['$fromId: String!, $toId: String!'];
878
- const fromIdFilters = ['fromId: { equalTo: $fromId }'];
879
- const toIdFilters = ['toId: { equalTo: $toId }'];
880
- const portfolioNumber = portfolioId ? portfolioId.toNumber() : 0;
881
- const variables = {
882
- fromId: `${identityId}/${portfolioNumber}`,
883
- toId: `${identityId}/${portfolioNumber}`,
884
- };
885
- if (ticker) {
886
- variables.assetId = ticker;
887
- args.push('$assetId: String!');
888
- const assetIdFilter = 'assetId: { equalTo: $assetId }';
889
- toIdFilters.push(assetIdFilter);
890
- fromIdFilters.push(assetIdFilter);
891
- }
892
- if (address) {
893
- variables.address = address;
894
- args.push('$address: String!');
895
- const addressFilter = 'address: { equalTo: $address }';
896
- toIdFilters.push(addressFilter);
897
- fromIdFilters.push(addressFilter);
898
- }
899
- return {
900
- args: `(${args.join()})`,
901
- filter: `filter: { or: [ { ${fromIdFilters.join()} }, { ${toIdFilters.join()} } ] }`,
902
- variables,
903
- };
904
- }
905
- /**
906
- * @hidden
907
- *
908
- * Get Settlements where a Portfolio is involved
909
- */
910
- function portfolioMovementsQuery(filters) {
911
- const { args, filter, variables } = createPortfolioMovementFilters(filters);
912
- const query = (0, graphql_tag_1.default) `
913
- query PortfolioMovementsQuery
914
- ${args}
915
- {
916
- portfolioMovements(
917
- ${filter}
918
- orderBy: [${typesV2_1.PortfolioMovementsOrderBy.CreatedAtAsc}, ${typesV2_1.PortfolioMovementsOrderBy.IdAsc}]
919
- ) {
920
- nodes {
921
- id
922
- fromId
923
- from {
924
- identityId
925
- number
926
- }
927
- toId
928
- to {
929
- identityId
930
- number
931
- }
932
- assetId
933
- amount
934
- address
935
- createdBlock {
936
- blockId
937
- datetime
938
- hash
939
- }
940
- }
941
- }
942
- }
943
- `;
944
- return {
945
- query,
946
- variables,
947
- };
948
- }
949
- exports.portfolioMovementsQuery = portfolioMovementsQuery;
950
- /**
951
- * @hidden
952
- */
953
- function createPolyxTransactionFilters({ identityId, addresses }) {
954
- const args = ['$size: Int, $start: Int'];
955
- const fromIdFilters = [];
956
- const toIdFilters = [];
957
- const variables = {};
958
- if (identityId) {
959
- variables.identityId = identityId;
960
- args.push('$identityId: String!');
961
- fromIdFilters.push('identityId: { equalTo: $identityId }');
962
- toIdFilters.push('toId: { equalTo: $identityId }');
963
- }
964
- if (addresses === null || addresses === void 0 ? void 0 : addresses.length) {
965
- variables.addresses = addresses;
966
- args.push('$addresses: [String!]!');
967
- fromIdFilters.push('address: { in: $addresses }');
968
- toIdFilters.push('toAddress: { in: $addresses }');
969
- }
970
- return {
971
- args: `(${args.join()})`,
972
- filter: fromIdFilters.length && toIdFilters.length
973
- ? `filter: { or: [ { ${fromIdFilters.join()} }, { ${toIdFilters.join()} } ] }`
974
- : '',
975
- variables,
976
- };
977
- }
978
- /**
979
- * @hidden
980
- *
981
- * Get the balance history for an Asset
982
- */
983
- function assetTransactionQuery(filters, size, start) {
984
- const query = (0, graphql_tag_1.default) `
985
- query AssetTransactionQuery($assetId: String!) {
986
- assetTransactions(
987
- filter: { assetId: { equalTo: $assetId } }
988
- orderBy: [${typesV2_1.AssetTransactionsOrderBy.CreatedAtAsc}, ${typesV2_1.AssetTransactionsOrderBy.CreatedBlockIdAsc}]
989
- ) {
990
- totalCount
991
- nodes {
992
- assetId
993
- amount
994
- fromPortfolioId
995
- fromPortfolio {
996
- identityId
997
- number
998
- }
999
- toPortfolioId
1000
- toPortfolio {
1001
- identityId
1002
- number
1003
- }
1004
- eventId
1005
- eventIdx
1006
- extrinsicIdx
1007
- fundingRound
1008
- datetime
1009
- createdBlock {
1010
- blockId
1011
- hash
1012
- datetime
1013
- }
1014
- }
1015
- }
1016
- }
1017
- `;
1018
- return {
1019
- query,
1020
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
1021
- };
1022
- }
1023
- exports.assetTransactionQuery = assetTransactionQuery;
1024
- /**
1025
- * @hidden
1026
- *
1027
- * Get POLYX transactions where an Account or an Identity is involved
1028
- */
1029
- function polyxTransactionsQuery(filters, size, start) {
1030
- const { args, filter, variables } = createPolyxTransactionFilters(filters);
1031
- const query = (0, graphql_tag_1.default) `
1032
- query PolyxTransactionsQuery
1033
- ${args}
1034
- {
1035
- polyxTransactions(
1036
- ${filter}
1037
- first: $size
1038
- offset: $start
1039
- orderBy: [${typesV2_1.PolyxTransactionsOrderBy.CreatedAtAsc}, ${typesV2_1.PolyxTransactionsOrderBy.CreatedBlockIdAsc}]
1040
- ) {
1041
- nodes {
1042
- id
1043
- identityId
1044
- address
1045
- toId
1046
- toAddress
1047
- amount
1048
- type
1049
- extrinsic {
1050
- extrinsicIdx
1051
- }
1052
- callId
1053
- eventId
1054
- moduleId
1055
- eventIdx
1056
- memo
1057
- datetime
1058
- createdBlock {
1059
- blockId
1060
- datetime
1061
- hash
1062
- }
1063
- }
1064
- }
1065
- }
1066
- `;
1067
- return {
1068
- query,
1069
- variables: Object.assign(Object.assign({}, variables), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
1070
- };
1071
- }
1072
- exports.polyxTransactionsQuery = polyxTransactionsQuery;
1073
- /**
1074
- * @hidden
1075
- */
1076
- function createAuthorizationFilters(variables) {
1077
- const args = ['$size: Int, $start: Int'];
1078
- const filters = [];
1079
- const { fromId, toId, toKey, status, type } = variables;
1080
- if (fromId === null || fromId === void 0 ? void 0 : fromId.length) {
1081
- args.push('$fromId: String!');
1082
- filters.push('fromId: { equalTo: $fromId }');
1083
- }
1084
- if (toId === null || toId === void 0 ? void 0 : toId.length) {
1085
- args.push('$toId: String!');
1086
- filters.push('toId: { equalTo: $toId }');
1087
- }
1088
- if (toKey === null || toKey === void 0 ? void 0 : toKey.length) {
1089
- args.push('$toKey: String!');
1090
- filters.push('toKey: { equalTo: $toKey }');
1091
- }
1092
- if (type) {
1093
- args.push(`$type: ${enumsV2_1.middlewareV2EnumMap.AuthTypeEnum}!`);
1094
- filters.push('type: { equalTo: $type }');
1095
- }
1096
- if (status) {
1097
- args.push(`$status: ${enumsV2_1.middlewareV2EnumMap.AuthorizationStatusEnum}!`);
1098
- filters.push('status: { equalTo: $status }');
1099
- }
1100
- return {
1101
- args: `(${args.join()})`,
1102
- filter: filters.length ? `filter: { ${filters.join()} }` : '',
1103
- variables,
1104
- };
1105
- }
1106
- /**
1107
- * @hidden
1108
- *
1109
- * Get all authorizations with specified filters
1110
- */
1111
- function authorizationsQuery(filters, size, start) {
1112
- const { args, filter } = createAuthorizationFilters(filters);
1113
- const query = (0, graphql_tag_1.default) `
1114
- query AuthorizationsQuery
1115
- ${args}
1116
- {
1117
- authorizations(
1118
- ${filter}
1119
- first: $size
1120
- offset: $start
1121
- orderBy: [${typesV2_1.AuthorizationsOrderBy.CreatedAtAsc}, ${typesV2_1.AuthorizationsOrderBy.CreatedBlockIdAsc}]
1122
- ) {
1123
- totalCount
1124
- nodes {
1125
- id
1126
- type
1127
- fromId
1128
- toId
1129
- toKey
1130
- data
1131
- expiry
1132
- status
1133
- createdBlockId
1134
- updatedBlockId
1135
- }
1136
- }
1137
- }
1138
- `;
1139
- return {
1140
- query,
1141
- variables: Object.assign(Object.assign({}, filters), { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber() }),
1142
- };
1143
- }
1144
- exports.authorizationsQuery = authorizationsQuery;
1145
- //# sourceMappingURL=queriesV2.js.map