@canton-network/core-amulet-service 1.8.0 → 1.9.0
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/dist/amulet-service-scan-proxy.d.ts.map +1 -1
- package/dist/amulet-service-scan.d.ts.map +1 -1
- package/dist/amulet-service.d.ts.map +1 -1
- package/dist/index.cjs +321 -349
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +298 -344
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
package/dist/index.cjs
CHANGED
|
@@ -1,362 +1,334 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var Decimal = require('decimal.js');
|
|
5
|
-
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var Decimal__default = /*#__PURE__*/_interopDefault(Decimal);
|
|
9
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
10
4
|
var __defProp = Object.defineProperty;
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let _canton_network_core_splice_client = require("@canton-network/core-splice-client");
|
|
25
|
+
let decimal_js = require("decimal.js");
|
|
26
|
+
decimal_js = __toESM(decimal_js, 1);
|
|
27
|
+
//#region src/amulet-service-base.ts
|
|
28
|
+
const REQUESTED_AT_SKEW_MS = 6e4;
|
|
14
29
|
var AmuletServiceBase = class {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
transfer: {
|
|
165
|
-
sender: instrumentAdmin,
|
|
166
|
-
receiver,
|
|
167
|
-
amount,
|
|
168
|
-
instrumentId: { admin: instrumentAdmin, id: instrumentId },
|
|
169
|
-
lock: null,
|
|
170
|
-
requestedAt: new Date(
|
|
171
|
-
Date.now() - REQUESTED_AT_SKEW_MS
|
|
172
|
-
).toISOString(),
|
|
173
|
-
executeBefore: tomorrow.toISOString(),
|
|
174
|
-
inputHoldingCids: [],
|
|
175
|
-
meta: { values: {} }
|
|
176
|
-
},
|
|
177
|
-
extraArgs: {
|
|
178
|
-
context: { values: {} },
|
|
179
|
-
meta: { values: {} }
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
const disclosedContracts = (await this.tokenStandard.transfer.fetchTransferFactoryChoiceContext(
|
|
183
|
-
registryUrl,
|
|
184
|
-
choiceArgs
|
|
185
|
-
)).choiceContext.disclosedContracts;
|
|
186
|
-
const amuletRules = await this.getAmuletRules();
|
|
187
|
-
if (!amuletRules) {
|
|
188
|
-
throw new Error("AmuletRules contract not found");
|
|
189
|
-
}
|
|
190
|
-
const latestOpenMiningRound = await this.getActiveOpenMiningRound();
|
|
191
|
-
if (!latestOpenMiningRound) {
|
|
192
|
-
throw new Error(
|
|
193
|
-
"OpenMiningRound active at current moment not found"
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
return [
|
|
197
|
-
{
|
|
198
|
-
templateId: amuletRules.template_id,
|
|
199
|
-
contractId: amuletRules.contract_id,
|
|
200
|
-
choice: "AmuletRules_DevNet_Tap",
|
|
201
|
-
choiceArgument: {
|
|
202
|
-
receiver,
|
|
203
|
-
amount,
|
|
204
|
-
openRound: latestOpenMiningRound.contract_id
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
disclosedContracts
|
|
208
|
-
];
|
|
209
|
-
}
|
|
30
|
+
constructor(tokenStandard) {
|
|
31
|
+
this.tokenStandard = tokenStandard;
|
|
32
|
+
}
|
|
33
|
+
async buyMemberTraffic(dso, provider, trafficAmount, synchronizerId, memberId, migrationId, inputUtxos) {
|
|
34
|
+
const amuletRules = await this.getAmuletRules();
|
|
35
|
+
const activeRound = await this.getActiveOpenMiningRound();
|
|
36
|
+
const inputHoldings = await this.tokenStandard.getInputHoldingsCids(provider, inputUtxos, new decimal_js.default(trafficAmount));
|
|
37
|
+
if (!amuletRules) throw new Error("AmuletRules contract not found");
|
|
38
|
+
if (!activeRound) throw new Error("OpenMiningRound active at current moment not found");
|
|
39
|
+
const disclosed = [{
|
|
40
|
+
templateId: amuletRules.template_id,
|
|
41
|
+
contractId: amuletRules.contract_id,
|
|
42
|
+
createdEventBlob: amuletRules.created_event_blob,
|
|
43
|
+
synchronizerId
|
|
44
|
+
}, {
|
|
45
|
+
templateId: activeRound.template_id,
|
|
46
|
+
contractId: activeRound.contract_id,
|
|
47
|
+
createdEventBlob: activeRound.created_event_blob,
|
|
48
|
+
synchronizerId
|
|
49
|
+
}];
|
|
50
|
+
const choiceArgs = {
|
|
51
|
+
context: {
|
|
52
|
+
openMiningRound: activeRound.contract_id,
|
|
53
|
+
issuingMiningRounds: [],
|
|
54
|
+
validatorRights: [],
|
|
55
|
+
featuredAppRight: null
|
|
56
|
+
},
|
|
57
|
+
inputs: inputHoldings.map((cid) => ({
|
|
58
|
+
tag: "InputAmulet",
|
|
59
|
+
value: cid
|
|
60
|
+
})),
|
|
61
|
+
provider,
|
|
62
|
+
memberId: this.tokenStandard.core.toQualifiedMemberId(memberId),
|
|
63
|
+
synchronizerId,
|
|
64
|
+
migrationId: migrationId.toString(),
|
|
65
|
+
trafficAmount: trafficAmount.toString(),
|
|
66
|
+
expectedDso: dso
|
|
67
|
+
};
|
|
68
|
+
return [{
|
|
69
|
+
templateId: "#splice-amulet:Splice.AmuletRules:AmuletRules",
|
|
70
|
+
contractId: amuletRules.contract_id,
|
|
71
|
+
choice: "AmuletRules_BuyMemberTraffic",
|
|
72
|
+
choiceArgument: choiceArgs
|
|
73
|
+
}, disclosed];
|
|
74
|
+
}
|
|
75
|
+
async selfGrantFeatureAppRight(providerPartyId, synchronizerId) {
|
|
76
|
+
const amuletRules = await this.getAmuletRules();
|
|
77
|
+
const disclosedContracts = {
|
|
78
|
+
templateId: amuletRules.template_id,
|
|
79
|
+
contractId: amuletRules.contract_id,
|
|
80
|
+
createdEventBlob: amuletRules.created_event_blob,
|
|
81
|
+
synchronizerId
|
|
82
|
+
};
|
|
83
|
+
return [{
|
|
84
|
+
templateId: amuletRules.template_id,
|
|
85
|
+
contractId: amuletRules.contract_id,
|
|
86
|
+
choice: "AmuletRules_DevNet_FeatureApp",
|
|
87
|
+
choiceArgument: { provider: providerPartyId }
|
|
88
|
+
}, [disclosedContracts]];
|
|
89
|
+
}
|
|
90
|
+
async cancelTransferPreapproval(contractId, templateId, actor) {
|
|
91
|
+
return [{
|
|
92
|
+
templateId,
|
|
93
|
+
contractId,
|
|
94
|
+
choice: "TransferPreapproval_Cancel",
|
|
95
|
+
choiceArgument: { p: actor }
|
|
96
|
+
}, []];
|
|
97
|
+
}
|
|
98
|
+
async renewTransferPreapproval(contractId, templateId, provider, synchronizerId, newExpiresAt, inputUtxos) {
|
|
99
|
+
const amuletRules = await this.getAmuletRules();
|
|
100
|
+
const activeRound = await this.getActiveOpenMiningRound();
|
|
101
|
+
if (!amuletRules) throw new Error("AmuletRules contract not found");
|
|
102
|
+
if (!activeRound) throw new Error("OpenMiningRound active at current moment not found");
|
|
103
|
+
const disclosed = [{
|
|
104
|
+
templateId: amuletRules.template_id,
|
|
105
|
+
contractId: amuletRules.contract_id,
|
|
106
|
+
createdEventBlob: amuletRules.created_event_blob,
|
|
107
|
+
synchronizerId
|
|
108
|
+
}, {
|
|
109
|
+
templateId: activeRound.template_id,
|
|
110
|
+
contractId: activeRound.contract_id,
|
|
111
|
+
createdEventBlob: activeRound.created_event_blob,
|
|
112
|
+
synchronizerId
|
|
113
|
+
}];
|
|
114
|
+
const inputHoldings = await this.tokenStandard.getInputHoldingsCids(provider, inputUtxos);
|
|
115
|
+
const context = {
|
|
116
|
+
context: {
|
|
117
|
+
openMiningRound: activeRound.contract_id,
|
|
118
|
+
issuingMiningRounds: [],
|
|
119
|
+
validatorRights: [],
|
|
120
|
+
featuredAppRight: null
|
|
121
|
+
},
|
|
122
|
+
amuletRules: amuletRules.contract_id
|
|
123
|
+
};
|
|
124
|
+
const effectiveNewExpiresAt = newExpiresAt ?? new Date(Date.now() + 7776e6);
|
|
125
|
+
return [{
|
|
126
|
+
templateId,
|
|
127
|
+
contractId,
|
|
128
|
+
choice: "TransferPreapproval_Renew",
|
|
129
|
+
choiceArgument: {
|
|
130
|
+
context,
|
|
131
|
+
inputs: inputHoldings.map((cid) => ({
|
|
132
|
+
tag: "InputAmulet",
|
|
133
|
+
value: cid
|
|
134
|
+
})),
|
|
135
|
+
newExpiresAt: effectiveNewExpiresAt.toISOString()
|
|
136
|
+
}
|
|
137
|
+
}, disclosed];
|
|
138
|
+
}
|
|
139
|
+
async createTap(receiver, amount, instrumentAdmin, instrumentId, registryUrl) {
|
|
140
|
+
const tomorrow = /* @__PURE__ */ new Date(/* @__PURE__ */ new Date());
|
|
141
|
+
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
142
|
+
const choiceArgs = {
|
|
143
|
+
expectedAdmin: instrumentAdmin,
|
|
144
|
+
transfer: {
|
|
145
|
+
sender: instrumentAdmin,
|
|
146
|
+
receiver,
|
|
147
|
+
amount,
|
|
148
|
+
instrumentId: {
|
|
149
|
+
admin: instrumentAdmin,
|
|
150
|
+
id: instrumentId
|
|
151
|
+
},
|
|
152
|
+
lock: null,
|
|
153
|
+
requestedAt: (/* @__PURE__ */ new Date(Date.now() - REQUESTED_AT_SKEW_MS)).toISOString(),
|
|
154
|
+
executeBefore: tomorrow.toISOString(),
|
|
155
|
+
inputHoldingCids: [],
|
|
156
|
+
meta: { values: {} }
|
|
157
|
+
},
|
|
158
|
+
extraArgs: {
|
|
159
|
+
context: { values: {} },
|
|
160
|
+
meta: { values: {} }
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const disclosedContracts = (await this.tokenStandard.transfer.fetchTransferFactoryChoiceContext(registryUrl, choiceArgs)).choiceContext.disclosedContracts;
|
|
164
|
+
const amuletRules = await this.getAmuletRules();
|
|
165
|
+
if (!amuletRules) throw new Error("AmuletRules contract not found");
|
|
166
|
+
const latestOpenMiningRound = await this.getActiveOpenMiningRound();
|
|
167
|
+
if (!latestOpenMiningRound) throw new Error("OpenMiningRound active at current moment not found");
|
|
168
|
+
return [{
|
|
169
|
+
templateId: amuletRules.template_id,
|
|
170
|
+
contractId: amuletRules.contract_id,
|
|
171
|
+
choice: "AmuletRules_DevNet_Tap",
|
|
172
|
+
choiceArgument: {
|
|
173
|
+
receiver,
|
|
174
|
+
amount,
|
|
175
|
+
openRound: latestOpenMiningRound.contract_id
|
|
176
|
+
}
|
|
177
|
+
}, disclosedContracts];
|
|
178
|
+
}
|
|
210
179
|
};
|
|
211
|
-
|
|
212
|
-
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/amulet-service-scan.ts
|
|
213
182
|
var AmuletServiceScanOnly = class extends AmuletServiceBase {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const { featured_app_right } = await this.scanClient.get(
|
|
245
|
-
"/v0/featured-apps/{provider_party_id}",
|
|
246
|
-
{
|
|
247
|
-
path: {
|
|
248
|
-
provider_party_id: partyId
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
);
|
|
252
|
-
return featured_app_right;
|
|
253
|
-
}
|
|
254
|
-
async getMemberTrafficStatus(domainId, memberId) {
|
|
255
|
-
return this.scanClient.get(
|
|
256
|
-
"/v0/domains/{domain_id}/members/{member_id}/traffic-status",
|
|
257
|
-
{
|
|
258
|
-
path: {
|
|
259
|
-
domain_id: domainId,
|
|
260
|
-
member_id: this.tokenStandard.core.toQualifiedMemberId(memberId)
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
);
|
|
264
|
-
}
|
|
183
|
+
constructor(tokenStandard, scanClient) {
|
|
184
|
+
super(tokenStandard);
|
|
185
|
+
this.tokenStandard = tokenStandard;
|
|
186
|
+
this.scanClient = scanClient;
|
|
187
|
+
}
|
|
188
|
+
async getAmuletRules() {
|
|
189
|
+
const amuletRules = await this.scanClient.getAmuletRules();
|
|
190
|
+
if (!amuletRules) throw new Error("AmuletRules contract not found");
|
|
191
|
+
return amuletRules;
|
|
192
|
+
}
|
|
193
|
+
async getActiveOpenMiningRound() {
|
|
194
|
+
return await this.scanClient.getActiveOpenMiningRound();
|
|
195
|
+
}
|
|
196
|
+
async isDevNet() {
|
|
197
|
+
return await this.scanClient.isDevNet();
|
|
198
|
+
}
|
|
199
|
+
async getTransferPreApprovalByParty(partyId) {
|
|
200
|
+
const { transfer_preapproval } = await this.scanClient.get("/v0/transfer-preapprovals/by-party/{party}", { path: { party: partyId } });
|
|
201
|
+
return transfer_preapproval;
|
|
202
|
+
}
|
|
203
|
+
async getFeaturedAppsByParty(partyId) {
|
|
204
|
+
const { featured_app_right } = await this.scanClient.get("/v0/featured-apps/{provider_party_id}", { path: { provider_party_id: partyId } });
|
|
205
|
+
return featured_app_right;
|
|
206
|
+
}
|
|
207
|
+
async getMemberTrafficStatus(domainId, memberId) {
|
|
208
|
+
return this.scanClient.get("/v0/domains/{domain_id}/members/{member_id}/traffic-status", { path: {
|
|
209
|
+
domain_id: domainId,
|
|
210
|
+
member_id: this.tokenStandard.core.toQualifiedMemberId(memberId)
|
|
211
|
+
} });
|
|
212
|
+
}
|
|
265
213
|
};
|
|
266
|
-
|
|
267
|
-
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/amulet-service-scan-proxy.ts
|
|
216
|
+
/** AmuletService extends TokenStandardService to provide features that are
|
|
217
|
+
* available for amulet but not in the token standard, such as:
|
|
218
|
+
*
|
|
219
|
+
* - Tapping
|
|
220
|
+
* - Transfer preapprovals
|
|
221
|
+
* - Featured apps
|
|
222
|
+
*/
|
|
268
223
|
var AmuletServiceScanProxy = class extends AmuletServiceBase {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
path: {
|
|
300
|
-
provider_party_id: partyId
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
);
|
|
304
|
-
return featured_app_right;
|
|
305
|
-
}
|
|
306
|
-
async getMemberTrafficStatus(domainId, memberId) {
|
|
307
|
-
if (!this.scanClient) {
|
|
308
|
-
throw new Error("Scan API URL was not provided");
|
|
309
|
-
}
|
|
310
|
-
return this.scanClient.get(
|
|
311
|
-
"/v0/domains/{domain_id}/members/{member_id}/traffic-status",
|
|
312
|
-
{
|
|
313
|
-
path: {
|
|
314
|
-
domain_id: domainId,
|
|
315
|
-
member_id: this.tokenStandard.core.toQualifiedMemberId(memberId)
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
);
|
|
319
|
-
}
|
|
224
|
+
constructor(tokenStandard, scanProxyClient, scanClient) {
|
|
225
|
+
super(tokenStandard);
|
|
226
|
+
this.tokenStandard = tokenStandard;
|
|
227
|
+
this.scanProxyClient = scanProxyClient;
|
|
228
|
+
this.scanClient = scanClient;
|
|
229
|
+
}
|
|
230
|
+
getAmuletRules() {
|
|
231
|
+
return this.scanProxyClient.getAmuletRules();
|
|
232
|
+
}
|
|
233
|
+
getActiveOpenMiningRound() {
|
|
234
|
+
return this.scanProxyClient.getActiveOpenMiningRound();
|
|
235
|
+
}
|
|
236
|
+
async isDevNet() {
|
|
237
|
+
return await this.scanProxyClient.isDevNet();
|
|
238
|
+
}
|
|
239
|
+
async getTransferPreApprovalByParty(partyId) {
|
|
240
|
+
const { transfer_preapproval } = await this.scanProxyClient.get("/v0/scan-proxy/transfer-preapprovals/by-party/{party}", { path: { party: partyId } });
|
|
241
|
+
return transfer_preapproval;
|
|
242
|
+
}
|
|
243
|
+
async getFeaturedAppsByParty(partyId) {
|
|
244
|
+
const { featured_app_right } = await this.scanProxyClient.get("/v0/scan-proxy/featured-apps/{provider_party_id}", { path: { provider_party_id: partyId } });
|
|
245
|
+
return featured_app_right;
|
|
246
|
+
}
|
|
247
|
+
async getMemberTrafficStatus(domainId, memberId) {
|
|
248
|
+
if (!this.scanClient) throw new Error("Scan API URL was not provided");
|
|
249
|
+
return this.scanClient.get("/v0/domains/{domain_id}/members/{member_id}/traffic-status", { path: {
|
|
250
|
+
domain_id: domainId,
|
|
251
|
+
member_id: this.tokenStandard.core.toQualifiedMemberId(memberId)
|
|
252
|
+
} });
|
|
253
|
+
}
|
|
320
254
|
};
|
|
321
|
-
|
|
322
|
-
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/typeof.js
|
|
257
|
+
function _typeof(o) {
|
|
258
|
+
"@babel/helpers - typeof";
|
|
259
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
260
|
+
return typeof o;
|
|
261
|
+
} : function(o) {
|
|
262
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
263
|
+
}, _typeof(o);
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPrimitive.js
|
|
267
|
+
function toPrimitive(t, r) {
|
|
268
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
269
|
+
var e = t[Symbol.toPrimitive];
|
|
270
|
+
if (void 0 !== e) {
|
|
271
|
+
var i = e.call(t, r || "default");
|
|
272
|
+
if ("object" != _typeof(i)) return i;
|
|
273
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
274
|
+
}
|
|
275
|
+
return ("string" === r ? String : Number)(t);
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPropertyKey.js
|
|
279
|
+
function toPropertyKey(t) {
|
|
280
|
+
var i = toPrimitive(t, "string");
|
|
281
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/defineProperty.js
|
|
285
|
+
function _defineProperty(e, r, t) {
|
|
286
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
287
|
+
value: t,
|
|
288
|
+
enumerable: !0,
|
|
289
|
+
configurable: !0,
|
|
290
|
+
writable: !0
|
|
291
|
+
}) : e[r] = t, e;
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/amulet-service.ts
|
|
323
295
|
var AmuletService = class {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
296
|
+
constructor(tokenStandard, arg1, arg2) {
|
|
297
|
+
_defineProperty(this, "serviceImpl", void 0);
|
|
298
|
+
this.serviceImpl = isScanClient(arg1) ? new AmuletServiceScanOnly(tokenStandard, arg1) : new AmuletServiceScanProxy(tokenStandard, arg1, arg2);
|
|
299
|
+
}
|
|
300
|
+
async buyMemberTraffic(...args) {
|
|
301
|
+
return this.serviceImpl.buyMemberTraffic(...args);
|
|
302
|
+
}
|
|
303
|
+
async createTap(...args) {
|
|
304
|
+
return this.serviceImpl.createTap(...args);
|
|
305
|
+
}
|
|
306
|
+
async cancelTransferPreapproval(...args) {
|
|
307
|
+
return this.serviceImpl.cancelTransferPreapproval(...args);
|
|
308
|
+
}
|
|
309
|
+
async renewTransferPreapproval(...args) {
|
|
310
|
+
return this.serviceImpl.renewTransferPreapproval(...args);
|
|
311
|
+
}
|
|
312
|
+
async getFeaturedAppsByParty(...args) {
|
|
313
|
+
return this.serviceImpl.getFeaturedAppsByParty(...args);
|
|
314
|
+
}
|
|
315
|
+
async getTransferPreApprovalByParty(...args) {
|
|
316
|
+
return this.serviceImpl.getTransferPreApprovalByParty(...args);
|
|
317
|
+
}
|
|
318
|
+
async selfGrantFeatureAppRight(...args) {
|
|
319
|
+
return this.serviceImpl.selfGrantFeatureAppRight(...args);
|
|
320
|
+
}
|
|
321
|
+
async isDevNet(...args) {
|
|
322
|
+
return this.serviceImpl.isDevNet(...args);
|
|
323
|
+
}
|
|
324
|
+
async getMemberTrafficStatus(...args) {
|
|
325
|
+
return this.serviceImpl.getMemberTrafficStatus(...args);
|
|
326
|
+
}
|
|
355
327
|
};
|
|
356
328
|
function isScanClient(x) {
|
|
357
|
-
|
|
329
|
+
return x instanceof _canton_network_core_splice_client.ScanClient;
|
|
358
330
|
}
|
|
359
|
-
|
|
331
|
+
//#endregion
|
|
360
332
|
exports.AmuletService = AmuletService;
|
|
361
|
-
|
|
333
|
+
|
|
362
334
|
//# sourceMappingURL=index.cjs.map
|