@coasys/ad4m 0.12.0 → 0.13.0-test-1
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/lib/index.cjs +328 -6
- package/lib/index.js +328 -6
- package/lib/src/agent/AgentClient.d.ts +3 -0
- package/lib/src/agent/AgentClient.js +28 -2
- package/lib/src/runtime/RuntimeClient.d.ts +28 -0
- package/lib/src/runtime/RuntimeClient.js +143 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +17 -1
- package/lib/src/runtime/RuntimeResolver.js +141 -4
- package/lib/src/schema.gql +16 -0
- package/lib/src/typeDefs.js +16 -0
- package/package.json +1 -1
- package/src/agent/AgentClient.ts +30 -0
- package/src/runtime/RuntimeClient.ts +159 -0
- package/src/runtime/RuntimeResolver.ts +92 -3
|
@@ -74,6 +74,14 @@ export class RuntimeClient {
|
|
|
74
74
|
}));
|
|
75
75
|
return runtimeInfo;
|
|
76
76
|
}
|
|
77
|
+
async tlsDomain() {
|
|
78
|
+
const { runtimeTlsDomain } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
79
|
+
query: gql `query runtimeTlsDomain {
|
|
80
|
+
runtimeTlsDomain
|
|
81
|
+
}`,
|
|
82
|
+
}));
|
|
83
|
+
return runtimeTlsDomain;
|
|
84
|
+
}
|
|
77
85
|
async quit() {
|
|
78
86
|
const result = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
79
87
|
mutation: gql `mutation runtimeQuit { runtimeQuit }`
|
|
@@ -368,6 +376,23 @@ export class RuntimeClient {
|
|
|
368
376
|
}));
|
|
369
377
|
return runtimeSetMultiUserEnabled;
|
|
370
378
|
}
|
|
379
|
+
async freeHostingEnabled() {
|
|
380
|
+
const { runtimeFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
381
|
+
query: gql `query runtimeFreeHostingEnabled {
|
|
382
|
+
runtimeFreeHostingEnabled
|
|
383
|
+
}`
|
|
384
|
+
}));
|
|
385
|
+
return runtimeFreeHostingEnabled;
|
|
386
|
+
}
|
|
387
|
+
async setFreeHostingEnabled(enabled) {
|
|
388
|
+
const { runtimeSetFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
389
|
+
mutation: gql `mutation runtimeSetFreeHostingEnabled($enabled: Boolean!) {
|
|
390
|
+
runtimeSetFreeHostingEnabled(enabled: $enabled)
|
|
391
|
+
}`,
|
|
392
|
+
variables: { enabled }
|
|
393
|
+
}));
|
|
394
|
+
return runtimeSetFreeHostingEnabled;
|
|
395
|
+
}
|
|
371
396
|
async listUsers() {
|
|
372
397
|
const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
373
398
|
query: gql `query runtimeListUsers {
|
|
@@ -376,11 +401,23 @@ export class RuntimeClient {
|
|
|
376
401
|
did
|
|
377
402
|
lastSeen
|
|
378
403
|
perspectiveCount
|
|
404
|
+
remainingCredits
|
|
405
|
+
freeAccess
|
|
406
|
+
hotWalletAddress
|
|
379
407
|
}
|
|
380
408
|
}`
|
|
381
409
|
}));
|
|
382
410
|
return runtimeListUsers;
|
|
383
411
|
}
|
|
412
|
+
async userWalletAddress(email) {
|
|
413
|
+
const { runtimeUserWalletAddress } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
414
|
+
query: gql `query runtimeUserWalletAddress($email: String!) {
|
|
415
|
+
runtimeUserWalletAddress(email: $email)
|
|
416
|
+
}`,
|
|
417
|
+
variables: { email }
|
|
418
|
+
}));
|
|
419
|
+
return runtimeUserWalletAddress;
|
|
420
|
+
}
|
|
384
421
|
async emailTestModeEnable() {
|
|
385
422
|
const { runtimeEmailTestModeEnable } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
386
423
|
mutation: gql `mutation runtimeEmailTestModeEnable {
|
|
@@ -423,6 +460,112 @@ export class RuntimeClient {
|
|
|
423
460
|
}));
|
|
424
461
|
return runtimeEmailTestSetExpiry;
|
|
425
462
|
}
|
|
463
|
+
// ---- Unyt / mHOT methods ----
|
|
464
|
+
async unytAgentKey() {
|
|
465
|
+
const { runtimeUnytAgentKey } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
466
|
+
query: gql `query runtimeUnytAgentKey { runtimeUnytAgentKey }`,
|
|
467
|
+
fetchPolicy: "network-only",
|
|
468
|
+
}));
|
|
469
|
+
return runtimeUnytAgentKey;
|
|
470
|
+
}
|
|
471
|
+
async unytHotAgentPubkey() {
|
|
472
|
+
const { runtimeHotAgentPubkey } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
473
|
+
query: gql `query runtimeHotAgentPubkey { runtimeHotAgentPubkey }`,
|
|
474
|
+
fetchPolicy: "network-only",
|
|
475
|
+
}));
|
|
476
|
+
return runtimeHotAgentPubkey;
|
|
477
|
+
}
|
|
478
|
+
async unytWalletBalance() {
|
|
479
|
+
const { runtimeHotWalletBalance } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
480
|
+
query: gql `query runtimeHotWalletBalance { runtimeHotWalletBalance }`,
|
|
481
|
+
fetchPolicy: "network-only",
|
|
482
|
+
}));
|
|
483
|
+
return runtimeHotWalletBalance;
|
|
484
|
+
}
|
|
485
|
+
async unytWalletHistory(page, perPage) {
|
|
486
|
+
const { runtimeHotWalletHistory } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
487
|
+
query: gql `query runtimeHotWalletHistory($page: Int, $perPage: Int) {
|
|
488
|
+
runtimeHotWalletHistory(page: $page, perPage: $perPage)
|
|
489
|
+
}`,
|
|
490
|
+
variables: { page, perPage },
|
|
491
|
+
fetchPolicy: "network-only",
|
|
492
|
+
}));
|
|
493
|
+
return runtimeHotWalletHistory;
|
|
494
|
+
}
|
|
495
|
+
async unytVersionInfo() {
|
|
496
|
+
const { runtimeUnytVersionInfo } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
497
|
+
query: gql `query runtimeUnytVersionInfo { runtimeUnytVersionInfo }`,
|
|
498
|
+
fetchPolicy: "network-only",
|
|
499
|
+
}));
|
|
500
|
+
return runtimeUnytVersionInfo;
|
|
501
|
+
}
|
|
502
|
+
async unytSetMembraneProof(proof) {
|
|
503
|
+
const { runtimeSetUnytMembraneProof } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
504
|
+
mutation: gql `mutation runtimeSetUnytMembraneProof($proof: String!) {
|
|
505
|
+
runtimeSetUnytMembraneProof(proof: $proof) { success message }
|
|
506
|
+
}`,
|
|
507
|
+
variables: { proof },
|
|
508
|
+
}));
|
|
509
|
+
return runtimeSetUnytMembraneProof;
|
|
510
|
+
}
|
|
511
|
+
async unytReinstallDna() {
|
|
512
|
+
const { runtimeReinstallUnytDna } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
513
|
+
mutation: gql `mutation runtimeReinstallUnytDna {
|
|
514
|
+
runtimeReinstallUnytDna { success message }
|
|
515
|
+
}`,
|
|
516
|
+
}));
|
|
517
|
+
return runtimeReinstallUnytDna;
|
|
518
|
+
}
|
|
519
|
+
async unytSendHot(recipient, amount) {
|
|
520
|
+
const { runtimeSendHot } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
521
|
+
mutation: gql `mutation runtimeSendHot($recipient: String!, $amount: String!) {
|
|
522
|
+
runtimeSendHot(recipient: $recipient, amount: $amount) { success message }
|
|
523
|
+
}`,
|
|
524
|
+
variables: { recipient, amount },
|
|
525
|
+
}));
|
|
526
|
+
return runtimeSendHot;
|
|
527
|
+
}
|
|
528
|
+
async setUserCredits(email, amount) {
|
|
529
|
+
const { runtimeSetUserCredits } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
530
|
+
mutation: gql `mutation runtimeSetUserCredits($email: String!, $amount: Float!) {
|
|
531
|
+
runtimeSetUserCredits(email: $email, amount: $amount)
|
|
532
|
+
}`,
|
|
533
|
+
variables: { email, amount },
|
|
534
|
+
}));
|
|
535
|
+
return runtimeSetUserCredits;
|
|
536
|
+
}
|
|
537
|
+
async setUserFreeAccess(email, enabled) {
|
|
538
|
+
const { runtimeSetUserFreeAccess } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
539
|
+
mutation: gql `mutation runtimeSetUserFreeAccess($email: String!, $enabled: Boolean!) {
|
|
540
|
+
runtimeSetUserFreeAccess(email: $email, enabled: $enabled)
|
|
541
|
+
}`,
|
|
542
|
+
variables: { email, enabled },
|
|
543
|
+
}));
|
|
544
|
+
return runtimeSetUserFreeAccess;
|
|
545
|
+
}
|
|
546
|
+
async setHostRates(ratesJson) {
|
|
547
|
+
const { runtimeSetHostRates } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
548
|
+
mutation: gql `mutation runtimeSetHostRates($ratesJson: String!) {
|
|
549
|
+
runtimeSetHostRates(ratesJson: $ratesJson)
|
|
550
|
+
}`,
|
|
551
|
+
variables: { ratesJson },
|
|
552
|
+
}));
|
|
553
|
+
return runtimeSetHostRates;
|
|
554
|
+
}
|
|
555
|
+
async getHostRates() {
|
|
556
|
+
const { runtimeHostRates } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
557
|
+
query: gql `query runtimeHostRates {
|
|
558
|
+
runtimeHostRates
|
|
559
|
+
}`,
|
|
560
|
+
fetchPolicy: 'network-only',
|
|
561
|
+
}));
|
|
562
|
+
try {
|
|
563
|
+
return JSON.parse(runtimeHostRates);
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
return [];
|
|
567
|
+
}
|
|
568
|
+
}
|
|
426
569
|
addNotificationTriggeredCallback(cb) {
|
|
427
570
|
__classPrivateFieldGet(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
|
|
428
571
|
}
|
|
@@ -68,6 +68,9 @@ export declare class UserStatistics {
|
|
|
68
68
|
did: string;
|
|
69
69
|
lastSeen?: string;
|
|
70
70
|
perspectiveCount: number;
|
|
71
|
+
remainingCredits: string;
|
|
72
|
+
freeAccess: boolean;
|
|
73
|
+
hotWalletAddress?: string;
|
|
71
74
|
}
|
|
72
75
|
export declare class VerificationRequestResult {
|
|
73
76
|
success: boolean;
|
|
@@ -79,7 +82,8 @@ export declare class HostingUserInfo {
|
|
|
79
82
|
email: string;
|
|
80
83
|
remainingCredits: string;
|
|
81
84
|
hotWalletAddress?: string;
|
|
82
|
-
|
|
85
|
+
freeAccess: boolean;
|
|
86
|
+
constructor(email: string, remainingCredits: string, hotWalletAddress?: string, freeAccess?: boolean);
|
|
83
87
|
}
|
|
84
88
|
export declare class PaymentRequestResult {
|
|
85
89
|
success: boolean;
|
|
@@ -129,6 +133,8 @@ export default class RuntimeResolver {
|
|
|
129
133
|
runtimeImportPerspective(filePath: string): boolean;
|
|
130
134
|
runtimeMultiUserEnabled(): boolean;
|
|
131
135
|
runtimeSetMultiUserEnabled(enabled: boolean): boolean;
|
|
136
|
+
runtimeFreeHostingEnabled(): boolean;
|
|
137
|
+
runtimeSetFreeHostingEnabled(enabled: boolean): boolean;
|
|
132
138
|
runtimeListUsers(): UserStatistics[];
|
|
133
139
|
runtimeRequestLoginVerification(email: string, appInfo?: AuthInfoInput): VerificationRequestResult;
|
|
134
140
|
runtimeVerifyEmailCode(email: string, code: string, verificationType: string): string;
|
|
@@ -143,4 +149,14 @@ export default class RuntimeResolver {
|
|
|
143
149
|
runtimeHostingUserInfo(): HostingUserInfo;
|
|
144
150
|
runtimeSetHotWalletAddress(address: string): boolean;
|
|
145
151
|
runtimeRequestPayment(amountHOT: string): PaymentRequestResult;
|
|
152
|
+
runtimeSetUserCredits(email: string, amount: number): boolean;
|
|
153
|
+
runtimeSetUserFreeAccess(email: string, enabled: boolean): boolean;
|
|
154
|
+
runtimeReinstallUnytDna(): PaymentRequestResult;
|
|
155
|
+
runtimeSendHot(recipient: string, amount: string): PaymentRequestResult;
|
|
156
|
+
runtimeSetUnytMembraneProof(proof: string): PaymentRequestResult;
|
|
157
|
+
runtimeHotWalletBalance(): string;
|
|
158
|
+
runtimeHotWalletHistory(page?: number, perPage?: number): string;
|
|
159
|
+
runtimeHotAgentPubkey(): string;
|
|
160
|
+
runtimeUnytAgentKey(): string;
|
|
161
|
+
runtimeUnytVersionInfo(): string;
|
|
146
162
|
}
|
|
@@ -289,6 +289,18 @@ __decorate([
|
|
|
289
289
|
Field(type => Int),
|
|
290
290
|
__metadata("design:type", Number)
|
|
291
291
|
], UserStatistics.prototype, "perspectiveCount", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
Field(),
|
|
294
|
+
__metadata("design:type", String)
|
|
295
|
+
], UserStatistics.prototype, "remainingCredits", void 0);
|
|
296
|
+
__decorate([
|
|
297
|
+
Field(),
|
|
298
|
+
__metadata("design:type", Boolean)
|
|
299
|
+
], UserStatistics.prototype, "freeAccess", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
Field({ nullable: true }),
|
|
302
|
+
__metadata("design:type", String)
|
|
303
|
+
], UserStatistics.prototype, "hotWalletAddress", void 0);
|
|
292
304
|
UserStatistics = __decorate([
|
|
293
305
|
ObjectType()
|
|
294
306
|
], UserStatistics);
|
|
@@ -316,10 +328,11 @@ VerificationRequestResult = __decorate([
|
|
|
316
328
|
], VerificationRequestResult);
|
|
317
329
|
export { VerificationRequestResult };
|
|
318
330
|
let HostingUserInfo = class HostingUserInfo {
|
|
319
|
-
constructor(email, remainingCredits, hotWalletAddress) {
|
|
331
|
+
constructor(email, remainingCredits, hotWalletAddress, freeAccess = false) {
|
|
320
332
|
this.email = email;
|
|
321
333
|
this.remainingCredits = remainingCredits;
|
|
322
334
|
this.hotWalletAddress = hotWalletAddress;
|
|
335
|
+
this.freeAccess = freeAccess;
|
|
323
336
|
}
|
|
324
337
|
};
|
|
325
338
|
__decorate([
|
|
@@ -334,9 +347,13 @@ __decorate([
|
|
|
334
347
|
Field({ nullable: true }),
|
|
335
348
|
__metadata("design:type", String)
|
|
336
349
|
], HostingUserInfo.prototype, "hotWalletAddress", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
Field(),
|
|
352
|
+
__metadata("design:type", Boolean)
|
|
353
|
+
], HostingUserInfo.prototype, "freeAccess", void 0);
|
|
337
354
|
HostingUserInfo = __decorate([
|
|
338
355
|
ObjectType(),
|
|
339
|
-
__metadata("design:paramtypes", [String, String, String])
|
|
356
|
+
__metadata("design:paramtypes", [String, String, String, Boolean])
|
|
340
357
|
], HostingUserInfo);
|
|
341
358
|
export { HostingUserInfo };
|
|
342
359
|
let PaymentRequestResult = class PaymentRequestResult {
|
|
@@ -513,12 +530,20 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
513
530
|
runtimeSetMultiUserEnabled(enabled) {
|
|
514
531
|
return enabled;
|
|
515
532
|
}
|
|
533
|
+
runtimeFreeHostingEnabled() {
|
|
534
|
+
return true;
|
|
535
|
+
}
|
|
536
|
+
runtimeSetFreeHostingEnabled(enabled) {
|
|
537
|
+
return enabled;
|
|
538
|
+
}
|
|
516
539
|
runtimeListUsers() {
|
|
517
540
|
return [{
|
|
518
541
|
email: "test@example.com",
|
|
519
542
|
did: "did:key:test123",
|
|
520
543
|
lastSeen: new Date().toISOString(),
|
|
521
|
-
perspectiveCount: 5
|
|
544
|
+
perspectiveCount: 5,
|
|
545
|
+
remainingCredits: "0",
|
|
546
|
+
freeAccess: false
|
|
522
547
|
}];
|
|
523
548
|
}
|
|
524
549
|
runtimeRequestLoginVerification(email, appInfo) {
|
|
@@ -568,7 +593,7 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
568
593
|
}
|
|
569
594
|
// Hosting mutations & queries
|
|
570
595
|
runtimeHostingUserInfo() {
|
|
571
|
-
return new HostingUserInfo("test@example.com", "100000000", null);
|
|
596
|
+
return new HostingUserInfo("test@example.com", "100000000", null, false);
|
|
572
597
|
}
|
|
573
598
|
runtimeSetHotWalletAddress(address) {
|
|
574
599
|
return true;
|
|
@@ -576,6 +601,36 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
576
601
|
runtimeRequestPayment(amountHOT) {
|
|
577
602
|
return new PaymentRequestResult(true, "Mock payment of " + amountHOT + " base units credited");
|
|
578
603
|
}
|
|
604
|
+
runtimeSetUserCredits(email, amount) {
|
|
605
|
+
return true;
|
|
606
|
+
}
|
|
607
|
+
runtimeSetUserFreeAccess(email, enabled) {
|
|
608
|
+
return true;
|
|
609
|
+
}
|
|
610
|
+
runtimeReinstallUnytDna() {
|
|
611
|
+
return new PaymentRequestResult(true, "");
|
|
612
|
+
}
|
|
613
|
+
runtimeSendHot(recipient, amount) {
|
|
614
|
+
return new PaymentRequestResult(true, "");
|
|
615
|
+
}
|
|
616
|
+
runtimeSetUnytMembraneProof(proof) {
|
|
617
|
+
return new PaymentRequestResult(true, "");
|
|
618
|
+
}
|
|
619
|
+
runtimeHotWalletBalance() {
|
|
620
|
+
return "";
|
|
621
|
+
}
|
|
622
|
+
runtimeHotWalletHistory(page, perPage) {
|
|
623
|
+
return "";
|
|
624
|
+
}
|
|
625
|
+
runtimeHotAgentPubkey() {
|
|
626
|
+
return "";
|
|
627
|
+
}
|
|
628
|
+
runtimeUnytAgentKey() {
|
|
629
|
+
return "";
|
|
630
|
+
}
|
|
631
|
+
runtimeUnytVersionInfo() {
|
|
632
|
+
return "";
|
|
633
|
+
}
|
|
579
634
|
};
|
|
580
635
|
__decorate([
|
|
581
636
|
Mutation(returns => Boolean),
|
|
@@ -822,6 +877,19 @@ __decorate([
|
|
|
822
877
|
__metadata("design:paramtypes", [Boolean]),
|
|
823
878
|
__metadata("design:returntype", Boolean)
|
|
824
879
|
], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
|
|
880
|
+
__decorate([
|
|
881
|
+
Query(returns => Boolean),
|
|
882
|
+
__metadata("design:type", Function),
|
|
883
|
+
__metadata("design:paramtypes", []),
|
|
884
|
+
__metadata("design:returntype", Boolean)
|
|
885
|
+
], RuntimeResolver.prototype, "runtimeFreeHostingEnabled", null);
|
|
886
|
+
__decorate([
|
|
887
|
+
Mutation(returns => Boolean),
|
|
888
|
+
__param(0, Arg("enabled")),
|
|
889
|
+
__metadata("design:type", Function),
|
|
890
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
891
|
+
__metadata("design:returntype", Boolean)
|
|
892
|
+
], RuntimeResolver.prototype, "runtimeSetFreeHostingEnabled", null);
|
|
825
893
|
__decorate([
|
|
826
894
|
Query(returns => [UserStatistics]),
|
|
827
895
|
__metadata("design:type", Function),
|
|
@@ -923,6 +991,75 @@ __decorate([
|
|
|
923
991
|
__metadata("design:paramtypes", [String]),
|
|
924
992
|
__metadata("design:returntype", PaymentRequestResult)
|
|
925
993
|
], RuntimeResolver.prototype, "runtimeRequestPayment", null);
|
|
994
|
+
__decorate([
|
|
995
|
+
Mutation(returns => Boolean),
|
|
996
|
+
__param(0, Arg("email")),
|
|
997
|
+
__param(1, Arg("amount")),
|
|
998
|
+
__metadata("design:type", Function),
|
|
999
|
+
__metadata("design:paramtypes", [String, Number]),
|
|
1000
|
+
__metadata("design:returntype", Boolean)
|
|
1001
|
+
], RuntimeResolver.prototype, "runtimeSetUserCredits", null);
|
|
1002
|
+
__decorate([
|
|
1003
|
+
Mutation(returns => Boolean),
|
|
1004
|
+
__param(0, Arg("email")),
|
|
1005
|
+
__param(1, Arg("enabled")),
|
|
1006
|
+
__metadata("design:type", Function),
|
|
1007
|
+
__metadata("design:paramtypes", [String, Boolean]),
|
|
1008
|
+
__metadata("design:returntype", Boolean)
|
|
1009
|
+
], RuntimeResolver.prototype, "runtimeSetUserFreeAccess", null);
|
|
1010
|
+
__decorate([
|
|
1011
|
+
Mutation(returns => PaymentRequestResult),
|
|
1012
|
+
__metadata("design:type", Function),
|
|
1013
|
+
__metadata("design:paramtypes", []),
|
|
1014
|
+
__metadata("design:returntype", PaymentRequestResult)
|
|
1015
|
+
], RuntimeResolver.prototype, "runtimeReinstallUnytDna", null);
|
|
1016
|
+
__decorate([
|
|
1017
|
+
Mutation(returns => PaymentRequestResult),
|
|
1018
|
+
__param(0, Arg("recipient")),
|
|
1019
|
+
__param(1, Arg("amount")),
|
|
1020
|
+
__metadata("design:type", Function),
|
|
1021
|
+
__metadata("design:paramtypes", [String, String]),
|
|
1022
|
+
__metadata("design:returntype", PaymentRequestResult)
|
|
1023
|
+
], RuntimeResolver.prototype, "runtimeSendHot", null);
|
|
1024
|
+
__decorate([
|
|
1025
|
+
Mutation(returns => PaymentRequestResult),
|
|
1026
|
+
__param(0, Arg("proof")),
|
|
1027
|
+
__metadata("design:type", Function),
|
|
1028
|
+
__metadata("design:paramtypes", [String]),
|
|
1029
|
+
__metadata("design:returntype", PaymentRequestResult)
|
|
1030
|
+
], RuntimeResolver.prototype, "runtimeSetUnytMembraneProof", null);
|
|
1031
|
+
__decorate([
|
|
1032
|
+
Query(returns => String),
|
|
1033
|
+
__metadata("design:type", Function),
|
|
1034
|
+
__metadata("design:paramtypes", []),
|
|
1035
|
+
__metadata("design:returntype", String)
|
|
1036
|
+
], RuntimeResolver.prototype, "runtimeHotWalletBalance", null);
|
|
1037
|
+
__decorate([
|
|
1038
|
+
Query(returns => String),
|
|
1039
|
+
__param(0, Arg("page", { nullable: true })),
|
|
1040
|
+
__param(1, Arg("perPage", { nullable: true })),
|
|
1041
|
+
__metadata("design:type", Function),
|
|
1042
|
+
__metadata("design:paramtypes", [Number, Number]),
|
|
1043
|
+
__metadata("design:returntype", String)
|
|
1044
|
+
], RuntimeResolver.prototype, "runtimeHotWalletHistory", null);
|
|
1045
|
+
__decorate([
|
|
1046
|
+
Query(returns => String),
|
|
1047
|
+
__metadata("design:type", Function),
|
|
1048
|
+
__metadata("design:paramtypes", []),
|
|
1049
|
+
__metadata("design:returntype", String)
|
|
1050
|
+
], RuntimeResolver.prototype, "runtimeHotAgentPubkey", null);
|
|
1051
|
+
__decorate([
|
|
1052
|
+
Query(returns => String),
|
|
1053
|
+
__metadata("design:type", Function),
|
|
1054
|
+
__metadata("design:paramtypes", []),
|
|
1055
|
+
__metadata("design:returntype", String)
|
|
1056
|
+
], RuntimeResolver.prototype, "runtimeUnytAgentKey", null);
|
|
1057
|
+
__decorate([
|
|
1058
|
+
Query(returns => String),
|
|
1059
|
+
__metadata("design:type", Function),
|
|
1060
|
+
__metadata("design:paramtypes", []),
|
|
1061
|
+
__metadata("design:returntype", String)
|
|
1062
|
+
], RuntimeResolver.prototype, "runtimeUnytVersionInfo", null);
|
|
926
1063
|
RuntimeResolver = __decorate([
|
|
927
1064
|
Resolver()
|
|
928
1065
|
], RuntimeResolver);
|
package/lib/src/schema.gql
CHANGED
|
@@ -146,6 +146,7 @@ type ExpressionRendered {
|
|
|
146
146
|
|
|
147
147
|
type HostingUserInfo {
|
|
148
148
|
email: String!
|
|
149
|
+
freeAccess: Boolean!
|
|
149
150
|
hotWalletAddress: String
|
|
150
151
|
remainingCredits: String!
|
|
151
152
|
}
|
|
@@ -380,6 +381,7 @@ type Mutation {
|
|
|
380
381
|
runtimeLoginUser(email: String!, password: String!): String!
|
|
381
382
|
runtimeOpenLink(url: String!): Boolean!
|
|
382
383
|
runtimeQuit: Boolean!
|
|
384
|
+
runtimeReinstallUnytDna: PaymentRequestResult!
|
|
383
385
|
runtimeRemoveFriends(dids: [String!]!): [String!]!
|
|
384
386
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
385
387
|
runtimeRemoveNotification(id: String!): Boolean!
|
|
@@ -387,9 +389,14 @@ type Mutation {
|
|
|
387
389
|
runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
|
|
388
390
|
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
389
391
|
runtimeRestartHolochain: Boolean!
|
|
392
|
+
runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
|
|
393
|
+
runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
|
|
390
394
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
391
395
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
392
396
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
397
|
+
runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
|
|
398
|
+
runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
|
|
399
|
+
runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
|
|
393
400
|
runtimeTestEmail(to: String!): Boolean!
|
|
394
401
|
runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
|
|
395
402
|
runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
|
|
@@ -498,11 +505,15 @@ type Query {
|
|
|
498
505
|
perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
|
|
499
506
|
perspectiveSnapshot(uuid: String!): Perspective
|
|
500
507
|
perspectives: [PerspectiveHandle!]!
|
|
508
|
+
runtimeFreeHostingEnabled: Boolean!
|
|
501
509
|
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
502
510
|
runtimeFriends: [String!]!
|
|
503
511
|
runtimeGetNetworkMetrics: String!
|
|
504
512
|
runtimeHcAgentInfos: String!
|
|
505
513
|
runtimeHostingUserInfo: HostingUserInfo!
|
|
514
|
+
runtimeHotAgentPubkey: String!
|
|
515
|
+
runtimeHotWalletBalance: String!
|
|
516
|
+
runtimeHotWalletHistory(page: Float, perPage: Float): String!
|
|
506
517
|
runtimeInfo: RuntimeInfo!
|
|
507
518
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
508
519
|
runtimeListUsers: [UserStatistics!]!
|
|
@@ -510,6 +521,8 @@ type Query {
|
|
|
510
521
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
511
522
|
runtimeMultiUserEnabled: Boolean!
|
|
512
523
|
runtimeNotifications: [Notification!]!
|
|
524
|
+
runtimeUnytAgentKey: String!
|
|
525
|
+
runtimeUnytVersionInfo: String!
|
|
513
526
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
514
527
|
}
|
|
515
528
|
|
|
@@ -585,8 +598,11 @@ type UserCreationResult {
|
|
|
585
598
|
type UserStatistics {
|
|
586
599
|
did: String!
|
|
587
600
|
email: String!
|
|
601
|
+
freeAccess: Boolean!
|
|
602
|
+
hotWalletAddress: String
|
|
588
603
|
lastSeen: String
|
|
589
604
|
perspectiveCount: Int!
|
|
605
|
+
remainingCredits: String!
|
|
590
606
|
}
|
|
591
607
|
|
|
592
608
|
type VerificationRequestResult {
|
package/lib/src/typeDefs.js
CHANGED
|
@@ -142,6 +142,7 @@ type ExpressionRendered {
|
|
|
142
142
|
|
|
143
143
|
type HostingUserInfo {
|
|
144
144
|
email: String!
|
|
145
|
+
freeAccess: Boolean!
|
|
145
146
|
hotWalletAddress: String
|
|
146
147
|
remainingCredits: String!
|
|
147
148
|
}
|
|
@@ -376,6 +377,7 @@ type Mutation {
|
|
|
376
377
|
runtimeLoginUser(email: String!, password: String!): String!
|
|
377
378
|
runtimeOpenLink(url: String!): Boolean!
|
|
378
379
|
runtimeQuit: Boolean!
|
|
380
|
+
runtimeReinstallUnytDna: PaymentRequestResult!
|
|
379
381
|
runtimeRemoveFriends(dids: [String!]!): [String!]!
|
|
380
382
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
381
383
|
runtimeRemoveNotification(id: String!): Boolean!
|
|
@@ -383,9 +385,14 @@ type Mutation {
|
|
|
383
385
|
runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
|
|
384
386
|
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
385
387
|
runtimeRestartHolochain: Boolean!
|
|
388
|
+
runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
|
|
389
|
+
runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
|
|
386
390
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
387
391
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
388
392
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
393
|
+
runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
|
|
394
|
+
runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
|
|
395
|
+
runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
|
|
389
396
|
runtimeTestEmail(to: String!): Boolean!
|
|
390
397
|
runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
|
|
391
398
|
runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
|
|
@@ -494,11 +501,15 @@ type Query {
|
|
|
494
501
|
perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
|
|
495
502
|
perspectiveSnapshot(uuid: String!): Perspective
|
|
496
503
|
perspectives: [PerspectiveHandle!]!
|
|
504
|
+
runtimeFreeHostingEnabled: Boolean!
|
|
497
505
|
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
498
506
|
runtimeFriends: [String!]!
|
|
499
507
|
runtimeGetNetworkMetrics: String!
|
|
500
508
|
runtimeHcAgentInfos: String!
|
|
501
509
|
runtimeHostingUserInfo: HostingUserInfo!
|
|
510
|
+
runtimeHotAgentPubkey: String!
|
|
511
|
+
runtimeHotWalletBalance: String!
|
|
512
|
+
runtimeHotWalletHistory(page: Float, perPage: Float): String!
|
|
502
513
|
runtimeInfo: RuntimeInfo!
|
|
503
514
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
504
515
|
runtimeListUsers: [UserStatistics!]!
|
|
@@ -506,6 +517,8 @@ type Query {
|
|
|
506
517
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
507
518
|
runtimeMultiUserEnabled: Boolean!
|
|
508
519
|
runtimeNotifications: [Notification!]!
|
|
520
|
+
runtimeUnytAgentKey: String!
|
|
521
|
+
runtimeUnytVersionInfo: String!
|
|
509
522
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
510
523
|
}
|
|
511
524
|
|
|
@@ -581,8 +594,11 @@ type UserCreationResult {
|
|
|
581
594
|
type UserStatistics {
|
|
582
595
|
did: String!
|
|
583
596
|
email: String!
|
|
597
|
+
freeAccess: Boolean!
|
|
598
|
+
hotWalletAddress: String
|
|
584
599
|
lastSeen: String
|
|
585
600
|
perspectiveCount: Int!
|
|
601
|
+
remainingCredits: String!
|
|
586
602
|
}
|
|
587
603
|
|
|
588
604
|
type VerificationRequestResult {
|
package/package.json
CHANGED
package/src/agent/AgentClient.ts
CHANGED
|
@@ -82,6 +82,7 @@ export interface InitializeArgs {
|
|
|
82
82
|
export type AgentUpdatedCallback = (agent: Agent) => null;
|
|
83
83
|
export type AgentStatusChangedCallback = (agent: Agent) => null;
|
|
84
84
|
export type AgentAppsUpdatedCallback = () => null;
|
|
85
|
+
export type HostingUserInfoChangedCallback = (info: HostingUserInfo) => void;
|
|
85
86
|
/**
|
|
86
87
|
* Provides access to all functions regarding the local agent,
|
|
87
88
|
* such as generating, locking, unlocking, importing the DID keystore,
|
|
@@ -92,12 +93,14 @@ export class AgentClient {
|
|
|
92
93
|
#appsChangedCallback: AgentAppsUpdatedCallback[];
|
|
93
94
|
#updatedCallbacks: AgentUpdatedCallback[];
|
|
94
95
|
#agentStatusChangedCallbacks: AgentStatusChangedCallback[];
|
|
96
|
+
#hostingUserInfoChangedCallbacks: HostingUserInfoChangedCallback[];
|
|
95
97
|
|
|
96
98
|
constructor(client: ApolloClient<any>, subscribe: boolean = true) {
|
|
97
99
|
this.#apolloClient = client;
|
|
98
100
|
this.#updatedCallbacks = [];
|
|
99
101
|
this.#agentStatusChangedCallbacks = [];
|
|
100
102
|
this.#appsChangedCallback = [];
|
|
103
|
+
this.#hostingUserInfoChangedCallbacks = [];
|
|
101
104
|
|
|
102
105
|
if (subscribe) {
|
|
103
106
|
this.subscribeAgentUpdated();
|
|
@@ -422,6 +425,31 @@ export class AgentClient {
|
|
|
422
425
|
});
|
|
423
426
|
}
|
|
424
427
|
|
|
428
|
+
addHostingUserInfoChangedListener(listener: HostingUserInfoChangedCallback) {
|
|
429
|
+
this.#hostingUserInfoChangedCallbacks.push(listener);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
subscribeHostingUserInfoChanged() {
|
|
433
|
+
this.#apolloClient
|
|
434
|
+
.subscribe({
|
|
435
|
+
query: gql`subscription {
|
|
436
|
+
runtimeHostingUserInfoChanged {
|
|
437
|
+
email
|
|
438
|
+
remainingCredits
|
|
439
|
+
hotWalletAddress
|
|
440
|
+
freeAccess
|
|
441
|
+
}
|
|
442
|
+
}`,
|
|
443
|
+
})
|
|
444
|
+
.subscribe({
|
|
445
|
+
next: (result) => {
|
|
446
|
+
const info = result.data.runtimeHostingUserInfoChanged;
|
|
447
|
+
this.#hostingUserInfoChangedCallbacks.forEach((cb) => cb(info));
|
|
448
|
+
},
|
|
449
|
+
error: (e) => console.error(e),
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
425
453
|
async requestCapability(authInfo: AuthInfoInput): Promise<string> {
|
|
426
454
|
const { agentRequestCapability } = unwrapApolloResult(
|
|
427
455
|
await this.#apolloClient.mutate({
|
|
@@ -600,6 +628,7 @@ export class AgentClient {
|
|
|
600
628
|
email
|
|
601
629
|
remainingCredits
|
|
602
630
|
hotWalletAddress
|
|
631
|
+
freeAccess
|
|
603
632
|
}
|
|
604
633
|
}`,
|
|
605
634
|
})
|
|
@@ -633,4 +662,5 @@ export class AgentClient {
|
|
|
633
662
|
);
|
|
634
663
|
return runtimeRequestPayment;
|
|
635
664
|
}
|
|
665
|
+
|
|
636
666
|
}
|