@polymeshassociation/polymesh-sdk 15.0.0-alpha.13 → 15.0.0-alpha.16
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 +22 -5
- package/api/client/Assets.d.ts +7 -1
- package/api/client/Assets.d.ts.map +1 -1
- package/api/client/Assets.js +18 -0
- package/api/client/Assets.js.map +1 -1
- package/api/client/Claims.d.ts +60 -1
- package/api/client/Claims.d.ts.map +1 -1
- package/api/client/Claims.js +130 -3
- package/api/client/Claims.js.map +1 -1
- package/api/client/Identities.d.ts +7 -1
- package/api/client/Identities.d.ts.map +1 -1
- package/api/client/Identities.js +13 -1
- package/api/client/Identities.js.map +1 -1
- package/api/client/Network.d.ts +51 -0
- package/api/client/Network.d.ts.map +1 -1
- package/api/client/Network.js +106 -0
- package/api/client/Network.js.map +1 -1
- package/api/client/Polymesh.d.ts +1 -0
- package/api/client/Polymesh.d.ts.map +1 -1
- package/api/client/Polymesh.js +33 -28
- package/api/client/Polymesh.js.map +1 -1
- package/api/entities/Account.d.ts +22 -0
- package/api/entities/Account.d.ts.map +1 -1
- package/api/entities/Account.js +71 -5
- package/api/entities/Account.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts +61 -0
- package/api/entities/Asset/TransferRestrictions/ClaimCount.d.ts.map +1 -0
- package/api/entities/Asset/TransferRestrictions/ClaimCount.js +16 -0
- package/api/entities/Asset/TransferRestrictions/ClaimCount.js.map +1 -0
- package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts +52 -0
- package/api/entities/Asset/TransferRestrictions/ClaimPercentage.d.ts.map +1 -0
- package/api/entities/Asset/TransferRestrictions/ClaimPercentage.js +16 -0
- package/api/entities/Asset/TransferRestrictions/ClaimPercentage.js.map +1 -0
- package/api/entities/Asset/TransferRestrictions/Count.d.ts +41 -4
- package/api/entities/Asset/TransferRestrictions/Count.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/Count.js +6 -2
- package/api/entities/Asset/TransferRestrictions/Count.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/Percentage.d.ts +17 -2
- package/api/entities/Asset/TransferRestrictions/Percentage.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/Percentage.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.d.ts +15 -1
- package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js +41 -6
- package/api/entities/Asset/TransferRestrictions/TransferRestrictionBase.js.map +1 -1
- package/api/entities/Asset/TransferRestrictions/index.d.ts +4 -0
- package/api/entities/Asset/TransferRestrictions/index.d.ts.map +1 -1
- package/api/entities/Asset/TransferRestrictions/index.js +4 -0
- package/api/entities/Asset/TransferRestrictions/index.js.map +1 -1
- package/api/entities/Asset/index.d.ts +15 -0
- package/api/entities/Asset/index.d.ts.map +1 -1
- package/api/entities/Asset/index.js +38 -0
- package/api/entities/Asset/index.js.map +1 -1
- package/api/entities/CorporateActionBase/index.js +1 -1
- package/api/entities/CorporateActionBase/index.js.map +1 -1
- package/api/entities/DefaultTrustedClaimIssuer.d.ts +7 -0
- package/api/entities/DefaultTrustedClaimIssuer.d.ts.map +1 -1
- package/api/entities/DefaultTrustedClaimIssuer.js +17 -0
- package/api/entities/DefaultTrustedClaimIssuer.js.map +1 -1
- package/api/entities/DividendDistribution/index.d.ts +16 -0
- package/api/entities/DividendDistribution/index.d.ts.map +1 -1
- package/api/entities/DividendDistribution/index.js +69 -0
- package/api/entities/DividendDistribution/index.js.map +1 -1
- package/api/entities/Identity/AssetPermissions.d.ts +29 -0
- package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
- package/api/entities/Identity/AssetPermissions.js +53 -1
- package/api/entities/Identity/AssetPermissions.js.map +1 -1
- package/api/entities/Identity/index.d.ts +23 -4
- package/api/entities/Identity/index.d.ts.map +1 -1
- package/api/entities/Identity/index.js +68 -23
- package/api/entities/Identity/index.js.map +1 -1
- package/api/entities/Instruction/index.d.ts +11 -0
- package/api/entities/Instruction/index.d.ts.map +1 -1
- package/api/entities/Instruction/index.js +51 -0
- package/api/entities/Instruction/index.js.map +1 -1
- package/api/entities/NumberedPortfolio.d.ts +7 -0
- package/api/entities/NumberedPortfolio.d.ts.map +1 -1
- package/api/entities/NumberedPortfolio.js +17 -0
- package/api/entities/NumberedPortfolio.js.map +1 -1
- package/api/entities/Offering/index.d.ts +13 -0
- package/api/entities/Offering/index.d.ts.map +1 -1
- package/api/entities/Offering/index.js +32 -0
- package/api/entities/Offering/index.js.map +1 -1
- package/api/entities/Portfolio/index.d.ts +12 -0
- package/api/entities/Portfolio/index.d.ts.map +1 -1
- package/api/entities/Portfolio/index.js +94 -5
- package/api/entities/Portfolio/index.js.map +1 -1
- package/api/entities/Venue/index.d.ts +5 -1
- package/api/entities/Venue/index.d.ts.map +1 -1
- package/api/entities/Venue/index.js +8 -1
- package/api/entities/Venue/index.js.map +1 -1
- package/api/procedures/addAssetStat.d.ts +16 -0
- package/api/procedures/addAssetStat.d.ts.map +1 -0
- package/api/procedures/addAssetStat.js +91 -0
- package/api/procedures/addAssetStat.js.map +1 -0
- package/api/procedures/addTransferRestriction.d.ts +5 -15
- package/api/procedures/addTransferRestriction.d.ts.map +1 -1
- package/api/procedures/addTransferRestriction.js +43 -87
- package/api/procedures/addTransferRestriction.js.map +1 -1
- package/api/procedures/createAsset.d.ts +1 -1
- package/api/procedures/createAsset.d.ts.map +1 -1
- package/api/procedures/createAsset.js +56 -31
- package/api/procedures/createAsset.js.map +1 -1
- package/api/procedures/createPortfolios.d.ts +21 -0
- package/api/procedures/createPortfolios.d.ts.map +1 -0
- package/api/procedures/createPortfolios.js +79 -0
- package/api/procedures/createPortfolios.js.map +1 -0
- package/api/procedures/leaveIdentity.d.ts.map +1 -1
- package/api/procedures/leaveIdentity.js +6 -2
- package/api/procedures/leaveIdentity.js.map +1 -1
- package/api/procedures/modifySignerPermissions.d.ts.map +1 -1
- package/api/procedures/modifySignerPermissions.js +4 -2
- package/api/procedures/modifySignerPermissions.js.map +1 -1
- package/api/procedures/removeAssetRequirement.js +1 -1
- package/api/procedures/removeAssetRequirement.js.map +1 -1
- package/api/procedures/removeAssetStat.d.ts +16 -0
- package/api/procedures/removeAssetStat.d.ts.map +1 -0
- package/api/procedures/removeAssetStat.js +88 -0
- package/api/procedures/removeAssetStat.js.map +1 -0
- package/api/procedures/removeSecondaryAccounts.d.ts.map +1 -1
- package/api/procedures/removeSecondaryAccounts.js +3 -3
- package/api/procedures/removeSecondaryAccounts.js.map +1 -1
- package/api/procedures/renamePortfolio.js +1 -1
- package/api/procedures/renamePortfolio.js.map +1 -1
- package/api/procedures/setTransferRestrictions.d.ts +1 -7
- package/api/procedures/setTransferRestrictions.d.ts.map +1 -1
- package/api/procedures/setTransferRestrictions.js +51 -64
- package/api/procedures/setTransferRestrictions.js.map +1 -1
- package/api/procedures/types.d.ts +98 -5
- package/api/procedures/types.d.ts.map +1 -1
- package/api/procedures/types.js +25 -1
- package/api/procedures/types.js.map +1 -1
- package/api/procedures/utils.d.ts.map +1 -1
- package/api/procedures/utils.js +3 -7
- package/api/procedures/utils.js.map +1 -1
- package/base/Context.d.ts +61 -0
- package/base/Context.d.ts.map +1 -1
- package/base/Context.js +150 -5
- package/base/Context.js.map +1 -1
- package/base/Procedure.js +1 -1
- package/generated/utils.js +1 -1
- package/generated/utils.js.map +1 -1
- package/internal.d.ts +6 -3
- package/internal.d.ts.map +1 -1
- package/internal.js +8 -4
- package/internal.js.map +1 -1
- package/middleware/queriesV2.d.ts +142 -0
- package/middleware/queriesV2.d.ts.map +1 -0
- package/middleware/queriesV2.js +772 -0
- package/middleware/queriesV2.js.map +1 -0
- package/middleware/typesV2.d.ts +26467 -0
- package/middleware/typesV2.d.ts.map +1 -0
- package/middleware/typesV2.js +2697 -0
- package/middleware/typesV2.js.map +1 -0
- package/npm-package/polymeshassociation-polymesh-sdk-15.0.0-alpha.16.tgz +0 -0
- package/package.json +54 -58
- package/polkadot/augment-api-events.d.ts +135 -34
- package/polkadot/augment-api-events.d.ts.map +1 -1
- package/polkadot/augment-api-query.d.ts +4 -7
- package/polkadot/augment-api-query.d.ts.map +1 -1
- package/polkadot/augment-api-rpc.d.ts +6 -2
- package/polkadot/augment-api-rpc.d.ts.map +1 -1
- package/polkadot/augment-api-tx.d.ts +25 -67
- package/polkadot/augment-api-tx.d.ts.map +1 -1
- package/polkadot/augment-types.d.ts +8 -6
- package/polkadot/augment-types.d.ts.map +1 -1
- package/polkadot/lookup.d.ts +0 -32
- package/polkadot/lookup.d.ts.map +1 -1
- package/polkadot/lookup.js +13 -45
- package/polkadot/lookup.js.map +1 -1
- package/polkadot/registry.d.ts +1 -9
- package/polkadot/registry.d.ts.map +1 -1
- package/polkadot/types-lookup.d.ts +14 -38
- package/polkadot/types-lookup.d.ts.map +1 -1
- package/types/index.d.ts +114 -3
- package/types/index.d.ts.map +1 -1
- package/types/index.js +10 -3
- package/types/index.js.map +1 -1
- package/types/internal.d.ts +14 -2
- package/types/internal.d.ts.map +1 -1
- package/types/internal.js +2 -0
- package/types/internal.js.map +1 -1
- package/types/utils/index.d.ts +14 -0
- package/types/utils/index.d.ts.map +1 -1
- package/types/utils/index.js.map +1 -1
- package/utils/conversion.d.ts +101 -15
- package/utils/conversion.d.ts.map +1 -1
- package/utils/conversion.js +410 -30
- package/utils/conversion.js.map +1 -1
- package/utils/internal.d.ts +58 -5
- package/utils/internal.d.ts.map +1 -1
- package/utils/internal.js +252 -17
- package/utils/internal.js.map +1 -1
- package/api/procedures/createPortfolio.d.ts +0 -21
- package/api/procedures/createPortfolio.d.ts.map +0 -1
- package/api/procedures/createPortfolio.js +0 -64
- package/api/procedures/createPortfolio.js.map +0 -1
- package/npm-package/polymeshassociation-polymesh-sdk-15.0.0-alpha.13.tgz +0 -0
|
@@ -0,0 +1,772 @@
|
|
|
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.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.instructionsQuery = exports.investmentsQuery = exports.claimsQuery = exports.claimsGroupingQuery = exports.heartbeatQuery = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
const typesV2_1 = require("./typesV2");
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*
|
|
12
|
+
* Middleware V2 heartbeat
|
|
13
|
+
*/
|
|
14
|
+
function heartbeatQuery() {
|
|
15
|
+
const query = (0, graphql_tag_1.default) `
|
|
16
|
+
query {
|
|
17
|
+
block(id: "1") {
|
|
18
|
+
id
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
return {
|
|
23
|
+
query,
|
|
24
|
+
variables: undefined,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
exports.heartbeatQuery = heartbeatQuery;
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
function createClaimsFilters(variables) {
|
|
32
|
+
const args = ['$size: Int, $start: Int'];
|
|
33
|
+
const filters = ['revokeDate: { isNull: true }'];
|
|
34
|
+
const { dids, claimTypes, trustedClaimIssuers, scope, includeExpired } = variables;
|
|
35
|
+
if (dids) {
|
|
36
|
+
args.push('$dids: [String!]');
|
|
37
|
+
filters.push('targetId: { in: $dids }');
|
|
38
|
+
}
|
|
39
|
+
if (claimTypes) {
|
|
40
|
+
args.push('$claimTypes: [ClaimTypeEnum!]!');
|
|
41
|
+
filters.push('type: { in: $claimTypes }');
|
|
42
|
+
}
|
|
43
|
+
if (trustedClaimIssuers) {
|
|
44
|
+
args.push('$trustedClaimIssuers: [String!]');
|
|
45
|
+
filters.push('issuerId: { in: $trustedClaimIssuers }');
|
|
46
|
+
}
|
|
47
|
+
if (scope !== undefined) {
|
|
48
|
+
args.push('$scope: JSON!');
|
|
49
|
+
filters.push('scope: { contains: $scope }');
|
|
50
|
+
}
|
|
51
|
+
if (!includeExpired) {
|
|
52
|
+
args.push('$expiryTimestamp: BigFloat');
|
|
53
|
+
filters.push('filterExpiry: { lessThan: $expiryTimestamp }');
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
args: `(${args.join()})`,
|
|
57
|
+
filter: `filter: { ${filters.join()} },`,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @hidden
|
|
62
|
+
*
|
|
63
|
+
* Get all dids with at least one claim for a given scope and from one of the given trusted claim issuers
|
|
64
|
+
*/
|
|
65
|
+
function claimsGroupingQuery(variables, orderBy = typesV2_1.ClaimsOrderBy.TargetIdAsc, groupBy = typesV2_1.ClaimsGroupBy.TargetId) {
|
|
66
|
+
const { args, filter } = createClaimsFilters(variables);
|
|
67
|
+
const query = (0, graphql_tag_1.default) `
|
|
68
|
+
query claimsGroupingQuery
|
|
69
|
+
${args}
|
|
70
|
+
{
|
|
71
|
+
claims(
|
|
72
|
+
${filter}
|
|
73
|
+
orderBy: [${orderBy}]
|
|
74
|
+
first: $size
|
|
75
|
+
offset: $start
|
|
76
|
+
) {
|
|
77
|
+
groupedAggregates(groupBy: [${groupBy}], having: {}) {
|
|
78
|
+
keys
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
return {
|
|
84
|
+
query,
|
|
85
|
+
variables,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
exports.claimsGroupingQuery = claimsGroupingQuery;
|
|
89
|
+
/**
|
|
90
|
+
* @hidden
|
|
91
|
+
*
|
|
92
|
+
* Get all claims that a given target DID has, with a given scope and from one of the given trustedClaimIssuers
|
|
93
|
+
*/
|
|
94
|
+
function claimsQuery(filters, size, start) {
|
|
95
|
+
const { args, filter } = createClaimsFilters(filters);
|
|
96
|
+
const query = (0, graphql_tag_1.default) `
|
|
97
|
+
query ClaimsQuery
|
|
98
|
+
${args}
|
|
99
|
+
{
|
|
100
|
+
claims(
|
|
101
|
+
${filter}
|
|
102
|
+
orderBy: [${typesV2_1.ClaimsOrderBy.TargetIdAsc}, ${typesV2_1.ClaimsOrderBy.CreatedBlockIdAsc}, ${typesV2_1.ClaimsOrderBy.EventIdxAsc}]
|
|
103
|
+
first: $size
|
|
104
|
+
offset: $start
|
|
105
|
+
) {
|
|
106
|
+
totalCount
|
|
107
|
+
nodes {
|
|
108
|
+
targetId
|
|
109
|
+
type
|
|
110
|
+
scope
|
|
111
|
+
cddId
|
|
112
|
+
issuerId
|
|
113
|
+
issuanceDate
|
|
114
|
+
lastUpdateDate
|
|
115
|
+
expiry
|
|
116
|
+
jurisdiction
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
return {
|
|
122
|
+
query,
|
|
123
|
+
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() }),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
exports.claimsQuery = claimsQuery;
|
|
127
|
+
/**
|
|
128
|
+
* @hidden
|
|
129
|
+
*
|
|
130
|
+
* Get all investments for a given offering
|
|
131
|
+
*/
|
|
132
|
+
function investmentsQuery(filters, size, start) {
|
|
133
|
+
const query = (0, graphql_tag_1.default) `
|
|
134
|
+
query InvestmentsQuery($stoId: Int!, $offeringToken: String!, $size: Int, $start: Int) {
|
|
135
|
+
investments(
|
|
136
|
+
filter: { stoId: { equalTo: $stoId }, offeringToken: { equalTo: $offeringToken } }
|
|
137
|
+
first: $size
|
|
138
|
+
offset: $start
|
|
139
|
+
orderBy: [${typesV2_1.InvestmentsOrderBy.CreatedBlockIdAsc}]
|
|
140
|
+
) {
|
|
141
|
+
totalCount
|
|
142
|
+
nodes {
|
|
143
|
+
investorId
|
|
144
|
+
offeringToken
|
|
145
|
+
raiseToken
|
|
146
|
+
offeringTokenAmount
|
|
147
|
+
raiseTokenAmount
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
152
|
+
return {
|
|
153
|
+
query,
|
|
154
|
+
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() }),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
exports.investmentsQuery = investmentsQuery;
|
|
158
|
+
/**
|
|
159
|
+
* @hidden
|
|
160
|
+
*
|
|
161
|
+
* Get a specific instruction within a venue for a specific event
|
|
162
|
+
*/
|
|
163
|
+
function instructionsQuery(variables) {
|
|
164
|
+
const query = (0, graphql_tag_1.default) `
|
|
165
|
+
query InstructionsQuery($eventId: String!, $id: String!) {
|
|
166
|
+
instructions(
|
|
167
|
+
filter: { eventId: { equalTo: $eventId }, id: { equalTo: $id } }
|
|
168
|
+
first: 1
|
|
169
|
+
orderBy: [${typesV2_1.InstructionsOrderBy.IdDesc}]
|
|
170
|
+
) {
|
|
171
|
+
nodes {
|
|
172
|
+
eventIdx
|
|
173
|
+
eventId
|
|
174
|
+
status
|
|
175
|
+
settlementType
|
|
176
|
+
updatedBlock {
|
|
177
|
+
blockId
|
|
178
|
+
hash
|
|
179
|
+
datetime
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
`;
|
|
185
|
+
return {
|
|
186
|
+
query,
|
|
187
|
+
variables,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
exports.instructionsQuery = instructionsQuery;
|
|
191
|
+
/**
|
|
192
|
+
* Create args and filters to be supplied to GQL query
|
|
193
|
+
*
|
|
194
|
+
* @param filters - filters to be applied
|
|
195
|
+
* @param typeMap - Map defining the types corresponding to each attribute. All missing attributes whose types are not defined are considered to be `String`
|
|
196
|
+
*
|
|
197
|
+
* @hidden
|
|
198
|
+
*/
|
|
199
|
+
function createArgsAndFilters(filters, typeMap) {
|
|
200
|
+
const args = ['$start: Int', '$size: Int'];
|
|
201
|
+
const gqlFilters = [];
|
|
202
|
+
Object.keys(filters).forEach(attribute => {
|
|
203
|
+
if (filters[attribute]) {
|
|
204
|
+
const type = typeMap[attribute] || 'String';
|
|
205
|
+
args.push(`$${attribute}: ${type}!`);
|
|
206
|
+
gqlFilters.push(`${attribute}: { equalTo: $${attribute} }`);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return {
|
|
210
|
+
args: `(${args.join()})`,
|
|
211
|
+
filter: gqlFilters.length ? `filter: { ${gqlFilters.join()} }` : '',
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @hidden
|
|
216
|
+
*
|
|
217
|
+
* Get a single event by any of its indexed arguments
|
|
218
|
+
*/
|
|
219
|
+
function eventsByArgs(filters, size, start) {
|
|
220
|
+
const { args, filter } = createArgsAndFilters(filters, {
|
|
221
|
+
moduleId: 'ModuleIdEnum',
|
|
222
|
+
eventId: 'EventIdEnum',
|
|
223
|
+
});
|
|
224
|
+
const query = (0, graphql_tag_1.default) `
|
|
225
|
+
query EventsQuery
|
|
226
|
+
${args}
|
|
227
|
+
{
|
|
228
|
+
events(
|
|
229
|
+
${filter}
|
|
230
|
+
orderBy: [${typesV2_1.EventsOrderBy.BlockIdAsc}]
|
|
231
|
+
first: $size
|
|
232
|
+
offset: $start
|
|
233
|
+
) {
|
|
234
|
+
nodes {
|
|
235
|
+
eventIdx
|
|
236
|
+
block {
|
|
237
|
+
blockId
|
|
238
|
+
hash
|
|
239
|
+
datetime
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
`;
|
|
245
|
+
return {
|
|
246
|
+
query,
|
|
247
|
+
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() }),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
exports.eventsByArgs = eventsByArgs;
|
|
251
|
+
/**
|
|
252
|
+
* @hidden
|
|
253
|
+
*
|
|
254
|
+
* Get a transaction by hash
|
|
255
|
+
*/
|
|
256
|
+
function extrinsicByHash(variables) {
|
|
257
|
+
const query = (0, graphql_tag_1.default) `
|
|
258
|
+
query TransactionByHashQuery($extrinsicHash: String!) {
|
|
259
|
+
extrinsics(filter: { extrinsicHash: { equalTo: $extrinsicHash } }) {
|
|
260
|
+
nodes {
|
|
261
|
+
extrinsicIdx
|
|
262
|
+
address
|
|
263
|
+
nonce
|
|
264
|
+
moduleId
|
|
265
|
+
callId
|
|
266
|
+
paramsTxt
|
|
267
|
+
success
|
|
268
|
+
specVersionId
|
|
269
|
+
extrinsicHash
|
|
270
|
+
block {
|
|
271
|
+
blockId
|
|
272
|
+
hash
|
|
273
|
+
datetime
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
`;
|
|
279
|
+
return {
|
|
280
|
+
query,
|
|
281
|
+
variables,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
exports.extrinsicByHash = extrinsicByHash;
|
|
285
|
+
/**
|
|
286
|
+
* @hidden
|
|
287
|
+
*
|
|
288
|
+
* Get transactions
|
|
289
|
+
*/
|
|
290
|
+
function extrinsicsByArgs(filters, size, start, orderBy = typesV2_1.ExtrinsicsOrderBy.BlockIdAsc) {
|
|
291
|
+
const { args, filter } = createArgsAndFilters(filters, {
|
|
292
|
+
moduleId: 'ModuleIdEnum',
|
|
293
|
+
callId: 'CallIdEnum',
|
|
294
|
+
success: 'Int',
|
|
295
|
+
});
|
|
296
|
+
const query = (0, graphql_tag_1.default) `
|
|
297
|
+
query TransactionsQuery
|
|
298
|
+
${args}
|
|
299
|
+
{
|
|
300
|
+
extrinsics(
|
|
301
|
+
${filter}
|
|
302
|
+
orderBy: [${orderBy}]
|
|
303
|
+
first: $size
|
|
304
|
+
offset: $start
|
|
305
|
+
) {
|
|
306
|
+
totalCount
|
|
307
|
+
nodes {
|
|
308
|
+
blockId
|
|
309
|
+
extrinsicIdx
|
|
310
|
+
address
|
|
311
|
+
nonce
|
|
312
|
+
moduleId
|
|
313
|
+
callId
|
|
314
|
+
paramsTxt
|
|
315
|
+
success
|
|
316
|
+
specVersionId
|
|
317
|
+
extrinsicHash
|
|
318
|
+
block {
|
|
319
|
+
hash
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
`;
|
|
325
|
+
return {
|
|
326
|
+
query,
|
|
327
|
+
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() }),
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
exports.extrinsicsByArgs = extrinsicsByArgs;
|
|
331
|
+
/**
|
|
332
|
+
* @hidden
|
|
333
|
+
*
|
|
334
|
+
* Get an trusted claim issuer event for an asset and an issuer
|
|
335
|
+
*/
|
|
336
|
+
function trustedClaimIssuerQuery(variables) {
|
|
337
|
+
const query = (0, graphql_tag_1.default) `
|
|
338
|
+
query TrustedClaimIssuerQuery($assetId: String!, $issuer: String!) {
|
|
339
|
+
trustedClaimIssuers(
|
|
340
|
+
filter: { assetId: { equalTo: $assetId }, issuer: { equalTo: $issuer } }
|
|
341
|
+
) {
|
|
342
|
+
nodes {
|
|
343
|
+
eventIdx
|
|
344
|
+
createdBlock {
|
|
345
|
+
blockId
|
|
346
|
+
datetime
|
|
347
|
+
hash
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
`;
|
|
353
|
+
return {
|
|
354
|
+
query,
|
|
355
|
+
variables,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
exports.trustedClaimIssuerQuery = trustedClaimIssuerQuery;
|
|
359
|
+
/**
|
|
360
|
+
* @hidden
|
|
361
|
+
*
|
|
362
|
+
* Get an trusted claim issuer event for an asset and an issuer
|
|
363
|
+
*/
|
|
364
|
+
function trustingAssetsQuery(variables) {
|
|
365
|
+
const query = (0, graphql_tag_1.default) `
|
|
366
|
+
query TrustedClaimIssuerQuery($issuer: String!) {
|
|
367
|
+
trustedClaimIssuers(filter: { issuer: { equalTo: $issuer } }) {
|
|
368
|
+
nodes {
|
|
369
|
+
assetId
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
`;
|
|
374
|
+
return {
|
|
375
|
+
query,
|
|
376
|
+
variables,
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
exports.trustingAssetsQuery = trustingAssetsQuery;
|
|
380
|
+
/**
|
|
381
|
+
* @hidden
|
|
382
|
+
*
|
|
383
|
+
* Get portfolio details for a given DID and portfolio number
|
|
384
|
+
*/
|
|
385
|
+
function portfolioQuery(variables) {
|
|
386
|
+
const query = (0, graphql_tag_1.default) `
|
|
387
|
+
query PortfolioQuery($identityId: String!, $number: Int!) {
|
|
388
|
+
portfolios(filter: { identityId: { equalTo: $identityId }, number: { equalTo: $number } }) {
|
|
389
|
+
nodes {
|
|
390
|
+
eventIdx
|
|
391
|
+
createdBlock {
|
|
392
|
+
blockId
|
|
393
|
+
datetime
|
|
394
|
+
hash
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
`;
|
|
400
|
+
return {
|
|
401
|
+
query,
|
|
402
|
+
variables,
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
exports.portfolioQuery = portfolioQuery;
|
|
406
|
+
/**
|
|
407
|
+
* @hidden
|
|
408
|
+
*
|
|
409
|
+
* Get Asset details for a given ticker
|
|
410
|
+
*/
|
|
411
|
+
function assetQuery(variables) {
|
|
412
|
+
const query = (0, graphql_tag_1.default) `
|
|
413
|
+
query AssetQuery($ticker: String!) {
|
|
414
|
+
assets(filter: { ticker: { equalTo: $ticker } }) {
|
|
415
|
+
nodes {
|
|
416
|
+
eventIdx
|
|
417
|
+
createdBlock {
|
|
418
|
+
blockId
|
|
419
|
+
datetime
|
|
420
|
+
hash
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
`;
|
|
426
|
+
return {
|
|
427
|
+
query,
|
|
428
|
+
variables,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
exports.assetQuery = assetQuery;
|
|
432
|
+
/**
|
|
433
|
+
* @hidden
|
|
434
|
+
*
|
|
435
|
+
* Get the event details when external agent added for a ticker
|
|
436
|
+
*/
|
|
437
|
+
function tickerExternalAgentsQuery(variables) {
|
|
438
|
+
const query = (0, graphql_tag_1.default) `
|
|
439
|
+
query TickerExternalAgentQuery($assetId: String!) {
|
|
440
|
+
tickerExternalAgents(
|
|
441
|
+
filter: { assetId: { equalTo: $assetId } }
|
|
442
|
+
orderBy: [${typesV2_1.TickerExternalAgentsOrderBy.CreatedBlockIdDesc}]
|
|
443
|
+
first: 1
|
|
444
|
+
) {
|
|
445
|
+
nodes {
|
|
446
|
+
eventIdx
|
|
447
|
+
createdBlock {
|
|
448
|
+
blockId
|
|
449
|
+
datetime
|
|
450
|
+
hash
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
`;
|
|
456
|
+
return {
|
|
457
|
+
query,
|
|
458
|
+
variables,
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
exports.tickerExternalAgentsQuery = tickerExternalAgentsQuery;
|
|
462
|
+
/**
|
|
463
|
+
* @hidden
|
|
464
|
+
*
|
|
465
|
+
* Get the transaction history of each external agent of an Asset
|
|
466
|
+
*/
|
|
467
|
+
function tickerExternalAgentHistoryQuery(variables) {
|
|
468
|
+
const query = (0, graphql_tag_1.default) `
|
|
469
|
+
query TickerExternalAgentHistoryQuery($assetId: String!) {
|
|
470
|
+
tickerExternalAgentHistories(
|
|
471
|
+
filter: { assetId: { equalTo: $assetId } }
|
|
472
|
+
orderBy: [${typesV2_1.TickerExternalAgentHistoriesOrderBy.CreatedBlockIdAsc}]
|
|
473
|
+
) {
|
|
474
|
+
nodes {
|
|
475
|
+
identityId
|
|
476
|
+
assetId
|
|
477
|
+
eventIdx
|
|
478
|
+
createdBlock {
|
|
479
|
+
blockId
|
|
480
|
+
hash
|
|
481
|
+
datetime
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
`;
|
|
487
|
+
return {
|
|
488
|
+
query,
|
|
489
|
+
variables,
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
exports.tickerExternalAgentHistoryQuery = tickerExternalAgentHistoryQuery;
|
|
493
|
+
/**
|
|
494
|
+
* @hidden
|
|
495
|
+
*
|
|
496
|
+
* 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
|
|
497
|
+
*/
|
|
498
|
+
function tickerExternalAgentActionsQuery(filters, size, start) {
|
|
499
|
+
const { args, filter } = createArgsAndFilters(filters, { eventId: 'EventIdEnum' });
|
|
500
|
+
const query = (0, graphql_tag_1.default) `
|
|
501
|
+
query TickerExternalAgentActionsQuery
|
|
502
|
+
${args}
|
|
503
|
+
{
|
|
504
|
+
tickerExternalAgentActions(
|
|
505
|
+
${filter}
|
|
506
|
+
first: $size
|
|
507
|
+
offset: $start
|
|
508
|
+
orderBy: [${typesV2_1.TickerExternalAgentActionsOrderBy.CreatedBlockIdDesc}]
|
|
509
|
+
) {
|
|
510
|
+
totalCount
|
|
511
|
+
nodes {
|
|
512
|
+
eventIdx
|
|
513
|
+
palletName
|
|
514
|
+
eventId
|
|
515
|
+
callerId
|
|
516
|
+
createdBlock {
|
|
517
|
+
blockId
|
|
518
|
+
datetime
|
|
519
|
+
hash
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
`;
|
|
525
|
+
return {
|
|
526
|
+
query,
|
|
527
|
+
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() }),
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
exports.tickerExternalAgentActionsQuery = tickerExternalAgentActionsQuery;
|
|
531
|
+
/**
|
|
532
|
+
* @hidden
|
|
533
|
+
*
|
|
534
|
+
* Get distribution details for a CAId
|
|
535
|
+
*/
|
|
536
|
+
function distributionQuery(variables) {
|
|
537
|
+
const query = (0, graphql_tag_1.default) `
|
|
538
|
+
query DistributionQuery($id: String!) {
|
|
539
|
+
distribution(id: $id) {
|
|
540
|
+
taxes
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
`;
|
|
544
|
+
return {
|
|
545
|
+
query,
|
|
546
|
+
variables,
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
exports.distributionQuery = distributionQuery;
|
|
550
|
+
/**
|
|
551
|
+
* @hidden
|
|
552
|
+
*
|
|
553
|
+
* Get history of claims for a distribution
|
|
554
|
+
*/
|
|
555
|
+
function distributionPaymentsQuery(filters, size, start) {
|
|
556
|
+
const query = (0, graphql_tag_1.default) `
|
|
557
|
+
query DistributionPaymentQuery($distributionId: String!, $size: Int, $start: Int) {
|
|
558
|
+
distributionPayments(
|
|
559
|
+
filter: { distributionId: { equalTo: $distributionId } }
|
|
560
|
+
first: $size
|
|
561
|
+
offset: $start
|
|
562
|
+
) {
|
|
563
|
+
totalCount
|
|
564
|
+
nodes {
|
|
565
|
+
eventId
|
|
566
|
+
targetId
|
|
567
|
+
datetime
|
|
568
|
+
amount
|
|
569
|
+
tax
|
|
570
|
+
createdBlock {
|
|
571
|
+
blockId
|
|
572
|
+
hash
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
`;
|
|
578
|
+
return {
|
|
579
|
+
query,
|
|
580
|
+
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() }),
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
exports.distributionPaymentsQuery = distributionPaymentsQuery;
|
|
584
|
+
/**
|
|
585
|
+
* @hidden
|
|
586
|
+
*
|
|
587
|
+
* Get asset held by a DID
|
|
588
|
+
*/
|
|
589
|
+
function assetHoldersQuery(filters, size, start, orderBy = typesV2_1.AssetHoldersOrderBy.CreatedBlockIdAsc) {
|
|
590
|
+
const query = (0, graphql_tag_1.default) `
|
|
591
|
+
query AssetHoldersQuery($identityId: String!, $size: Int, $start: Int) {
|
|
592
|
+
assetHolders(
|
|
593
|
+
filter: { identityId: { equalTo: $identityId } }
|
|
594
|
+
first: $size
|
|
595
|
+
offset: $start
|
|
596
|
+
orderBy: [${orderBy}]
|
|
597
|
+
) {
|
|
598
|
+
totalCount
|
|
599
|
+
nodes {
|
|
600
|
+
assetId
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
`;
|
|
605
|
+
return {
|
|
606
|
+
query,
|
|
607
|
+
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() }),
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
exports.assetHoldersQuery = assetHoldersQuery;
|
|
611
|
+
/**
|
|
612
|
+
* @hidden
|
|
613
|
+
*/
|
|
614
|
+
function createLegFilters({ identityId, portfolioId, ticker, address }) {
|
|
615
|
+
const args = ['$fromId: String!, $toId: String!'];
|
|
616
|
+
const fromIdFilters = ['fromId: { equalTo: $fromId }'];
|
|
617
|
+
const toIdFilters = ['toId: { equalTo: $toId }'];
|
|
618
|
+
const portfolioNumber = portfolioId ? portfolioId.toNumber() : 0;
|
|
619
|
+
const variables = {
|
|
620
|
+
fromId: `${identityId}/${portfolioNumber}`,
|
|
621
|
+
toId: `${identityId}/${portfolioNumber}`,
|
|
622
|
+
};
|
|
623
|
+
if (ticker) {
|
|
624
|
+
variables.assetId = ticker;
|
|
625
|
+
args.push('$assetId: String!');
|
|
626
|
+
const assetIdFilter = 'assetId: { equalTo: $assetId }';
|
|
627
|
+
toIdFilters.push(assetIdFilter);
|
|
628
|
+
fromIdFilters.push(assetIdFilter);
|
|
629
|
+
}
|
|
630
|
+
if (address) {
|
|
631
|
+
variables.addresses = [address];
|
|
632
|
+
args.push('$addresses: [String!]!');
|
|
633
|
+
const addressFilter = 'addresses: { in: $addresses }';
|
|
634
|
+
toIdFilters.push(addressFilter);
|
|
635
|
+
fromIdFilters.push(addressFilter);
|
|
636
|
+
}
|
|
637
|
+
return {
|
|
638
|
+
args: `(${args.join()})`,
|
|
639
|
+
filter: `filter: { or: [{ ${fromIdFilters.join()} }, { ${toIdFilters.join()} } ] }`,
|
|
640
|
+
variables,
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* @hidden
|
|
645
|
+
*
|
|
646
|
+
* Get Settlements where a Portfolio is involved
|
|
647
|
+
*/
|
|
648
|
+
function settlementsQuery(filters) {
|
|
649
|
+
const { args, filter, variables } = createLegFilters(filters);
|
|
650
|
+
const query = (0, graphql_tag_1.default) `
|
|
651
|
+
query SettlementsQuery
|
|
652
|
+
${args}
|
|
653
|
+
{
|
|
654
|
+
legs(
|
|
655
|
+
${filter}
|
|
656
|
+
orderBy: [${typesV2_1.LegsOrderBy.InstructionIdAsc}]
|
|
657
|
+
) {
|
|
658
|
+
nodes {
|
|
659
|
+
settlement {
|
|
660
|
+
id
|
|
661
|
+
createdBlock {
|
|
662
|
+
blockId
|
|
663
|
+
datetime
|
|
664
|
+
hash
|
|
665
|
+
}
|
|
666
|
+
result
|
|
667
|
+
legs {
|
|
668
|
+
nodes {
|
|
669
|
+
fromId
|
|
670
|
+
from {
|
|
671
|
+
identityId
|
|
672
|
+
number
|
|
673
|
+
}
|
|
674
|
+
toId
|
|
675
|
+
to {
|
|
676
|
+
identityId
|
|
677
|
+
number
|
|
678
|
+
}
|
|
679
|
+
assetId
|
|
680
|
+
amount
|
|
681
|
+
addresses
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
`;
|
|
689
|
+
return {
|
|
690
|
+
query,
|
|
691
|
+
variables,
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
exports.settlementsQuery = settlementsQuery;
|
|
695
|
+
/**
|
|
696
|
+
* @hidden
|
|
697
|
+
*/
|
|
698
|
+
function createPortfolioMovementFilters({ identityId, portfolioId, ticker, address, }) {
|
|
699
|
+
const args = ['$fromId: String!, $toId: String!'];
|
|
700
|
+
const fromIdFilters = ['fromId: { equalTo: $fromId }'];
|
|
701
|
+
const toIdFilters = ['toId: { equalTo: $toId }'];
|
|
702
|
+
const portfolioNumber = portfolioId ? portfolioId.toNumber() : 0;
|
|
703
|
+
const variables = {
|
|
704
|
+
fromId: `${identityId}/${portfolioNumber}`,
|
|
705
|
+
toId: `${identityId}/${portfolioNumber}`,
|
|
706
|
+
};
|
|
707
|
+
if (ticker) {
|
|
708
|
+
variables.assetId = ticker;
|
|
709
|
+
args.push('$assetId: String!');
|
|
710
|
+
const assetIdFilter = 'assetId: { equalTo: $assetId }';
|
|
711
|
+
toIdFilters.push(assetIdFilter);
|
|
712
|
+
fromIdFilters.push(assetIdFilter);
|
|
713
|
+
}
|
|
714
|
+
if (address) {
|
|
715
|
+
variables.address = address;
|
|
716
|
+
args.push('$address: String!');
|
|
717
|
+
const addressFilter = 'address: { in: $address }';
|
|
718
|
+
toIdFilters.push(addressFilter);
|
|
719
|
+
fromIdFilters.push(addressFilter);
|
|
720
|
+
}
|
|
721
|
+
return {
|
|
722
|
+
args: `(${args.join()})`,
|
|
723
|
+
filter: `filter: { or: [ { ${fromIdFilters.join()} }, { ${toIdFilters.join()} } ] }`,
|
|
724
|
+
variables,
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* @hidden
|
|
729
|
+
*
|
|
730
|
+
* Get Settlements where a Portfolio is involved
|
|
731
|
+
*/
|
|
732
|
+
function portfolioMovementsQuery(filters) {
|
|
733
|
+
const { args, filter, variables } = createPortfolioMovementFilters(filters);
|
|
734
|
+
const query = (0, graphql_tag_1.default) `
|
|
735
|
+
query PortfolioMovementsQuery
|
|
736
|
+
${args}
|
|
737
|
+
{
|
|
738
|
+
portfolioMovements(
|
|
739
|
+
${filter}
|
|
740
|
+
orderBy: [${typesV2_1.PortfolioMovementsOrderBy.IdAsc}]
|
|
741
|
+
) {
|
|
742
|
+
nodes {
|
|
743
|
+
id
|
|
744
|
+
fromId
|
|
745
|
+
from {
|
|
746
|
+
identityId
|
|
747
|
+
number
|
|
748
|
+
}
|
|
749
|
+
toId
|
|
750
|
+
to {
|
|
751
|
+
identityId
|
|
752
|
+
number
|
|
753
|
+
}
|
|
754
|
+
assetId
|
|
755
|
+
amount
|
|
756
|
+
address
|
|
757
|
+
createdBlock {
|
|
758
|
+
blockId
|
|
759
|
+
datetime
|
|
760
|
+
hash
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
`;
|
|
766
|
+
return {
|
|
767
|
+
query,
|
|
768
|
+
variables,
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
exports.portfolioMovementsQuery = portfolioMovementsQuery;
|
|
772
|
+
//# sourceMappingURL=queriesV2.js.map
|