@coasys/ad4m 0.12.0-rc2 → 0.12.1-dev
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 +253 -4
- package/lib/index.js +253 -4
- package/lib/src/agent/AgentClient.js +1 -0
- package/lib/src/runtime/RuntimeClient.d.ts +26 -0
- package/lib/src/runtime/RuntimeClient.js +126 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +14 -1
- package/lib/src/runtime/RuntimeResolver.js +113 -4
- package/lib/src/schema.gql +13 -0
- package/lib/src/typeDefs.js +13 -0
- package/package.json +1 -1
- package/src/agent/AgentClient.ts +2 -0
- package/src/runtime/RuntimeClient.ts +140 -0
- package/src/runtime/RuntimeResolver.ts +77 -3
|
@@ -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 {
|
|
@@ -518,7 +535,9 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
518
535
|
email: "test@example.com",
|
|
519
536
|
did: "did:key:test123",
|
|
520
537
|
lastSeen: new Date().toISOString(),
|
|
521
|
-
perspectiveCount: 5
|
|
538
|
+
perspectiveCount: 5,
|
|
539
|
+
remainingCredits: "0",
|
|
540
|
+
freeAccess: false
|
|
522
541
|
}];
|
|
523
542
|
}
|
|
524
543
|
runtimeRequestLoginVerification(email, appInfo) {
|
|
@@ -568,7 +587,7 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
568
587
|
}
|
|
569
588
|
// Hosting mutations & queries
|
|
570
589
|
runtimeHostingUserInfo() {
|
|
571
|
-
return new HostingUserInfo("test@example.com", "100000000", null);
|
|
590
|
+
return new HostingUserInfo("test@example.com", "100000000", null, false);
|
|
572
591
|
}
|
|
573
592
|
runtimeSetHotWalletAddress(address) {
|
|
574
593
|
return true;
|
|
@@ -576,6 +595,33 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
576
595
|
runtimeRequestPayment(amountHOT) {
|
|
577
596
|
return new PaymentRequestResult(true, "Mock payment of " + amountHOT + " base units credited");
|
|
578
597
|
}
|
|
598
|
+
runtimeSetUserCredits(email, amount) {
|
|
599
|
+
return true;
|
|
600
|
+
}
|
|
601
|
+
runtimeSetUserFreeAccess(email, enabled) {
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
runtimeReinstallUnytDna() {
|
|
605
|
+
return new PaymentRequestResult(true, "");
|
|
606
|
+
}
|
|
607
|
+
runtimeSendHot(recipient, amount) {
|
|
608
|
+
return new PaymentRequestResult(true, "");
|
|
609
|
+
}
|
|
610
|
+
runtimeSetUnytMembraneProof(proof) {
|
|
611
|
+
return new PaymentRequestResult(true, "");
|
|
612
|
+
}
|
|
613
|
+
runtimeHotWalletBalance() {
|
|
614
|
+
return "";
|
|
615
|
+
}
|
|
616
|
+
runtimeHotWalletHistory(page, perPage) {
|
|
617
|
+
return "";
|
|
618
|
+
}
|
|
619
|
+
runtimeHotAgentPubkey() {
|
|
620
|
+
return "";
|
|
621
|
+
}
|
|
622
|
+
runtimeUnytVersionInfo() {
|
|
623
|
+
return "";
|
|
624
|
+
}
|
|
579
625
|
};
|
|
580
626
|
__decorate([
|
|
581
627
|
Mutation(returns => Boolean),
|
|
@@ -923,6 +969,69 @@ __decorate([
|
|
|
923
969
|
__metadata("design:paramtypes", [String]),
|
|
924
970
|
__metadata("design:returntype", PaymentRequestResult)
|
|
925
971
|
], RuntimeResolver.prototype, "runtimeRequestPayment", null);
|
|
972
|
+
__decorate([
|
|
973
|
+
Mutation(returns => Boolean),
|
|
974
|
+
__param(0, Arg("email")),
|
|
975
|
+
__param(1, Arg("amount")),
|
|
976
|
+
__metadata("design:type", Function),
|
|
977
|
+
__metadata("design:paramtypes", [String, Number]),
|
|
978
|
+
__metadata("design:returntype", Boolean)
|
|
979
|
+
], RuntimeResolver.prototype, "runtimeSetUserCredits", null);
|
|
980
|
+
__decorate([
|
|
981
|
+
Mutation(returns => Boolean),
|
|
982
|
+
__param(0, Arg("email")),
|
|
983
|
+
__param(1, Arg("enabled")),
|
|
984
|
+
__metadata("design:type", Function),
|
|
985
|
+
__metadata("design:paramtypes", [String, Boolean]),
|
|
986
|
+
__metadata("design:returntype", Boolean)
|
|
987
|
+
], RuntimeResolver.prototype, "runtimeSetUserFreeAccess", null);
|
|
988
|
+
__decorate([
|
|
989
|
+
Mutation(returns => PaymentRequestResult),
|
|
990
|
+
__metadata("design:type", Function),
|
|
991
|
+
__metadata("design:paramtypes", []),
|
|
992
|
+
__metadata("design:returntype", PaymentRequestResult)
|
|
993
|
+
], RuntimeResolver.prototype, "runtimeReinstallUnytDna", null);
|
|
994
|
+
__decorate([
|
|
995
|
+
Mutation(returns => PaymentRequestResult),
|
|
996
|
+
__param(0, Arg("recipient")),
|
|
997
|
+
__param(1, Arg("amount")),
|
|
998
|
+
__metadata("design:type", Function),
|
|
999
|
+
__metadata("design:paramtypes", [String, String]),
|
|
1000
|
+
__metadata("design:returntype", PaymentRequestResult)
|
|
1001
|
+
], RuntimeResolver.prototype, "runtimeSendHot", null);
|
|
1002
|
+
__decorate([
|
|
1003
|
+
Mutation(returns => PaymentRequestResult),
|
|
1004
|
+
__param(0, Arg("proof")),
|
|
1005
|
+
__metadata("design:type", Function),
|
|
1006
|
+
__metadata("design:paramtypes", [String]),
|
|
1007
|
+
__metadata("design:returntype", PaymentRequestResult)
|
|
1008
|
+
], RuntimeResolver.prototype, "runtimeSetUnytMembraneProof", null);
|
|
1009
|
+
__decorate([
|
|
1010
|
+
Query(returns => String),
|
|
1011
|
+
__metadata("design:type", Function),
|
|
1012
|
+
__metadata("design:paramtypes", []),
|
|
1013
|
+
__metadata("design:returntype", String)
|
|
1014
|
+
], RuntimeResolver.prototype, "runtimeHotWalletBalance", null);
|
|
1015
|
+
__decorate([
|
|
1016
|
+
Query(returns => String),
|
|
1017
|
+
__param(0, Arg("page", { nullable: true })),
|
|
1018
|
+
__param(1, Arg("perPage", { nullable: true })),
|
|
1019
|
+
__metadata("design:type", Function),
|
|
1020
|
+
__metadata("design:paramtypes", [Number, Number]),
|
|
1021
|
+
__metadata("design:returntype", String)
|
|
1022
|
+
], RuntimeResolver.prototype, "runtimeHotWalletHistory", null);
|
|
1023
|
+
__decorate([
|
|
1024
|
+
Query(returns => String),
|
|
1025
|
+
__metadata("design:type", Function),
|
|
1026
|
+
__metadata("design:paramtypes", []),
|
|
1027
|
+
__metadata("design:returntype", String)
|
|
1028
|
+
], RuntimeResolver.prototype, "runtimeHotAgentPubkey", null);
|
|
1029
|
+
__decorate([
|
|
1030
|
+
Query(returns => String),
|
|
1031
|
+
__metadata("design:type", Function),
|
|
1032
|
+
__metadata("design:paramtypes", []),
|
|
1033
|
+
__metadata("design:returntype", String)
|
|
1034
|
+
], RuntimeResolver.prototype, "runtimeUnytVersionInfo", null);
|
|
926
1035
|
RuntimeResolver = __decorate([
|
|
927
1036
|
Resolver()
|
|
928
1037
|
], 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,13 @@ 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!
|
|
390
393
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
391
394
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
392
395
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
396
|
+
runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
|
|
397
|
+
runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
|
|
398
|
+
runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
|
|
393
399
|
runtimeTestEmail(to: String!): Boolean!
|
|
394
400
|
runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
|
|
395
401
|
runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
|
|
@@ -503,6 +509,9 @@ type Query {
|
|
|
503
509
|
runtimeGetNetworkMetrics: String!
|
|
504
510
|
runtimeHcAgentInfos: String!
|
|
505
511
|
runtimeHostingUserInfo: HostingUserInfo!
|
|
512
|
+
runtimeHotAgentPubkey: String!
|
|
513
|
+
runtimeHotWalletBalance: String!
|
|
514
|
+
runtimeHotWalletHistory(page: Float, perPage: Float): String!
|
|
506
515
|
runtimeInfo: RuntimeInfo!
|
|
507
516
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
508
517
|
runtimeListUsers: [UserStatistics!]!
|
|
@@ -510,6 +519,7 @@ type Query {
|
|
|
510
519
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
511
520
|
runtimeMultiUserEnabled: Boolean!
|
|
512
521
|
runtimeNotifications: [Notification!]!
|
|
522
|
+
runtimeUnytVersionInfo: String!
|
|
513
523
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
514
524
|
}
|
|
515
525
|
|
|
@@ -585,8 +595,11 @@ type UserCreationResult {
|
|
|
585
595
|
type UserStatistics {
|
|
586
596
|
did: String!
|
|
587
597
|
email: String!
|
|
598
|
+
freeAccess: Boolean!
|
|
599
|
+
hotWalletAddress: String
|
|
588
600
|
lastSeen: String
|
|
589
601
|
perspectiveCount: Int!
|
|
602
|
+
remainingCredits: String!
|
|
590
603
|
}
|
|
591
604
|
|
|
592
605
|
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,13 @@ 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!
|
|
386
389
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
387
390
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
388
391
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
392
|
+
runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
|
|
393
|
+
runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
|
|
394
|
+
runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
|
|
389
395
|
runtimeTestEmail(to: String!): Boolean!
|
|
390
396
|
runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
|
|
391
397
|
runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
|
|
@@ -499,6 +505,9 @@ type Query {
|
|
|
499
505
|
runtimeGetNetworkMetrics: String!
|
|
500
506
|
runtimeHcAgentInfos: String!
|
|
501
507
|
runtimeHostingUserInfo: HostingUserInfo!
|
|
508
|
+
runtimeHotAgentPubkey: String!
|
|
509
|
+
runtimeHotWalletBalance: String!
|
|
510
|
+
runtimeHotWalletHistory(page: Float, perPage: Float): String!
|
|
502
511
|
runtimeInfo: RuntimeInfo!
|
|
503
512
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
504
513
|
runtimeListUsers: [UserStatistics!]!
|
|
@@ -506,6 +515,7 @@ type Query {
|
|
|
506
515
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
507
516
|
runtimeMultiUserEnabled: Boolean!
|
|
508
517
|
runtimeNotifications: [Notification!]!
|
|
518
|
+
runtimeUnytVersionInfo: String!
|
|
509
519
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
510
520
|
}
|
|
511
521
|
|
|
@@ -581,8 +591,11 @@ type UserCreationResult {
|
|
|
581
591
|
type UserStatistics {
|
|
582
592
|
did: String!
|
|
583
593
|
email: String!
|
|
594
|
+
freeAccess: Boolean!
|
|
595
|
+
hotWalletAddress: String
|
|
584
596
|
lastSeen: String
|
|
585
597
|
perspectiveCount: Int!
|
|
598
|
+
remainingCredits: String!
|
|
586
599
|
}
|
|
587
600
|
|
|
588
601
|
type VerificationRequestResult {
|
package/package.json
CHANGED
package/src/agent/AgentClient.ts
CHANGED
|
@@ -78,6 +78,15 @@ export class RuntimeClient {
|
|
|
78
78
|
return runtimeInfo
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
async tlsDomain(): Promise<string | null> {
|
|
82
|
+
const { runtimeTlsDomain } = unwrapApolloResult(await this.#apolloClient.query({
|
|
83
|
+
query: gql`query runtimeTlsDomain {
|
|
84
|
+
runtimeTlsDomain
|
|
85
|
+
}`,
|
|
86
|
+
}));
|
|
87
|
+
return runtimeTlsDomain
|
|
88
|
+
}
|
|
89
|
+
|
|
81
90
|
async quit(): Promise<Boolean> {
|
|
82
91
|
const result = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
83
92
|
mutation: gql`mutation runtimeQuit { runtimeQuit }`
|
|
@@ -413,12 +422,25 @@ export class RuntimeClient {
|
|
|
413
422
|
did
|
|
414
423
|
lastSeen
|
|
415
424
|
perspectiveCount
|
|
425
|
+
remainingCredits
|
|
426
|
+
freeAccess
|
|
427
|
+
hotWalletAddress
|
|
416
428
|
}
|
|
417
429
|
}`
|
|
418
430
|
}))
|
|
419
431
|
return runtimeListUsers
|
|
420
432
|
}
|
|
421
433
|
|
|
434
|
+
async userWalletAddress(email: string): Promise<string | null> {
|
|
435
|
+
const { runtimeUserWalletAddress } = unwrapApolloResult(await this.#apolloClient.query({
|
|
436
|
+
query: gql`query runtimeUserWalletAddress($email: String!) {
|
|
437
|
+
runtimeUserWalletAddress(email: $email)
|
|
438
|
+
}`,
|
|
439
|
+
variables: { email }
|
|
440
|
+
}))
|
|
441
|
+
return runtimeUserWalletAddress
|
|
442
|
+
}
|
|
443
|
+
|
|
422
444
|
async emailTestModeEnable(): Promise<boolean> {
|
|
423
445
|
const { runtimeEmailTestModeEnable } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
424
446
|
mutation: gql`mutation runtimeEmailTestModeEnable {
|
|
@@ -466,6 +488,124 @@ export class RuntimeClient {
|
|
|
466
488
|
return runtimeEmailTestSetExpiry
|
|
467
489
|
}
|
|
468
490
|
|
|
491
|
+
// ---- Unyt / mHOT methods ----
|
|
492
|
+
|
|
493
|
+
async unytAgentKey(): Promise<string> {
|
|
494
|
+
const { runtimeUnytAgentKey } = unwrapApolloResult(await this.#apolloClient.query({
|
|
495
|
+
query: gql`query runtimeUnytAgentKey { runtimeUnytAgentKey }`,
|
|
496
|
+
fetchPolicy: "network-only",
|
|
497
|
+
}))
|
|
498
|
+
return runtimeUnytAgentKey
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
async unytHotAgentPubkey(): Promise<string> {
|
|
502
|
+
const { runtimeHotAgentPubkey } = unwrapApolloResult(await this.#apolloClient.query({
|
|
503
|
+
query: gql`query runtimeHotAgentPubkey { runtimeHotAgentPubkey }`,
|
|
504
|
+
fetchPolicy: "network-only",
|
|
505
|
+
}))
|
|
506
|
+
return runtimeHotAgentPubkey
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
async unytWalletBalance(): Promise<string> {
|
|
510
|
+
const { runtimeHotWalletBalance } = unwrapApolloResult(await this.#apolloClient.query({
|
|
511
|
+
query: gql`query runtimeHotWalletBalance { runtimeHotWalletBalance }`,
|
|
512
|
+
fetchPolicy: "network-only",
|
|
513
|
+
}))
|
|
514
|
+
return runtimeHotWalletBalance
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
async unytWalletHistory(page?: number, perPage?: number): Promise<string> {
|
|
518
|
+
const { runtimeHotWalletHistory } = unwrapApolloResult(await this.#apolloClient.query({
|
|
519
|
+
query: gql`query runtimeHotWalletHistory($page: Int, $perPage: Int) {
|
|
520
|
+
runtimeHotWalletHistory(page: $page, perPage: $perPage)
|
|
521
|
+
}`,
|
|
522
|
+
variables: { page, perPage },
|
|
523
|
+
fetchPolicy: "network-only",
|
|
524
|
+
}))
|
|
525
|
+
return runtimeHotWalletHistory
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
async unytVersionInfo(): Promise<string> {
|
|
529
|
+
const { runtimeUnytVersionInfo } = unwrapApolloResult(await this.#apolloClient.query({
|
|
530
|
+
query: gql`query runtimeUnytVersionInfo { runtimeUnytVersionInfo }`,
|
|
531
|
+
fetchPolicy: "network-only",
|
|
532
|
+
}))
|
|
533
|
+
return runtimeUnytVersionInfo
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
async unytSetMembraneProof(proof: string): Promise<{ success: boolean; message: string }> {
|
|
537
|
+
const { runtimeSetUnytMembraneProof } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
538
|
+
mutation: gql`mutation runtimeSetUnytMembraneProof($proof: String!) {
|
|
539
|
+
runtimeSetUnytMembraneProof(proof: $proof) { success message }
|
|
540
|
+
}`,
|
|
541
|
+
variables: { proof },
|
|
542
|
+
}))
|
|
543
|
+
return runtimeSetUnytMembraneProof
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
async unytReinstallDna(): Promise<{ success: boolean; message: string }> {
|
|
547
|
+
const { runtimeReinstallUnytDna } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
548
|
+
mutation: gql`mutation runtimeReinstallUnytDna {
|
|
549
|
+
runtimeReinstallUnytDna { success message }
|
|
550
|
+
}`,
|
|
551
|
+
}))
|
|
552
|
+
return runtimeReinstallUnytDna
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
async unytSendHot(recipient: string, amount: string): Promise<{ success: boolean; message: string }> {
|
|
556
|
+
const { runtimeSendHot } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
557
|
+
mutation: gql`mutation runtimeSendHot($recipient: String!, $amount: String!) {
|
|
558
|
+
runtimeSendHot(recipient: $recipient, amount: $amount) { success message }
|
|
559
|
+
}`,
|
|
560
|
+
variables: { recipient, amount },
|
|
561
|
+
}))
|
|
562
|
+
return runtimeSendHot
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
async setUserCredits(email: string, amount: number): Promise<boolean> {
|
|
566
|
+
const { runtimeSetUserCredits } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
567
|
+
mutation: gql`mutation runtimeSetUserCredits($email: String!, $amount: Float!) {
|
|
568
|
+
runtimeSetUserCredits(email: $email, amount: $amount)
|
|
569
|
+
}`,
|
|
570
|
+
variables: { email, amount },
|
|
571
|
+
}))
|
|
572
|
+
return runtimeSetUserCredits
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
async setUserFreeAccess(email: string, enabled: boolean): Promise<boolean> {
|
|
576
|
+
const { runtimeSetUserFreeAccess } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
577
|
+
mutation: gql`mutation runtimeSetUserFreeAccess($email: String!, $enabled: Boolean!) {
|
|
578
|
+
runtimeSetUserFreeAccess(email: $email, enabled: $enabled)
|
|
579
|
+
}`,
|
|
580
|
+
variables: { email, enabled },
|
|
581
|
+
}))
|
|
582
|
+
return runtimeSetUserFreeAccess
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
async setHostRates(ratesJson: string): Promise<boolean> {
|
|
586
|
+
const { runtimeSetHostRates } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
587
|
+
mutation: gql`mutation runtimeSetHostRates($ratesJson: String!) {
|
|
588
|
+
runtimeSetHostRates(ratesJson: $ratesJson)
|
|
589
|
+
}`,
|
|
590
|
+
variables: { ratesJson },
|
|
591
|
+
}))
|
|
592
|
+
return runtimeSetHostRates
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
async getHostRates(): Promise<{ description: string; priceInHOT: number }[]> {
|
|
596
|
+
const { runtimeHostRates } = unwrapApolloResult(await this.#apolloClient.query({
|
|
597
|
+
query: gql`query runtimeHostRates {
|
|
598
|
+
runtimeHostRates
|
|
599
|
+
}`,
|
|
600
|
+
fetchPolicy: 'network-only',
|
|
601
|
+
}))
|
|
602
|
+
try {
|
|
603
|
+
return JSON.parse(runtimeHostRates)
|
|
604
|
+
} catch {
|
|
605
|
+
return []
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
469
609
|
addNotificationTriggeredCallback(cb: NotificationTriggeredCallback) {
|
|
470
610
|
this.#notificationTriggeredCallbacks.push(cb)
|
|
471
611
|
}
|
|
@@ -206,6 +206,15 @@ export class UserStatistics {
|
|
|
206
206
|
|
|
207
207
|
@Field(type => Int)
|
|
208
208
|
perspectiveCount: number;
|
|
209
|
+
|
|
210
|
+
@Field()
|
|
211
|
+
remainingCredits: string;
|
|
212
|
+
|
|
213
|
+
@Field()
|
|
214
|
+
freeAccess: boolean;
|
|
215
|
+
|
|
216
|
+
@Field({nullable: true})
|
|
217
|
+
hotWalletAddress?: string;
|
|
209
218
|
}
|
|
210
219
|
|
|
211
220
|
@ObjectType()
|
|
@@ -234,10 +243,14 @@ export class HostingUserInfo {
|
|
|
234
243
|
@Field({ nullable: true })
|
|
235
244
|
hotWalletAddress?: string;
|
|
236
245
|
|
|
237
|
-
|
|
246
|
+
@Field()
|
|
247
|
+
freeAccess: boolean;
|
|
248
|
+
|
|
249
|
+
constructor(email: string, remainingCredits: string, hotWalletAddress?: string, freeAccess: boolean = false) {
|
|
238
250
|
this.email = email;
|
|
239
251
|
this.remainingCredits = remainingCredits;
|
|
240
252
|
this.hotWalletAddress = hotWalletAddress;
|
|
253
|
+
this.freeAccess = freeAccess;
|
|
241
254
|
}
|
|
242
255
|
}
|
|
243
256
|
|
|
@@ -506,7 +519,9 @@ export default class RuntimeResolver {
|
|
|
506
519
|
email: "test@example.com",
|
|
507
520
|
did: "did:key:test123",
|
|
508
521
|
lastSeen: new Date().toISOString(),
|
|
509
|
-
perspectiveCount: 5
|
|
522
|
+
perspectiveCount: 5,
|
|
523
|
+
remainingCredits: "0",
|
|
524
|
+
freeAccess: false
|
|
510
525
|
}]
|
|
511
526
|
}
|
|
512
527
|
|
|
@@ -597,7 +612,7 @@ export default class RuntimeResolver {
|
|
|
597
612
|
|
|
598
613
|
@Query(returns => HostingUserInfo)
|
|
599
614
|
runtimeHostingUserInfo(): HostingUserInfo {
|
|
600
|
-
return new HostingUserInfo("test@example.com", "100000000", null)
|
|
615
|
+
return new HostingUserInfo("test@example.com", "100000000", null, false)
|
|
601
616
|
}
|
|
602
617
|
|
|
603
618
|
@Mutation(returns => Boolean)
|
|
@@ -613,5 +628,64 @@ export default class RuntimeResolver {
|
|
|
613
628
|
): PaymentRequestResult {
|
|
614
629
|
return new PaymentRequestResult(true, "Mock payment of " + amountHOT + " base units credited")
|
|
615
630
|
}
|
|
631
|
+
|
|
632
|
+
@Mutation(returns => Boolean)
|
|
633
|
+
runtimeSetUserCredits(
|
|
634
|
+
@Arg("email") email: string,
|
|
635
|
+
@Arg("amount") amount: number
|
|
636
|
+
): boolean {
|
|
637
|
+
return true
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
@Mutation(returns => Boolean)
|
|
641
|
+
runtimeSetUserFreeAccess(
|
|
642
|
+
@Arg("email") email: string,
|
|
643
|
+
@Arg("enabled") enabled: boolean
|
|
644
|
+
): boolean {
|
|
645
|
+
return true
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
@Mutation(returns => PaymentRequestResult)
|
|
649
|
+
runtimeReinstallUnytDna(): PaymentRequestResult {
|
|
650
|
+
return new PaymentRequestResult(true, "")
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
@Mutation(returns => PaymentRequestResult)
|
|
654
|
+
runtimeSendHot(
|
|
655
|
+
@Arg("recipient") recipient: string,
|
|
656
|
+
@Arg("amount") amount: string
|
|
657
|
+
): PaymentRequestResult {
|
|
658
|
+
return new PaymentRequestResult(true, "")
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
@Mutation(returns => PaymentRequestResult)
|
|
662
|
+
runtimeSetUnytMembraneProof(
|
|
663
|
+
@Arg("proof") proof: string
|
|
664
|
+
): PaymentRequestResult {
|
|
665
|
+
return new PaymentRequestResult(true, "")
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
@Query(returns => String)
|
|
669
|
+
runtimeHotWalletBalance(): string {
|
|
670
|
+
return ""
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
@Query(returns => String)
|
|
674
|
+
runtimeHotWalletHistory(
|
|
675
|
+
@Arg("page", { nullable: true }) page?: number,
|
|
676
|
+
@Arg("perPage", { nullable: true }) perPage?: number
|
|
677
|
+
): string {
|
|
678
|
+
return ""
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
@Query(returns => String)
|
|
682
|
+
runtimeHotAgentPubkey(): string {
|
|
683
|
+
return ""
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
@Query(returns => String)
|
|
687
|
+
runtimeUnytVersionInfo(): string {
|
|
688
|
+
return ""
|
|
689
|
+
}
|
|
616
690
|
}
|
|
617
691
|
|