@polymeshassociation/polymesh-sdk 24.7.0-alpha.9 → 24.7.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 (156) hide show
  1. package/CHANGELOG.md +9 -3
  2. package/api/client/Claims.d.ts.map +1 -1
  3. package/api/client/Claims.js +6 -6
  4. package/api/client/Claims.js.map +1 -1
  5. package/api/client/Network.d.ts.map +1 -1
  6. package/api/client/Network.js +5 -4
  7. package/api/client/Network.js.map +1 -1
  8. package/api/entities/Account/MultiSig/index.js +2 -2
  9. package/api/entities/Account/MultiSig/index.js.map +1 -1
  10. package/api/entities/Account/index.js +2 -2
  11. package/api/entities/Account/index.js.map +1 -1
  12. package/api/entities/Asset/Fungible/index.d.ts.map +1 -1
  13. package/api/entities/Asset/Fungible/index.js +12 -7
  14. package/api/entities/Asset/Fungible/index.js.map +1 -1
  15. package/api/entities/Asset/NonFungible/AssetHolders/index.js +2 -2
  16. package/api/entities/Asset/NonFungible/AssetHolders/index.js.map +1 -1
  17. package/api/entities/Asset/NonFungible/NftCollection.d.ts.map +1 -1
  18. package/api/entities/Asset/NonFungible/NftCollection.js +11 -7
  19. package/api/entities/Asset/NonFungible/NftCollection.js.map +1 -1
  20. package/api/entities/DefaultTrustedClaimIssuer.js +2 -2
  21. package/api/entities/DefaultTrustedClaimIssuer.js.map +1 -1
  22. package/api/entities/DividendDistribution/index.js +3 -3
  23. package/api/entities/DividendDistribution/index.js.map +1 -1
  24. package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
  25. package/api/entities/Identity/AssetPermissions.js +3 -3
  26. package/api/entities/Identity/AssetPermissions.js.map +1 -1
  27. package/api/entities/Identity/Portfolios.d.ts.map +1 -1
  28. package/api/entities/Identity/Portfolios.js +29 -11
  29. package/api/entities/Identity/Portfolios.js.map +1 -1
  30. package/api/entities/Identity/index.d.ts.map +1 -1
  31. package/api/entities/Identity/index.js +17 -5
  32. package/api/entities/Identity/index.js.map +1 -1
  33. package/api/entities/Instruction/index.d.ts.map +1 -1
  34. package/api/entities/Instruction/index.js +24 -7
  35. package/api/entities/Instruction/index.js.map +1 -1
  36. package/api/entities/MultiSigProposal/index.js +3 -3
  37. package/api/entities/MultiSigProposal/index.js.map +1 -1
  38. package/api/entities/NumberedPortfolio.js +2 -2
  39. package/api/entities/NumberedPortfolio.js.map +1 -1
  40. package/api/entities/Offering/index.js +2 -2
  41. package/api/entities/Offering/index.js.map +1 -1
  42. package/api/entities/Portfolio/index.d.ts.map +1 -1
  43. package/api/entities/Portfolio/index.js +40 -13
  44. package/api/entities/Portfolio/index.js.map +1 -1
  45. package/api/entities/Portfolio/types.d.ts +7 -4
  46. package/api/entities/Portfolio/types.d.ts.map +1 -1
  47. package/api/entities/Venue/index.d.ts.map +1 -1
  48. package/api/entities/Venue/index.js +28 -5
  49. package/api/entities/Venue/index.js.map +1 -1
  50. package/api/entities/common/namespaces/Authorizations.js +2 -2
  51. package/api/entities/common/namespaces/Authorizations.js.map +1 -1
  52. package/api/entities/types.d.ts +2 -1
  53. package/api/entities/types.d.ts.map +1 -1
  54. package/api/entities/types.js.map +1 -1
  55. package/api/procedures/modifyClaims.js +2 -2
  56. package/api/procedures/modifyClaims.js.map +1 -1
  57. package/base/Context.d.ts +2 -1
  58. package/base/Context.d.ts.map +1 -1
  59. package/base/Context.js +8 -5
  60. package/base/Context.js.map +1 -1
  61. package/base/PolymeshTransactionBase.d.ts.map +1 -1
  62. package/base/PolymeshTransactionBase.js +4 -3
  63. package/base/PolymeshTransactionBase.js.map +1 -1
  64. package/base/types.d.ts +6 -0
  65. package/base/types.d.ts.map +1 -1
  66. package/middleware/queries/assets.d.ts +35 -0
  67. package/middleware/queries/assets.d.ts.map +1 -0
  68. package/middleware/queries/assets.js +159 -0
  69. package/middleware/queries/assets.js.map +1 -0
  70. package/middleware/queries/authorizations.d.ts +12 -0
  71. package/middleware/queries/authorizations.d.ts.map +1 -0
  72. package/middleware/queries/authorizations.js +81 -0
  73. package/middleware/queries/authorizations.js.map +1 -0
  74. package/middleware/queries/claims.d.ts +53 -0
  75. package/middleware/queries/claims.d.ts.map +1 -0
  76. package/middleware/queries/claims.js +210 -0
  77. package/middleware/queries/claims.js.map +1 -0
  78. package/middleware/queries/common.d.ts +38 -0
  79. package/middleware/queries/common.d.ts.map +1 -0
  80. package/middleware/queries/common.js +126 -0
  81. package/middleware/queries/common.js.map +1 -0
  82. package/middleware/queries/distributions.d.ts +17 -0
  83. package/middleware/queries/distributions.d.ts.map +1 -0
  84. package/middleware/queries/distributions.js +63 -0
  85. package/middleware/queries/distributions.js.map +1 -0
  86. package/middleware/queries/events.d.ts +13 -0
  87. package/middleware/queries/events.d.ts.map +1 -0
  88. package/middleware/queries/events.js +47 -0
  89. package/middleware/queries/events.js.map +1 -0
  90. package/middleware/queries/externalAgents.d.ts +25 -0
  91. package/middleware/queries/externalAgents.d.ts.map +1 -0
  92. package/middleware/queries/externalAgents.js +109 -0
  93. package/middleware/queries/externalAgents.js.map +1 -0
  94. package/middleware/queries/extrinsics.d.ts +19 -0
  95. package/middleware/queries/extrinsics.d.ts.map +1 -0
  96. package/middleware/queries/extrinsics.js +91 -0
  97. package/middleware/queries/extrinsics.js.map +1 -0
  98. package/middleware/queries/multisigs.d.ts +27 -0
  99. package/middleware/queries/multisigs.d.ts.map +1 -0
  100. package/middleware/queries/multisigs.js +116 -0
  101. package/middleware/queries/multisigs.js.map +1 -0
  102. package/middleware/queries/polyxTransactions.d.ts +14 -0
  103. package/middleware/queries/polyxTransactions.d.ts.map +1 -0
  104. package/middleware/queries/polyxTransactions.js +86 -0
  105. package/middleware/queries/polyxTransactions.js.map +1 -0
  106. package/middleware/queries/portfolios.d.ts +23 -0
  107. package/middleware/queries/portfolios.d.ts.map +1 -0
  108. package/middleware/queries/portfolios.js +126 -0
  109. package/middleware/queries/portfolios.js.map +1 -0
  110. package/middleware/queries/settlements.d.ts +42 -0
  111. package/middleware/queries/settlements.d.ts.map +1 -0
  112. package/middleware/queries/settlements.js +242 -0
  113. package/middleware/queries/settlements.js.map +1 -0
  114. package/middleware/queries/settlementsOld.d.ts +41 -0
  115. package/middleware/queries/settlementsOld.d.ts.map +1 -0
  116. package/middleware/queries/settlementsOld.js +228 -0
  117. package/middleware/queries/settlementsOld.js.map +1 -0
  118. package/middleware/queries/stos.d.ts +11 -0
  119. package/middleware/queries/stos.d.ts.map +1 -0
  120. package/middleware/queries/stos.js +40 -0
  121. package/middleware/queries/stos.js.map +1 -0
  122. package/middleware/types.d.ts +68577 -4662
  123. package/middleware/types.d.ts.map +1 -1
  124. package/middleware/types.js +46564 -299
  125. package/middleware/types.js.map +1 -1
  126. package/middleware/typesV6.d.ts +47356 -0
  127. package/middleware/typesV6.d.ts.map +1 -0
  128. package/middleware/typesV6.js +4200 -0
  129. package/middleware/typesV6.js.map +1 -0
  130. package/npm-package/polymeshassociation-polymesh-sdk-24.7.0-beta.2.tgz +0 -0
  131. package/package.json +1 -1
  132. package/types/index.d.ts +2 -1
  133. package/types/index.d.ts.map +1 -1
  134. package/types/index.js +2 -1
  135. package/types/index.js.map +1 -1
  136. package/utils/constants.d.ts +1 -0
  137. package/utils/constants.d.ts.map +1 -1
  138. package/utils/constants.js +2 -1
  139. package/utils/constants.js.map +1 -1
  140. package/utils/conversion.d.ts +21 -7
  141. package/utils/conversion.d.ts.map +1 -1
  142. package/utils/conversion.js +154 -36
  143. package/utils/conversion.js.map +1 -1
  144. package/utils/internal.d.ts +6 -0
  145. package/utils/internal.d.ts.map +1 -1
  146. package/utils/internal.js +22 -10
  147. package/utils/internal.js.map +1 -1
  148. package/utils/typeguards.d.ts +5 -1
  149. package/utils/typeguards.d.ts.map +1 -1
  150. package/utils/typeguards.js +8 -1
  151. package/utils/typeguards.js.map +1 -1
  152. package/middleware/queries.d.ts +0 -258
  153. package/middleware/queries.d.ts.map +0 -1
  154. package/middleware/queries.js +0 -1447
  155. package/middleware/queries.js.map +0 -1
  156. package/npm-package/polymeshassociation-polymesh-sdk-24.7.0-alpha.9.tgz +0 -0
