@kynesyslabs/demosdk 2.0.8 → 2.1.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { XMCoreTargetIdentityPayload, InferFromSignaturePayload, InferFromWritePayload } from "../types/abstraction";
|
|
1
|
+
import { XMCoreTargetIdentityPayload, GithubProof, TwitterProof, InferFromSignaturePayload, InferFromWritePayload } from "../types/abstraction";
|
|
2
2
|
import { Demos } from "../websdk/demosclass";
|
|
3
3
|
export default class Identities {
|
|
4
4
|
/**
|
|
@@ -17,9 +17,24 @@ export default class Identities {
|
|
|
17
17
|
* @returns The response from the RPC call.
|
|
18
18
|
*/
|
|
19
19
|
removeXmIdentity(demos: Demos, payload: XMCoreTargetIdentityPayload): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Add a github identity to the GCR.
|
|
22
|
+
*
|
|
23
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
24
|
+
* @param payload The payload to add the identity to.
|
|
25
|
+
* @returns The response from the RPC call.
|
|
26
|
+
*/
|
|
27
|
+
addGithubIdentity(demos: Demos, payload: GithubProof): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Add a twitter identity to the GCR.
|
|
30
|
+
*
|
|
31
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
32
|
+
* @param payload The payload to add the identity to.
|
|
33
|
+
* @returns The response from the RPC call.
|
|
34
|
+
*/
|
|
35
|
+
addTwitterIdentity(demos: Demos, payload: TwitterProof): Promise<any>;
|
|
20
36
|
/**
|
|
21
37
|
* Get the identities associated with an address.
|
|
22
|
-
* If no address is provided, the address of the connected wallet will be used.
|
|
23
38
|
*
|
|
24
39
|
* @param demos A Demos instance to communicate with the RPC.
|
|
25
40
|
* @param address The address to get identities for.
|
|
@@ -42,9 +42,54 @@ class Identities {
|
|
|
42
42
|
};
|
|
43
43
|
return await demos.rpcCall(request, true);
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Add a github identity to the GCR.
|
|
47
|
+
*
|
|
48
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
49
|
+
* @param payload The payload to add the identity to.
|
|
50
|
+
* @returns The response from the RPC call.
|
|
51
|
+
*/
|
|
52
|
+
async addGithubIdentity(demos, payload) {
|
|
53
|
+
let githubPayload = {
|
|
54
|
+
context: "github",
|
|
55
|
+
proof: payload
|
|
56
|
+
};
|
|
57
|
+
const request = {
|
|
58
|
+
method: "gcr_routine",
|
|
59
|
+
params: [
|
|
60
|
+
{
|
|
61
|
+
method: "add_github_identity",
|
|
62
|
+
params: [githubPayload], // REVIEW Is this correct?
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
return await demos.rpcCall(request, true);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Add a twitter identity to the GCR.
|
|
70
|
+
*
|
|
71
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
72
|
+
* @param payload The payload to add the identity to.
|
|
73
|
+
* @returns The response from the RPC call.
|
|
74
|
+
*/
|
|
75
|
+
async addTwitterIdentity(demos, payload) {
|
|
76
|
+
let twitterPayload = {
|
|
77
|
+
context: "twitter",
|
|
78
|
+
proof: payload
|
|
79
|
+
};
|
|
80
|
+
const request = {
|
|
81
|
+
method: "gcr_routine",
|
|
82
|
+
params: [
|
|
83
|
+
{
|
|
84
|
+
method: "add_twitter_identity",
|
|
85
|
+
params: [twitterPayload],
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
return await demos.rpcCall(request, true);
|
|
90
|
+
}
|
|
45
91
|
/**
|
|
46
92
|
* Get the identities associated with an address.
|
|
47
|
-
* If no address is provided, the address of the connected wallet will be used.
|
|
48
93
|
*
|
|
49
94
|
* @param demos A Demos instance to communicate with the RPC.
|
|
50
95
|
* @param address The address to get identities for.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Identities.js","sourceRoot":"","sources":["../../../src/abstraction/Identities.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;;
|
|
1
|
+
{"version":3,"file":"Identities.js","sourceRoot":"","sources":["../../../src/abstraction/Identities.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;;AAgB9E,MAAqB,UAAU;IAC3B,gEAAgE;IAChE;;;;;;OAMG;IACH,KAAK,CAAC,aAAa,CACf,KAAY,EACZ,OAA0D;QAE1D,MAAM,WAAW,GAAG;YAChB,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,MAAM,EAAE,CAAC,OAAO,CAAC;iBACpB;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IACjD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,KAAY,EAAE,OAAoC;QACrE,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,iBAAiB;oBACzB,MAAM,EAAE,CAAC,OAAO,CAAC;iBACpB;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAY,EAAE,OAAoB;QACtD,IAAI,aAAa,GAA2B;YACxC,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,OAAO;SACjB,CAAA;QAED,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,qBAAqB;oBAC7B,MAAM,EAAE,CAAC,aAAa,CAAC,EAAE,0BAA0B;iBACtD;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;IAGD;;;;;;OAMG;IACH,KAAK,CAAC,kBAAkB,CAAC,KAAY,EAAE,OAAqB;QACxD,IAAI,cAAc,GAAsB;YACpC,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,OAAO;SACjB,CAAA;QAED,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,sBAAsB;oBAC9B,MAAM,EAAE,CAAC,cAAc,CAAC;iBAC3B;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;IACD;;;;;;OAMG;IACH,KAAK,CAAC,aAAa,CAAC,KAAY,EAAE,OAAgB;QAC9C,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,eAAe;oBACvB,MAAM,EAAE,CAAC,OAAO,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;iBAC1C;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;CACJ;AAvHD,6BAuHC"}
|
|
@@ -37,6 +37,16 @@ export interface InferFromSignaturePayload {
|
|
|
37
37
|
*/
|
|
38
38
|
target_identity: InferFromSignatureTargetIdentityPayload;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* NOTE: The payload for the inferIdentityFromWeb2 method contains a context (e.g. "github", "twitter", "telegram", etc.)
|
|
42
|
+
* and a proof (e.g. a link to the actual proof of the identity).
|
|
43
|
+
*
|
|
44
|
+
* The context is used to identify the type of identity being provided, and the proof is the actual proof of the identity.
|
|
45
|
+
*
|
|
46
|
+
* The proof is a string that contains the proof of the identity usually in the form of a link to the proof.
|
|
47
|
+
*
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
40
50
|
export interface Web2CoreTargetIdentityPayload {
|
|
41
51
|
context: string;
|
|
42
52
|
proof: string;
|
|
@@ -45,3 +55,10 @@ export type GithubProof = `https://github.com/${string}/${string}`;
|
|
|
45
55
|
export interface InferFromGithubPayload extends Web2CoreTargetIdentityPayload {
|
|
46
56
|
proof: GithubProof;
|
|
47
57
|
}
|
|
58
|
+
export type XProof = `https://x.com/${string}/${string}`;
|
|
59
|
+
export type TwitterProof = XProof;
|
|
60
|
+
export interface InferFromXPayload extends Web2CoreTargetIdentityPayload {
|
|
61
|
+
proof: XProof;
|
|
62
|
+
}
|
|
63
|
+
export interface InferFromTwitterPayload extends InferFromXPayload {
|
|
64
|
+
}
|