@@ -1,1447 +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.multiSigProposalsQuery = exports.nftCollectionHolders = exports.customClaimTypeQuery = exports.createCustomClaimTypeQueryFilters = exports.multiSigProposalVotesQuery = exports.multiSigProposalQuery = exports.authorizationsQuery = exports.polyxTransactionsQuery = exports.nftTransactionQuery = exports.assetTransactionQuery = exports.portfoliosMovementsQuery = exports.portfolioMovementsQuery = exports.settlementsForAllPortfoliosQuery = exports.settlementsQuery = exports.nftHoldersQuery = 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 types_1 = require("./types");
9
- /**
10
- * @hidden
11
- *
12
- * Get the latest processed block number
13
- */
14
- function latestBlockQuery() {
15
- const query = (0, graphql_tag_1.default) `
16
- query latestBlock {
17
- blocks(first: 1, orderBy: [${types_1.BlocksOrderBy.BlockIdDesc}]) {
18
- nodes {
19
- blockId
20
- }
21
- }
22
- }
23
- `;
24
- return {
25
- query,
26
- variables: undefined,
27
- };
28
- }
29
- exports.latestBlockQuery = latestBlockQuery;
30
- /**
31
- * @hidden
32
- *
33
- * Middleware V2 heartbeat
34
- */
35
- function heartbeatQuery() {
36
- const query = (0, graphql_tag_1.default) `
37
- query heartbeat {
38
- blocks(filter: { blockId: { equalTo: 1 } }) {
39
- nodes {
40
- blockId
41
- }
42
- }
43
- }
44
- `;
45
- return {
46
- query,
47
- variables: undefined,
48
- };
49
- }
50
- exports.heartbeatQuery = heartbeatQuery;
51
- /**
52
- * @hidden
53
- *
54
- * Get details about the SubQuery indexer
55
- */
56
- function metadataQuery() {
57
- const query = (0, graphql_tag_1.default) `
58
- query Metadata {
59
- _metadata {
60
- chain
61
- specName
62
- genesisHash
63
- lastProcessedHeight
64
- lastProcessedTimestamp
65
- targetHeight
66
- indexerHealthy
67
- indexerNodeVersion
68
- queryNodeVersion
69
- dynamicDatasources
70
- }
71
- }
72
- `;
73
- return {
74
- query,
75
- variables: undefined,
76
- };
77
- }
78
- exports.metadataQuery = metadataQuery;
79
- /**
80
- * @hidden
81
- *
82
- * Get details about the latest Subquery version
83
- */
84
- function latestSqVersionQuery() {
85
- const query = (0, graphql_tag_1.default) `
86
- query SubqueryVersions {
87
- subqueryVersions(orderBy: [${types_1.SubqueryVersionsOrderBy.CreatedAtDesc}], first: 1) {
88
- nodes {
89
- id
90
- version
91
- createdAt
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 === null || dids === void 0 ? void 0 : 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 === null || trustedClaimIssuers === void 0 ? void 0 : 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 = types_1.ClaimsOrderBy.TargetIdAsc, groupBy = types_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: [${types_1.ClaimsOrderBy.TargetIdAsc}, ${types_1.ClaimsOrderBy.CreatedAtAsc}, ${types_1.ClaimsOrderBy.CreatedBlockIdAsc}, ${types_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
- customClaimTypeId
192
- }
193
- }
194
- }
195
- `;
196
- return {
197
- query,
198
- 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() }),
199
- };
200
- }
201
- exports.claimsQuery = claimsQuery;
202
- /**
203
- * @hidden
204
- *
205
- * Get all investments for a given offering
206
- */
207
- function investmentsQuery(filters, size, start) {
208
- const query = (0, graphql_tag_1.default) `
209
- query InvestmentsQuery($stoId: Int!, $offeringToken: String!, $size: Int, $start: Int) {
210
- investments(
211
- filter: { stoId: { equalTo: $stoId }, offeringToken: { equalTo: $offeringToken } }
212
- first: $size
213
- offset: $start
214
- orderBy: [${types_1.InvestmentsOrderBy.CreatedAtAsc}, ${types_1.InvestmentsOrderBy.CreatedBlockIdAsc}]
215
- ) {
216
- totalCount
217
- nodes {
218
- investorId
219
- offeringToken
220
- raiseToken
221
- offeringTokenAmount
222
- raiseTokenAmount
223
- }
224
- }
225
- }
226
- `;
227
- return {
228
- query,
229
- 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() }),
230
- };
231
- }
232
- exports.investmentsQuery = investmentsQuery;
233
- /**
234
- * Create args and filters to be supplied to GQL query
235
- *
236
- * @param filters - filters to be applied
237
- * @param typeMap - Map defining the types corresponding to each attribute. All missing attributes whose types are not defined are considered to be `String`
238
- *
239
- * @hidden
240
- */
241
- function createArgsAndFilters(filters, typeMap) {
242
- const args = ['$start: Int', '$size: Int'];
243
- const gqlFilters = [];
244
- Object.keys(filters).forEach(attribute => {
245
- if (filters[attribute]) {
246
- const type = typeMap[attribute] || 'String';
247
- args.push(`$${attribute}: ${type}!`);
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: [${types_1.InstructionsOrderBy.CreatedAtDesc}, ${types_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: [${types_1.LegsOrderBy.CreatedAtAsc}, ${types_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: [${types_1.EventsOrderBy.CreatedAtAsc}, ${types_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 = types_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
- datetime
495
- }
496
- }
497
- }
498
- }
499
- `;
500
- return {
501
- query,
502
- 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() }),
503
- };
504
- }
505
- exports.extrinsicsByArgs = extrinsicsByArgs;
506
- /**
507
- * @hidden
508
- *
509
- * Get an trusted claim issuer event for an asset and an issuer
510
- */
511
- function trustedClaimIssuerQuery(variables) {
512
- const query = (0, graphql_tag_1.default) `
513
- query TrustedClaimIssuerQuery($assetId: String!, $issuer: String!) {
514
- trustedClaimIssuers(
515
- filter: { assetId: { equalTo: $assetId }, issuer: { equalTo: $issuer } },
516
- orderBy: [${types_1.TrustedClaimIssuersOrderBy.CreatedAtDesc}, ${types_1.TrustedClaimIssuersOrderBy.CreatedBlockIdDesc}]
517
- ) {
518
- nodes {
519
- eventIdx
520
- createdBlock {
521
- blockId
522
- datetime
523
- hash
524
- }
525
- }
526
- }
527
- }
528
- `;
529
- return {
530
- query,
531
- variables,
532
- };
533
- }
534
- exports.trustedClaimIssuerQuery = trustedClaimIssuerQuery;
535
- /**
536
- * @hidden
537
- *
538
- * Get an trusted claim issuer event for an asset and an issuer
539
- */
540
- function trustingAssetsQuery(variables) {
541
- const query = (0, graphql_tag_1.default) `
542
- query TrustedClaimIssuerQuery($issuer: String!) {
543
- trustedClaimIssuers(
544
- filter: { issuer: { equalTo: $issuer } },
545
- orderBy: [${types_1.TrustedClaimIssuersOrderBy.AssetIdAsc}]
546
- ) {
547
- nodes {
548
- assetId
549
- }
550
- }
551
- }
552
- `;
553
- return {
554
- query,
555
- variables,
556
- };
557
- }
558
- exports.trustingAssetsQuery = trustingAssetsQuery;
559
- /**
560
- * @hidden
561
- *
562
- * Get portfolio details for a given DID and portfolio number
563
- */
564
- function portfolioQuery(variables) {
565
- const query = (0, graphql_tag_1.default) `
566
- query PortfolioQuery($identityId: String!, $number: Int!) {
567
- portfolios(filter: { identityId: { equalTo: $identityId }, number: { equalTo: $number } }) {
568
- nodes {
569
- eventIdx
570
- createdBlock {
571
- blockId
572
- datetime
573
- hash
574
- }
575
- }
576
- }
577
- }
578
- `;
579
- return {
580
- query,
581
- variables,
582
- };
583
- }
584
- exports.portfolioQuery = portfolioQuery;
585
- /**
586
- * @hidden
587
- *
588
- * Get Asset details for a given ticker
589
- */
590
- function assetQuery(variables) {
591
- const query = (0, graphql_tag_1.default) `
592
- query AssetQuery($ticker: String!) {
593
- assets(filter: { ticker: { equalTo: $ticker } }) {
594
- nodes {
595
- eventIdx
596
- createdBlock {
597
- blockId
598
- datetime
599
- hash
600
- }
601
- }
602
- }
603
- }
604
- `;
605
- return {
606
- query,
607
- variables,
608
- };
609
- }
610
- exports.assetQuery = assetQuery;
611
- /**
612
- * @hidden
613
- *
614
- * Get the event details when external agent added for a ticker
615
- */
616
- function tickerExternalAgentsQuery(variables) {
617
- const query = (0, graphql_tag_1.default) `
618
- query TickerExternalAgentQuery($assetId: String!) {
619
- tickerExternalAgents(
620
- filter: { assetId: { equalTo: $assetId } }
621
- orderBy: [${types_1.TickerExternalAgentsOrderBy.CreatedAtDesc}, ${types_1.TickerExternalAgentsOrderBy.CreatedBlockIdDesc}]
622
- first: 1
623
- ) {
624
- nodes {
625
- eventIdx
626
- createdBlock {
627
- blockId
628
- datetime
629
- hash
630
- }
631
- }
632
- }
633
- }
634
- `;
635
- return {
636
- query,
637
- variables,
638
- };
639
- }
640
- exports.tickerExternalAgentsQuery = tickerExternalAgentsQuery;
641
- /**
642
- * @hidden
643
- *
644
- * Get the transaction history of each external agent of an Asset
645
- */
646
- function tickerExternalAgentHistoryQuery(variables) {
647
- const query = (0, graphql_tag_1.default) `
648
- query TickerExternalAgentHistoryQuery($assetId: String!) {
649
- tickerExternalAgentHistories(
650
- filter: { assetId: { equalTo: $assetId } }
651
- orderBy: [${types_1.TickerExternalAgentHistoriesOrderBy.CreatedAtAsc}, ${types_1.TickerExternalAgentHistoriesOrderBy.CreatedBlockIdAsc}]
652
- ) {
653
- nodes {
654
- identityId
655
- assetId
656
- eventIdx
657
- createdBlock {
658
- blockId
659
- hash
660
- datetime
661
- }
662
- }
663
- }
664
- }
665
- `;
666
- return {
667
- query,
668
- variables,
669
- };
670
- }
671
- exports.tickerExternalAgentHistoryQuery = tickerExternalAgentHistoryQuery;
672
- /**
673
- * @hidden
674
- *
675
- * 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
676
- */
677
- function tickerExternalAgentActionsQuery(filters, size, start) {
678
- const { args, filter } = createArgsAndFilters(filters, { eventId: 'EventIdEnum' });
679
- const query = (0, graphql_tag_1.default) `
680
- query TickerExternalAgentActionsQuery
681
- ${args}
682
- {
683
- tickerExternalAgentActions(
684
- ${filter}
685
- first: $size
686
- offset: $start
687
- orderBy: [${types_1.TickerExternalAgentActionsOrderBy.CreatedAtDesc}, ${types_1.TickerExternalAgentActionsOrderBy.CreatedBlockIdDesc}]
688
- ) {
689
- totalCount
690
- nodes {
691
- eventIdx
692
- palletName
693
- eventId
694
- callerId
695
- createdBlock {
696
- blockId
697
- datetime
698
- hash
699
- }
700
- }
701
- }
702
- }
703
- `;
704
- return {
705
- query,
706
- 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() }),
707
- };
708
- }
709
- exports.tickerExternalAgentActionsQuery = tickerExternalAgentActionsQuery;
710
- /**
711
- * @hidden
712
- *
713
- * Get distribution details for a CAId
714
- */
715
- function distributionQuery(variables) {
716
- const query = (0, graphql_tag_1.default) `
717
- query DistributionQuery($assetId: String!, $localId: Int!) {
718
- distributions(filter: { assetId: { equalTo: $assetId }, localId: { equalTo: $localId } }) {
719
- nodes {
720
- taxes
721
- }
722
- }
723
- }
724
- `;
725
- return {
726
- query,
727
- variables,
728
- };
729
- }
730
- exports.distributionQuery = distributionQuery;
731
- /**
732
- * @hidden
733
- *
734
- * Get history of claims for a distribution
735
- */
736
- function distributionPaymentsQuery(filters, size, start) {
737
- const query = (0, graphql_tag_1.default) `
738
- query DistributionPaymentQuery($distributionId: String!, $size: Int, $start: Int) {
739
- distributionPayments(
740
- filter: { distributionId: { equalTo: $distributionId } }
741
- first: $size
742
- offset: $start
743
- ) {
744
- totalCount
745
- nodes {
746
- eventId
747
- targetId
748
- datetime
749
- amount
750
- tax
751
- createdBlock {
752
- blockId
753
- hash
754
- }
755
- }
756
- }
757
- }
758
- `;
759
- return {
760
- query,
761
- 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() }),
762
- };
763
- }
764
- exports.distributionPaymentsQuery = distributionPaymentsQuery;
765
- /**
766
- * @hidden
767
- *
768
- * Get asset held by a DID
769
- */
770
- function assetHoldersQuery(filters, size, start, orderBy = types_1.AssetHoldersOrderBy.AssetIdAsc) {
771
- const query = (0, graphql_tag_1.default) `
772
- query AssetHoldersQuery($identityId: String!, $size: Int, $start: Int) {
773
- assetHolders(
774
- filter: { identityId: { equalTo: $identityId } }
775
- first: $size
776
- offset: $start
777
- orderBy: [${orderBy}]
778
- ) {
779
- totalCount
780
- nodes {
781
- assetId
782
- }
783
- }
784
- }
785
- `;
786
- return {
787
- query,
788
- 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() }),
789
- };
790
- }
791
- exports.assetHoldersQuery = assetHoldersQuery;
792
- /**
793
- * @hidden
794
- *
795
- * Get NFTs held by a DID
796
- */
797
- function nftHoldersQuery(filters, size, start, orderBy = types_1.NftHoldersOrderBy.AssetIdAsc) {
798
- const query = (0, graphql_tag_1.default) `
799
- query NftHolderQuery($identityId: String!, $size: Int, $start: Int) {
800
- nftHolders(
801
- filter: { identityId: { equalTo: $identityId } }
802
- first: $size
803
- offset: $start
804
- orderBy: [${orderBy}]
805
- ) {
806
- totalCount
807
- nodes {
808
- assetId
809
- nftIds
810
- }
811
- }
812
- }
813
- `;
814
- return {
815
- query,
816
- 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() }),
817
- };
818
- }
819
- exports.nftHoldersQuery = nftHoldersQuery;
820
- /**
821
- * @hidden
822
- */
823
- function createLegFilters({ identityId, portfolioId, ticker, address }, queryAll) {
824
- const args = ['$fromId: String!, $toId: String!'];
825
- const fromIdFilters = queryAll
826
- ? ['fromId: { startsWith: $fromId }']
827
- : ['fromId: { equalTo: $fromId }'];
828
- const toIdFilters = queryAll ? ['toId: { startsWith: $toId }'] : ['toId: { equalTo: $toId }'];
829
- const portfolioNumber = portfolioId ? portfolioId.toNumber() : 0;
830
- const variables = {
831
- fromId: queryAll ? `${identityId}` : `${identityId}/${portfolioNumber}`,
832
- toId: queryAll ? `${identityId}` : `${identityId}/${portfolioNumber}`,
833
- };
834
- if (ticker) {
835
- variables.assetId = ticker;
836
- args.push('$assetId: String!');
837
- const assetIdFilter = 'assetId: { equalTo: $assetId }';
838
- toIdFilters.push(assetIdFilter);
839
- fromIdFilters.push(assetIdFilter);
840
- }
841
- if (address) {
842
- variables.addresses = [address];
843
- args.push('$addresses: [String!]!');
844
- const addressFilter = 'addresses: { in: $addresses }';
845
- toIdFilters.push(addressFilter);
846
- fromIdFilters.push(addressFilter);
847
- }
848
- return {
849
- args: `(${args.join()})`,
850
- filter: `filter: { or: [{ ${fromIdFilters.join()}, settlementId: { isNull: false } }, { ${toIdFilters.join()}, settlementId: { isNull: false } } ] }`,
851
- variables,
852
- };
853
- }
854
- /**
855
- * @hidden
856
- */
857
- function buildSettlementsQuery(args, filter) {
858
- return (0, graphql_tag_1.default) `
859
- query SettlementsQuery
860
- ${args}
861
- {
862
- legs(
863
- ${filter}
864
- orderBy: [${types_1.LegsOrderBy.CreatedAtAsc}, ${types_1.LegsOrderBy.InstructionIdAsc}]
865
- ) {
866
- nodes {
867
- settlement {
868
- id
869
- createdBlock {
870
- blockId
871
- datetime
872
- hash
873
- }
874
- result
875
- legs {
876
- nodes {
877
- fromId
878
- from {
879
- identityId
880
- number
881
- }
882
- toId
883
- to {
884
- identityId
885
- number
886
- }
887
- assetId
888
- amount
889
- addresses
890
- }
891
- }
892
- }
893
- }
894
- }
895
- }
896
- `;
897
- }
898
- /**
899
- * @hidden
900
- *
901
- * Get Settlements where a Portfolio is involved
902
- */
903
- function settlementsQuery(filters) {
904
- const { args, filter, variables } = createLegFilters(filters);
905
- const query = buildSettlementsQuery(args, filter);
906
- return {
907
- query,
908
- variables,
909
- };
910
- }
911
- exports.settlementsQuery = settlementsQuery;
912
- /**
913
- * @hidden
914
- *
915
- * Get Settlements for all Portfolios
916
- */
917
- function settlementsForAllPortfoliosQuery(filters) {
918
- const { args, filter, variables } = createLegFilters(filters, true);
919
- const query = buildSettlementsQuery(args, filter);
920
- return {
921
- query,
922
- variables,
923
- };
924
- }
925
- exports.settlementsForAllPortfoliosQuery = settlementsForAllPortfoliosQuery;
926
- /**
927
- * @hidden
928
- */
929
- function createPortfolioMovementFilters({ identityId, portfolioId, ticker, address }, queryAll) {
930
- const args = ['$fromId: String!, $toId: String!'];
931
- const fromIdFilters = queryAll
932
- ? ['fromId: { startsWith: $fromId }']
933
- : ['fromId: { equalTo: $fromId }'];
934
- const toIdFilters = queryAll ? ['toId: { startsWith: $toId }'] : ['toId: { equalTo: $toId }'];
935
- const portfolioNumber = portfolioId ? portfolioId.toNumber() : 0;
936
- const variables = {
937
- fromId: queryAll ? `${identityId}` : `${identityId}/${portfolioNumber}`,
938
- toId: queryAll ? `${identityId}` : `${identityId}/${portfolioNumber}`,
939
- };
940
- if (ticker) {
941
- variables.assetId = ticker;
942
- args.push('$assetId: String!');
943
- const assetIdFilter = 'assetId: { equalTo: $assetId }';
944
- toIdFilters.push(assetIdFilter);
945
- fromIdFilters.push(assetIdFilter);
946
- }
947
- if (address) {
948
- variables.address = address;
949
- args.push('$address: String!');
950
- const addressFilter = 'address: { equalTo: $address }';
951
- toIdFilters.push(addressFilter);
952
- fromIdFilters.push(addressFilter);
953
- }
954
- return {
955
- args: `(${args.join()})`,
956
- filter: `filter: { or: [ { ${fromIdFilters.join()} }, { ${toIdFilters.join()} } ] }`,
957
- variables,
958
- };
959
- }
960
- /**
961
- * @hidden
962
- */
963
- function buildPortfolioMovementsQuery(args, filter) {
964
- return (0, graphql_tag_1.default) `
965
- query PortfolioMovementsQuery
966
- ${args}
967
- {
968
- portfolioMovements(
969
- ${filter}
970
- orderBy: [${types_1.PortfolioMovementsOrderBy.CreatedAtAsc}, ${types_1.PortfolioMovementsOrderBy.IdAsc}]
971
- ) {
972
- nodes {
973
- id
974
- fromId
975
- toId
976
- assetId
977
- amount
978
- address
979
- createdBlock {
980
- blockId
981
- datetime
982
- hash
983
- }
984
- }
985
- }
986
- }
987
- `;
988
- }
989
- /**
990
- * @hidden
991
- *
992
- * Get Settlements where a Portfolio is involved
993
- */
994
- function portfolioMovementsQuery(filters) {
995
- const { args, filter, variables } = createPortfolioMovementFilters(filters);
996
- const query = buildPortfolioMovementsQuery(args, filter);
997
- return {
998
- query,
999
- variables,
1000
- };
1001
- }
1002
- exports.portfolioMovementsQuery = portfolioMovementsQuery;
1003
- /**
1004
- * @hidden
1005
- *
1006
- * Get Settlements for all portfolios
1007
- */
1008
- function portfoliosMovementsQuery(filters) {
1009
- const { args, filter, variables } = createPortfolioMovementFilters(filters, true);
1010
- const query = buildPortfolioMovementsQuery(args, filter);
1011
- return {
1012
- query,
1013
- variables,
1014
- };
1015
- }
1016
- exports.portfoliosMovementsQuery = portfoliosMovementsQuery;
1017
- /**
1018
- * @hidden
1019
- */
1020
- function createPolyxTransactionFilters({ identityId, addresses }) {
1021
- const args = ['$size: Int, $start: Int'];
1022
- const fromIdFilters = [];
1023
- const toIdFilters = [];
1024
- const variables = {};
1025
- if (identityId) {
1026
- variables.identityId = identityId;
1027
- args.push('$identityId: String!');
1028
- fromIdFilters.push('identityId: { equalTo: $identityId }');
1029
- toIdFilters.push('toId: { equalTo: $identityId }');
1030
- }
1031
- if (addresses === null || addresses === void 0 ? void 0 : addresses.length) {
1032
- variables.addresses = addresses;
1033
- args.push('$addresses: [String!]!');
1034
- fromIdFilters.push('address: { in: $addresses }');
1035
- toIdFilters.push('toAddress: { in: $addresses }');
1036
- }
1037
- return {
1038
- args: `(${args.join()})`,
1039
- filter: fromIdFilters.length && toIdFilters.length
1040
- ? `filter: { or: [ { ${fromIdFilters.join()} }, { ${toIdFilters.join()} } ] }`
1041
- : '',
1042
- variables,
1043
- };
1044
- }
1045
- /**
1046
- * @hidden
1047
- *
1048
- * Get the balance history for an Asset
1049
- */
1050
- function assetTransactionQuery(filters, size, start) {
1051
- const query = (0, graphql_tag_1.default) `
1052
- query AssetTransactionQuery($assetId: String!) {
1053
- assetTransactions(
1054
- filter: { assetId: { equalTo: $assetId } }
1055
- orderBy: [${types_1.AssetTransactionsOrderBy.CreatedAtAsc}, ${types_1.AssetTransactionsOrderBy.CreatedBlockIdAsc}]
1056
- ) {
1057
- totalCount
1058
- nodes {
1059
- assetId
1060
- amount
1061
- fromPortfolioId
1062
- fromPortfolio {
1063
- identityId
1064
- number
1065
- }
1066
- toPortfolioId
1067
- toPortfolio {
1068
- identityId
1069
- number
1070
- }
1071
- eventId
1072
- eventIdx
1073
- extrinsicIdx
1074
- fundingRound
1075
- instructionId
1076
- instructionMemo
1077
- datetime
1078
- createdBlock {
1079
- blockId
1080
- hash
1081
- datetime
1082
- }
1083
- }
1084
- }
1085
- }
1086
- `;
1087
- return {
1088
- query,
1089
- 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() }),
1090
- };
1091
- }
1092
- exports.assetTransactionQuery = assetTransactionQuery;
1093
- /**
1094
- * @hidden
1095
- *
1096
- * Get the transaction history for an NFT Collection
1097
- */
1098
- function nftTransactionQuery(filters, size, start) {
1099
- const query = (0, graphql_tag_1.default) `
1100
- query AssetTransactionQuery($assetId: String!) {
1101
- assetTransactions(
1102
- filter: { assetId: { equalTo: $assetId } }
1103
- orderBy: [${types_1.AssetTransactionsOrderBy.CreatedAtAsc}, ${types_1.AssetTransactionsOrderBy.CreatedBlockIdAsc}]
1104
- ) {
1105
- totalCount
1106
- nodes {
1107
- assetId
1108
- nftIds
1109
- fromPortfolioId
1110
- fromPortfolio {
1111
- identityId
1112
- number
1113
- }
1114
- toPortfolioId
1115
- toPortfolio {
1116
- identityId
1117
- number
1118
- }
1119
- eventId
1120
- eventIdx
1121
- extrinsicIdx
1122
- fundingRound
1123
- instructionId
1124
- instructionMemo
1125
- datetime
1126
- createdBlock {
1127
- blockId
1128
- hash
1129
- datetime
1130
- }
1131
- }
1132
- }
1133
- }
1134
- `;
1135
- return {
1136
- query,
1137
- 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() }),
1138
- };
1139
- }
1140
- exports.nftTransactionQuery = nftTransactionQuery;
1141
- /**
1142
- * @hidden
1143
- *
1144
- * Get POLYX transactions where an Account or an Identity is involved
1145
- */
1146
- function polyxTransactionsQuery(filters, size, start) {
1147
- const { args, filter, variables } = createPolyxTransactionFilters(filters);
1148
- const query = (0, graphql_tag_1.default) `
1149
- query PolyxTransactionsQuery
1150
- ${args}
1151
- {
1152
- polyxTransactions(
1153
- ${filter}
1154
- first: $size
1155
- offset: $start
1156
- orderBy: [${types_1.PolyxTransactionsOrderBy.CreatedAtAsc}, ${types_1.PolyxTransactionsOrderBy.CreatedBlockIdAsc}]
1157
- ) {
1158
- nodes {
1159
- id
1160
- identityId
1161
- address
1162
- toId
1163
- toAddress
1164
- amount
1165
- type
1166
- extrinsic {
1167
- extrinsicIdx
1168
- }
1169
- callId
1170
- eventId
1171
- moduleId
1172
- eventIdx
1173
- memo
1174
- datetime
1175
- createdBlock {
1176
- blockId
1177
- datetime
1178
- hash
1179
- }
1180
- }
1181
- }
1182
- }
1183
- `;
1184
- return {
1185
- query,
1186
- 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() }),
1187
- };
1188
- }
1189
- exports.polyxTransactionsQuery = polyxTransactionsQuery;
1190
- /**
1191
- * @hidden
1192
- */
1193
- function createAuthorizationFilters(variables) {
1194
- const args = ['$size: Int, $start: Int'];
1195
- const filters = [];
1196
- const { fromId, toId, toKey, status, type } = variables;
1197
- if (fromId === null || fromId === void 0 ? void 0 : fromId.length) {
1198
- args.push('$fromId: String!');
1199
- filters.push('fromId: { equalTo: $fromId }');
1200
- }
1201
- if (toId === null || toId === void 0 ? void 0 : toId.length) {
1202
- args.push('$toId: String!');
1203
- filters.push('toId: { equalTo: $toId }');
1204
- }
1205
- if (toKey === null || toKey === void 0 ? void 0 : toKey.length) {
1206
- args.push('$toKey: String!');
1207
- filters.push('toKey: { equalTo: $toKey }');
1208
- }
1209
- if (type) {
1210
- args.push('$type: AuthTypeEnum!');
1211
- filters.push('type: { equalTo: $type }');
1212
- }
1213
- if (status) {
1214
- args.push('$status: AuthorizationStatusEnum!');
1215
- filters.push('status: { equalTo: $status }');
1216
- }
1217
- return {
1218
- args: `(${args.join()})`,
1219
- filter: filters.length ? `filter: { ${filters.join()} }` : '',
1220
- variables,
1221
- };
1222
- }
1223
- /**
1224
- * @hidden
1225
- *
1226
- * Get all authorizations with specified filters
1227
- */
1228
- function authorizationsQuery(filters, size, start) {
1229
- const { args, filter } = createAuthorizationFilters(filters);
1230
- const query = (0, graphql_tag_1.default) `
1231
- query AuthorizationsQuery
1232
- ${args}
1233
- {
1234
- authorizations(
1235
- ${filter}
1236
- first: $size
1237
- offset: $start
1238
- orderBy: [${types_1.AuthorizationsOrderBy.CreatedAtAsc}, ${types_1.AuthorizationsOrderBy.CreatedBlockIdAsc}]
1239
- ) {
1240
- totalCount
1241
- nodes {
1242
- id
1243
- type
1244
- fromId
1245
- toId
1246
- toKey
1247
- data
1248
- expiry
1249
- status
1250
- createdBlockId
1251
- updatedBlockId
1252
- }
1253
- }
1254
- }
1255
- `;
1256
- return {
1257
- query,
1258
- 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() }),
1259
- };
1260
- }
1261
- exports.authorizationsQuery = authorizationsQuery;
1262
- /**
1263
- * @hidden
1264
- *
1265
- * Get MultiSig proposal details for a given MultiSig address and portfolio ID
1266
- */
1267
- function multiSigProposalQuery(variables) {
1268
- const query = (0, graphql_tag_1.default) `
1269
- query MultiSigProposalQuery($multisigId: String!, $proposalId: Int!) {
1270
- multiSigProposals(
1271
- filter: { multisigId: { equalTo: $multisigId }, proposalId: { equalTo: $proposalId } }
1272
- ) {
1273
- nodes {
1274
- eventIdx
1275
- creatorId
1276
- creatorAccount
1277
- createdBlock {
1278
- blockId
1279
- hash
1280
- datetime
1281
- }
1282
- votes {
1283
- nodes {
1284
- action
1285
- signer {
1286
- signerType
1287
- signerValue
1288
- }
1289
- }
1290
- }
1291
- updatedBlock {
1292
- blockId
1293
- hash
1294
- datetime
1295
- }
1296
- }
1297
- }
1298
- }
1299
- `;
1300
- return {
1301
- query,
1302
- variables,
1303
- };
1304
- }
1305
- exports.multiSigProposalQuery = multiSigProposalQuery;
1306
- /**
1307
- * @hidden
1308
- *
1309
- * Get MultiSig proposal votes for a given proposalId ({multiSigAddress}/{proposalId})
1310
- */
1311
- function multiSigProposalVotesQuery(variables) {
1312
- const query = (0, graphql_tag_1.default) `
1313
- query MultiSigProposalVotesQuery($proposalId: String!) {
1314
- multiSigProposalVotes(
1315
- filter: { proposalId: { equalTo: $proposalId } }
1316
- orderBy: [${types_1.MultiSigProposalVotesOrderBy.CreatedAtAsc}]
1317
- ) {
1318
- nodes {
1319
- signer {
1320
- signerType
1321
- signerValue
1322
- }
1323
- action
1324
- eventIdx
1325
- createdBlockId
1326
- createdBlock {
1327
- blockId
1328
- datetime
1329
- hash
1330
- }
1331
- }
1332
- }
1333
- }
1334
- `;
1335
- return {
1336
- query,
1337
- variables,
1338
- };
1339
- }
1340
- exports.multiSigProposalVotesQuery = multiSigProposalVotesQuery;
1341
- /**
1342
- * @hidden
1343
- */
1344
- function createCustomClaimTypeQueryFilters(variables) {
1345
- const args = ['$size: Int, $start: Int'];
1346
- const filters = [];
1347
- const { dids } = variables;
1348
- if (dids === null || dids === void 0 ? void 0 : dids.length) {
1349
- args.push('$dids: [String!]');
1350
- filters.push('identityId: { in: $dids }');
1351
- }
1352
- return {
1353
- args: `(${args.join()})`,
1354
- filter: filters.length ? `filter: { ${filters.join()} },` : '',
1355
- };
1356
- }
1357
- exports.createCustomClaimTypeQueryFilters = createCustomClaimTypeQueryFilters;
1358
- /**
1359
- * @hidden
1360
- *
1361
- * Get registered CustomClaimTypes
1362
- */
1363
- function customClaimTypeQuery(size, start, dids) {
1364
- const { args, filter } = createCustomClaimTypeQueryFilters({ dids });
1365
- const query = (0, graphql_tag_1.default) `
1366
- query CustomClaimTypesQuery
1367
- ${args}
1368
- {
1369
- customClaimTypes(
1370
- ${filter}
1371
- first: $size
1372
- offset: $start
1373
- ){
1374
- nodes {
1375
- id
1376
- name
1377
- identity {
1378
- did
1379
- }
1380
- }
1381
- totalCount
1382
- }
1383
- }
1384
- `;
1385
- return {
1386
- query,
1387
- variables: { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber(), dids },
1388
- };
1389
- }
1390
- exports.customClaimTypeQuery = customClaimTypeQuery;
1391
- /**
1392
- * @hidden
1393
- *
1394
- * Get holders on an NFT Collection
1395
- */
1396
- function nftCollectionHolders(assetId, size, start) {
1397
- const query = (0, graphql_tag_1.default) `
1398
- query NftCollectionHolders($assetId: String!, $size: Int, $start: Int) {
1399
- nftHolders(
1400
- first: $size
1401
- offset: $start
1402
- filter: { assetId: { equalTo: $assetId }, nftIds: { notEqualTo: [] } }
1403
- orderBy: IDENTITY_ID_DESC
1404
- ) {
1405
- nodes {
1406
- identityId
1407
- nftIds
1408
- }
1409
- totalCount
1410
- }
1411
- }
1412
- `;
1413
- return {
1414
- query,
1415
- variables: { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber(), assetId },
1416
- };
1417
- }
1418
- exports.nftCollectionHolders = nftCollectionHolders;
1419
- /**
1420
- * @hidden
1421
- *
1422
- * Get MultiSig Proposals history for a given MultiSig address
1423
- */
1424
- function multiSigProposalsQuery(multisigId, size, start) {
1425
- const query = (0, graphql_tag_1.default) `
1426
- query MultiSigProposalsQuery($size: Int, $start: Int, $multisigId: String!) {
1427
- multiSigProposals(
1428
- filter: { multisigId: { equalTo: $multisigId } }
1429
- first: $size
1430
- offset: $start
1431
- ) {
1432
- nodes {
1433
- id
1434
- proposalId
1435
- multisigId
1436
- }
1437
- totalCount
1438
- }
1439
- }
1440
- `;
1441
- return {
1442
- query,
1443
- variables: { size: size === null || size === void 0 ? void 0 : size.toNumber(), start: start === null || start === void 0 ? void 0 : start.toNumber(), multisigId },
1444
- };
1445
- }
1446
- exports.multiSigProposalsQuery = multiSigProposalsQuery;
1447
- //# sourceMappingURL=queries.js.map