@lit-protocol/vincent-app-sdk 1.0.0-1 → 1.0.1-mcp1
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/package.json +4 -1
- package/dist/src/app/app.d.ts +1 -1
- package/dist/src/app/app.js +1 -1
- package/dist/src/app/types.d.ts +3 -5
- package/dist/src/app/types.d.ts.map +1 -1
- package/dist/src/express-authentication-middleware/index.d.ts +1 -1
- package/dist/src/express-authentication-middleware/index.js +1 -1
- package/dist/src/express-authentication-middleware/types.d.ts +3 -0
- package/dist/src/express-authentication-middleware/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +10 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/jwt/index.d.ts +1 -1
- package/dist/src/jwt/index.js +1 -1
- package/dist/src/jwt/types.d.ts +4 -0
- package/dist/src/jwt/types.d.ts.map +1 -1
- package/dist/src/toolClient/index.d.ts +2 -1
- package/dist/src/toolClient/index.d.ts.map +1 -1
- package/dist/src/toolClient/index.js +2 -1
- package/dist/src/toolClient/index.js.map +1 -1
- package/dist/src/toolClient/types.d.ts +47 -0
- package/dist/src/toolClient/types.d.ts.map +1 -1
- package/dist/src/toolClient/vincentToolClient.d.ts +25 -7
- package/dist/src/toolClient/vincentToolClient.d.ts.map +1 -1
- package/dist/src/toolClient/vincentToolClient.js +22 -2
- package/dist/src/toolClient/vincentToolClient.js.map +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/contracts.d.ts +49 -0
- package/dist/src/utils/contracts.d.ts.map +1 -0
- package/dist/src/utils/contracts.js +92 -0
- package/dist/src/utils/contracts.js.map +1 -0
- package/dist/src/utils/delegation.d.ts +44 -0
- package/dist/src/utils/delegation.d.ts.map +1 -0
- package/dist/src/utils/delegation.js +64 -0
- package/dist/src/utils/delegation.js.map +1 -0
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +7 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/pkp.d.ts +16 -0
- package/dist/src/utils/pkp.d.ts.map +1 -0
- package/dist/src/utils/pkp.js +27 -0
- package/dist/src/utils/pkp.js.map +1 -0
- package/package.json +2 -2
package/dist/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-app-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Vincent SDK for browser and backend",
|
|
5
5
|
"author": "Lit Protocol",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"access": "public",
|
|
8
8
|
"packageManager": "pnpm@10.7.0",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
9
12
|
"engines": {
|
|
10
13
|
"node": "^20.11.1",
|
|
11
14
|
"pnpm": "10.7.0"
|
package/dist/src/app/app.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { VincentAppClientConfig, VincentWebAppClient } from './types';
|
|
|
3
3
|
*
|
|
4
4
|
* - `appId` is the numeric app ID displayed for your app on the Vincent Dashboard
|
|
5
5
|
*
|
|
6
|
-
* @category
|
|
6
|
+
* @category API Methods
|
|
7
7
|
* */
|
|
8
8
|
export declare const getVincentWebAppClient: (appClientConfig: VincentAppClientConfig) => VincentWebAppClient;
|
|
9
9
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/src/app/app.js
CHANGED
|
@@ -9,7 +9,7 @@ const redirectToConsentPage = ({ appId, redirectUri, consentPageUrl, }) => windo
|
|
|
9
9
|
*
|
|
10
10
|
* - `appId` is the numeric app ID displayed for your app on the Vincent Dashboard
|
|
11
11
|
*
|
|
12
|
-
* @category
|
|
12
|
+
* @category API Methods
|
|
13
13
|
* */
|
|
14
14
|
const getVincentWebAppClient = (appClientConfig) => {
|
|
15
15
|
const { appId } = appClientConfig;
|
package/dist/src/app/types.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { VincentJWT } from '../jwt/types';
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
4
|
-
* @hidden
|
|
3
|
+
* @category Interfaces
|
|
5
4
|
*/
|
|
6
5
|
export interface VincentAppClientConfig {
|
|
7
6
|
appId: string;
|
|
8
7
|
}
|
|
9
8
|
/**
|
|
10
|
-
* @
|
|
11
|
-
* @hidden
|
|
9
|
+
* @category Interfaces
|
|
12
10
|
*/
|
|
13
11
|
export interface RedirectToVincentConsentPageParams {
|
|
14
12
|
redirectUri: string;
|
|
@@ -23,7 +21,7 @@ export interface RedirectToVincentConsentPageParams {
|
|
|
23
21
|
* - Consent page redirection
|
|
24
22
|
* - Authentication helpers that are browser specific
|
|
25
23
|
*
|
|
26
|
-
* @category
|
|
24
|
+
* @category Interfaces
|
|
27
25
|
*/
|
|
28
26
|
export interface VincentWebAppClient {
|
|
29
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/app/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/app/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB;;SAEK;IACL,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,qBAAqB,EAAE,CAAC,cAAc,EAAE,kCAAkC,KAAK,IAAI,CAAC;IAEpF;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,qBAAqB,EAAE,CACrB,gBAAgB,EAAE,MAAM,KACrB;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC"}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* {@includeCode ./express.ts#expressHandlerTSDocExample}
|
|
37
37
|
*
|
|
38
38
|
* @module expressAuthHelpers
|
|
39
|
-
* @category
|
|
39
|
+
* @category API Methods
|
|
40
40
|
* */
|
|
41
41
|
import { authenticatedRequestHandler, getAuthenticateUserExpressHandler } from './express';
|
|
42
42
|
export { authenticatedRequestHandler, getAuthenticateUserExpressHandler };
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* {@includeCode ./express.ts#expressHandlerTSDocExample}
|
|
38
38
|
*
|
|
39
39
|
* @module expressAuthHelpers
|
|
40
|
-
* @category
|
|
40
|
+
* @category API Methods
|
|
41
41
|
* */
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
exports.getAuthenticateUserExpressHandler = exports.authenticatedRequestHandler = void 0;
|
|
@@ -14,6 +14,9 @@ export interface AuthenticatedRequest<P = any, ResBody = any, ReqBody = any, Req
|
|
|
14
14
|
rawJWT: string;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @category Interfaces
|
|
19
|
+
*/
|
|
17
20
|
export interface ExpressAuthHelpers {
|
|
18
21
|
AuthenticatedRequestHandler: AuthenticatedRequestHandler;
|
|
19
22
|
AuthenticatedRequest: AuthenticatedRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts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,OAAO,EAAE,MAAM,CAAC,EAC9B,IAAI,EAAE,YAAY,KACf,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B;KACK;AACL,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,CACzF,SAAQ,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC;IAC9C,IAAI,EAAE;QACJ,UAAU,EAAE,UAAU,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2BAA2B,EAAE,2BAA2B,CAAC;IACzD,oBAAoB,EAAE,oBAAoB,CAAC;CAC5C"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import * as jwt from './jwt';
|
|
2
2
|
export { jwt };
|
|
3
3
|
export type { JWTConfig, VincentJWT, VincentJWTPayload } from './jwt/types';
|
|
4
|
-
import { disconnectLitNodeClientInstance
|
|
4
|
+
import { disconnectLitNodeClientInstance } from './internal/LitNodeClient/getLitNodeClient';
|
|
5
|
+
/** This method closes any registered event listeners maintained by Vincent Tool Clients, allowing your process to exit gracefully.
|
|
6
|
+
* @category API Methods
|
|
7
|
+
*/
|
|
8
|
+
declare const disconnectVincentToolClients: typeof disconnectLitNodeClientInstance;
|
|
5
9
|
export { disconnectVincentToolClients };
|
|
6
|
-
export { getVincentToolClient } from './toolClient';
|
|
10
|
+
export { generateVincentToolSessionSigs, getVincentToolClient } from './toolClient';
|
|
11
|
+
export type { VincentToolClient, ToolClientContext, ToolResponse, ToolResponseFailure, ToolResponseFailureNoResult, ToolResponseSuccess, ToolResponseSuccessNoResult, } from './toolClient';
|
|
7
12
|
export { getVincentWebAppClient } from './app';
|
|
8
13
|
export type { VincentWebAppClient, VincentAppClientConfig, RedirectToVincentConsentPageParams, } from './types';
|
|
14
|
+
export type { BaseToolContext } from './toolClient';
|
|
9
15
|
import * as expressAuthHelpers from './express-authentication-middleware';
|
|
10
16
|
export { expressAuthHelpers };
|
|
11
17
|
export type { ExpressAuthHelpers } from './express-authentication-middleware/types';
|
|
18
|
+
import * as utils from './utils';
|
|
19
|
+
export { utils };
|
|
12
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,CAAC;AACf,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,EAAE,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,CAAC;AACf,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAE5F;;GAEG;AACH,QAAA,MAAM,4BAA4B,wCAAkC,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC,OAAO,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpF,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAC/C,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,kBAAkB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAEpF,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expressAuthHelpers = exports.getVincentWebAppClient = exports.getVincentToolClient = exports.disconnectVincentToolClients = exports.jwt = void 0;
|
|
3
|
+
exports.utils = exports.expressAuthHelpers = exports.getVincentWebAppClient = exports.getVincentToolClient = exports.generateVincentToolSessionSigs = exports.disconnectVincentToolClients = exports.jwt = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jwt = tslib_1.__importStar(require("./jwt"));
|
|
6
6
|
exports.jwt = jwt;
|
|
7
7
|
const getLitNodeClient_1 = require("./internal/LitNodeClient/getLitNodeClient");
|
|
8
|
-
|
|
8
|
+
/** This method closes any registered event listeners maintained by Vincent Tool Clients, allowing your process to exit gracefully.
|
|
9
|
+
* @category API Methods
|
|
10
|
+
*/
|
|
11
|
+
const disconnectVincentToolClients = getLitNodeClient_1.disconnectLitNodeClientInstance;
|
|
12
|
+
exports.disconnectVincentToolClients = disconnectVincentToolClients;
|
|
9
13
|
var toolClient_1 = require("./toolClient");
|
|
14
|
+
Object.defineProperty(exports, "generateVincentToolSessionSigs", { enumerable: true, get: function () { return toolClient_1.generateVincentToolSessionSigs; } });
|
|
10
15
|
Object.defineProperty(exports, "getVincentToolClient", { enumerable: true, get: function () { return toolClient_1.getVincentToolClient; } });
|
|
11
16
|
var app_1 = require("./app");
|
|
12
17
|
Object.defineProperty(exports, "getVincentWebAppClient", { enumerable: true, get: function () { return app_1.getVincentWebAppClient; } });
|
|
13
18
|
const expressAuthHelpers = tslib_1.__importStar(require("./express-authentication-middleware"));
|
|
14
19
|
exports.expressAuthHelpers = expressAuthHelpers;
|
|
20
|
+
const utils = tslib_1.__importStar(require("./utils"));
|
|
21
|
+
exports.utils = utils;
|
|
15
22
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AACpB,kBAAG;AAGZ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AACpB,kBAAG;AAGZ,gFAA4F;AAE5F;;GAEG;AACH,MAAM,4BAA4B,GAAG,kDAA+B,CAAC;AAC5D,oEAA4B;AAErC,2CAAoF;AAA3E,4HAAA,8BAA8B,OAAA;AAAE,kHAAA,oBAAoB,OAAA;AAW7D,6BAA+C;AAAtC,6GAAA,sBAAsB,OAAA;AAS/B,gGAA0E;AACjE,gDAAkB;AAG3B,uDAAiC;AACxB,sBAAK"}
|
package/dist/src/jwt/index.d.ts
CHANGED
package/dist/src/jwt/index.js
CHANGED
package/dist/src/jwt/types.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export interface JWTConfig {
|
|
|
42
42
|
* @property {string} app - The app associated with the JWT.
|
|
43
43
|
* @property {string} pkp - The PKP associated with the JWT.
|
|
44
44
|
* @property {string} authentication - The authentication method used to generate the JWT.
|
|
45
|
+
*
|
|
46
|
+
* @category Interfaces
|
|
45
47
|
*/
|
|
46
48
|
export interface VincentJWTPayload extends JWTPayload {
|
|
47
49
|
pkp: IRelayPKP;
|
|
@@ -60,6 +62,8 @@ export interface VincentJWTPayload extends JWTPayload {
|
|
|
60
62
|
* @interface VincentJWT
|
|
61
63
|
* @extends { JWTDecoded } Extends the payload provided by the JWTDecoded type from `did-jwt` with Vincent-specific properties
|
|
62
64
|
* @property {VincentJWTPayload} payload - The payload of the JWT
|
|
65
|
+
*
|
|
66
|
+
* @category Interfaces
|
|
63
67
|
*/
|
|
64
68
|
export interface VincentJWT extends JWTDecoded {
|
|
65
69
|
payload: VincentJWTPayload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/jwt/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrD,UAAU,UAAU;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,eAAe,CAAC;IAC3B,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,GAAG,EAAE;QACH,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/jwt/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrD,UAAU,UAAU;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,eAAe,CAAC;IAC3B,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,GAAG,EAAE;QACH,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,GAAG,EAAE,SAAS,CAAC;IACf,GAAG,EAAE;QACH,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,OAAO,EAAE,iBAAiB,CAAC;CAC5B"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { getVincentToolClient } from './vincentToolClient';
|
|
1
|
+
export { generateVincentToolSessionSigs, getVincentToolClient } from './vincentToolClient';
|
|
2
|
+
export { type VincentToolClient, type ToolClientContext, type ToolResponse, type ToolResponseSuccess, type ToolResponseSuccessNoResult, type ToolResponseFailure, type ToolResponseFailureNoResult, type RemoteVincentToolExecutionResult, type BaseToolContext, } from './types';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toolClient/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toolClient/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EACrC,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVincentToolClient = void 0;
|
|
3
|
+
exports.getVincentToolClient = exports.generateVincentToolSessionSigs = void 0;
|
|
4
4
|
var vincentToolClient_1 = require("./vincentToolClient");
|
|
5
|
+
Object.defineProperty(exports, "generateVincentToolSessionSigs", { enumerable: true, get: function () { return vincentToolClient_1.generateVincentToolSessionSigs; } });
|
|
5
6
|
Object.defineProperty(exports, "getVincentToolClient", { enumerable: true, get: function () { return vincentToolClient_1.getVincentToolClient; } });
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/toolClient/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/toolClient/index.ts"],"names":[],"mappings":";;;AAAA,yDAA2F;AAAlF,mIAAA,8BAA8B,OAAA;AAAE,yHAAA,oBAAoB,OAAA"}
|
|
@@ -1,32 +1,79 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { BaseToolContext, PolicyEvaluationResultContext } from '@lit-protocol/vincent-tool-sdk';
|
|
3
|
+
export { type BaseToolContext };
|
|
4
|
+
/**
|
|
5
|
+
* The Vincent Tool Client is used to interact with Vincent tools.
|
|
6
|
+
*
|
|
7
|
+
* - Precheck tool parameters and policies
|
|
8
|
+
* - Execute tools remotely
|
|
9
|
+
*
|
|
10
|
+
* @typeParam ToolParamsSchema {@removeTypeParameterCompletely}
|
|
11
|
+
* @typeParam PoliciesByPackageName {@removeTypeParameterCompletely}
|
|
12
|
+
* @typeParam ExecuteSuccessSchema {@removeTypeParameterCompletely}
|
|
13
|
+
* @typeParam ExecuteFailSchema {@removeTypeParameterCompletely}
|
|
14
|
+
* @typeParam PrecheckSuccessSchema {@removeTypeParameterCompletely}
|
|
15
|
+
* @typeParam PrecheckFailSchema {@removeTypeParameterCompletely}
|
|
16
|
+
*
|
|
17
|
+
* @category Interfaces
|
|
18
|
+
*/
|
|
19
|
+
export interface VincentToolClient<ToolParamsSchema extends z.ZodType, PoliciesByPackageName extends Record<string, any>, ExecuteSuccessSchema extends z.ZodType = z.ZodUndefined, ExecuteFailSchema extends z.ZodType = z.ZodUndefined, PrecheckSuccessSchema extends z.ZodType = z.ZodUndefined, PrecheckFailSchema extends z.ZodType = z.ZodUndefined> {
|
|
20
|
+
/**
|
|
21
|
+
* Performs a precheck of the tool parameters and policies.
|
|
22
|
+
*
|
|
23
|
+
* This method validates the tool parameters and checks if the policies allow the tool to be executed.
|
|
24
|
+
*
|
|
25
|
+
* @param rawToolParams - The parameters to be passed to the tool
|
|
26
|
+
* @param context - The context for the tool execution, including the delegator PKP Ethereum address
|
|
27
|
+
* @returns A promise that resolves to a ToolResponse containing the precheck result
|
|
28
|
+
*/
|
|
29
|
+
precheck(rawToolParams: z.infer<ToolParamsSchema>, context: ToolClientContext & {
|
|
30
|
+
rpcUrl?: string;
|
|
31
|
+
}): Promise<ToolResponse<PrecheckSuccessSchema, PrecheckFailSchema, PoliciesByPackageName>>;
|
|
32
|
+
/**
|
|
33
|
+
* Executes the tool with the given parameters.
|
|
34
|
+
*
|
|
35
|
+
* This method validates the tool parameters, executes the tool remotely, and returns the result.
|
|
36
|
+
*
|
|
37
|
+
* @param rawToolParams - The parameters to be passed to the tool
|
|
38
|
+
* @param context - The context for the tool execution, including the delegator PKP Ethereum address
|
|
39
|
+
* @returns A promise that resolves to a ToolResponse containing the execution result
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
execute(rawToolParams: z.infer<ToolParamsSchema>, context: ToolClientContext): Promise<ToolResponse<ExecuteSuccessSchema, ExecuteFailSchema, PoliciesByPackageName>>;
|
|
43
|
+
}
|
|
44
|
+
/** @category Interfaces */
|
|
3
45
|
export interface ToolResponseSuccess<Result, Policies extends Record<string, any>> {
|
|
4
46
|
success: true;
|
|
5
47
|
result: Result;
|
|
6
48
|
context?: BaseToolContext<PolicyEvaluationResultContext<Policies>>;
|
|
7
49
|
}
|
|
50
|
+
/** @category Interfaces */
|
|
8
51
|
export interface ToolResponseSuccessNoResult<Policies extends Record<string, any>> {
|
|
9
52
|
success: true;
|
|
10
53
|
result?: never;
|
|
11
54
|
context?: BaseToolContext<PolicyEvaluationResultContext<Policies>>;
|
|
12
55
|
}
|
|
56
|
+
/** @category Interfaces */
|
|
13
57
|
export interface ToolResponseFailure<Result, Policies extends Record<string, any>> {
|
|
14
58
|
success: false;
|
|
15
59
|
error?: string;
|
|
16
60
|
result: Result;
|
|
17
61
|
context?: BaseToolContext<PolicyEvaluationResultContext<Policies>>;
|
|
18
62
|
}
|
|
63
|
+
/** @category Interfaces */
|
|
19
64
|
export interface ToolResponseFailureNoResult<Policies extends Record<string, any>> {
|
|
20
65
|
success: false;
|
|
21
66
|
error?: string;
|
|
22
67
|
result?: never;
|
|
23
68
|
context?: BaseToolContext<PolicyEvaluationResultContext<Policies>>;
|
|
24
69
|
}
|
|
70
|
+
/** @category Interfaces */
|
|
25
71
|
export type ToolResponse<SuccessSchema extends z.ZodType | undefined, FailSchema extends z.ZodType | undefined, Policies extends Record<string, any>> = (SuccessSchema extends z.ZodType ? ToolResponseSuccess<z.infer<SuccessSchema>, Policies> : ToolResponseSuccessNoResult<Policies>) | (FailSchema extends z.ZodType ? ToolResponseFailure<z.infer<FailSchema>, Policies> : ToolResponseFailureNoResult<Policies>);
|
|
26
72
|
export interface RemoteVincentToolExecutionResult<SuccessSchema extends z.ZodType | undefined, FailSchema extends z.ZodType | undefined, Policies extends Record<string, any>> {
|
|
27
73
|
toolExecutionResult: ToolResponse<SuccessSchema, FailSchema, Policies>;
|
|
28
74
|
toolContext: BaseToolContext<PolicyEvaluationResultContext<Policies>>;
|
|
29
75
|
}
|
|
76
|
+
/** @category Interfaces */
|
|
30
77
|
export interface ToolClientContext {
|
|
31
78
|
delegatorPkpEthAddress: string;
|
|
32
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/toolClient/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC9B,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,mBAAmB,CAAC,MAAM,EAAE,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC/E,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,2BAA2B,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC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,CAAC,QAAQ,CAAC,CAAC,CAAC;CACpE;AAED,2BAA2B;AAC3B,MAAM,MAAM,YAAY,CACtB,aAAa,SAAS,CAAC,CAAC,OAAO,GAAG,SAAS,EAC3C,UAAU,SAAS,CAAC,CAAC,OAAO,GAAG,SAAS,EACxC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAElC,CAAC,aAAa,SAAS,CAAC,CAAC,OAAO,GAC5B,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,GACrD,2BAA2B,CAAC,QAAQ,CAAC,CAAC,GAC1C,CAAC,UAAU,SAAS,CAAC,CAAC,OAAO,GACzB,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,GAClD,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE/C,MAAM,WAAW,gCAAgC,CAC/C,aAAa,SAAS,CAAC,CAAC,OAAO,GAAG,SAAS,EAC3C,UAAU,SAAS,CAAC,CAAC,OAAO,GAAG,SAAS,EACxC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAEpC,mBAAmB,EAAE,YAAY,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACvE,WAAW,EAAE,eAAe,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC,CAAC;CACvE;AAED,2BAA2B;AAC3B,MAAM,WAAW,iBAAiB;IAChC,sBAAsB,EAAE,MAAM,CAAC;CAChC"}
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
+
import type { LitNodeClient } from '@lit-protocol/lit-node-client';
|
|
3
4
|
import type { VincentTool, BundledVincentTool } from '@lit-protocol/vincent-tool-sdk';
|
|
4
5
|
import { type ToolPolicyMap } from '@lit-protocol/vincent-tool-sdk/internal';
|
|
5
|
-
import { type
|
|
6
|
+
import { type VincentToolClient } from './types';
|
|
7
|
+
export declare const generateVincentToolSessionSigs: ({ litNodeClient, ethersSigner, }: {
|
|
8
|
+
litNodeClient: LitNodeClient;
|
|
9
|
+
ethersSigner: ethers.Signer;
|
|
10
|
+
}) => Promise<import("@lit-protocol/types").SessionSigsMap>;
|
|
11
|
+
/** A VincentToolClient provides a type-safe interface for executing tools, for both `precheck()`
|
|
12
|
+
* and `execute()` functionality.
|
|
13
|
+
*
|
|
14
|
+
* @typeParam IpfsCid {@removeTypeParameterCompletely}
|
|
15
|
+
* @typeParam ToolParamsSchema {@removeTypeParameterCompletely}
|
|
16
|
+
* @typeParam PkgNames {@removeTypeParameterCompletely}
|
|
17
|
+
* @typeParam PolicyMap {@removeTypeParameterCompletely}
|
|
18
|
+
* @typeParam PoliciesByPackageName {@removeTypeParameterCompletely}
|
|
19
|
+
* @typeParam ExecuteSuccessSchema {@removeTypeParameterCompletely}
|
|
20
|
+
* @typeParam ExecuteFailSchema {@removeTypeParameterCompletely}
|
|
21
|
+
* @typeParam PrecheckSuccessSchema {@removeTypeParameterCompletely}
|
|
22
|
+
* @typeParam PrecheckFailSchema {@removeTypeParameterCompletely}
|
|
23
|
+
*
|
|
24
|
+
* @param params
|
|
25
|
+
* @param {ethers.Signer} params.ethersSigner - An ethers signer that has been configured with your delegatee key
|
|
26
|
+
*
|
|
27
|
+
* @category API Methods
|
|
28
|
+
* */
|
|
6
29
|
export declare function getVincentToolClient<const IpfsCid extends string, ToolParamsSchema extends z.ZodType, PkgNames extends string, PolicyMap extends ToolPolicyMap<any, PkgNames>, PoliciesByPackageName extends PolicyMap['policyByPackageName'], ExecuteSuccessSchema extends z.ZodType = z.ZodUndefined, ExecuteFailSchema extends z.ZodType = z.ZodUndefined, PrecheckSuccessSchema extends z.ZodType = z.ZodUndefined, PrecheckFailSchema extends z.ZodType = z.ZodUndefined>(params: {
|
|
7
30
|
bundledVincentTool: BundledVincentTool<VincentTool<ToolParamsSchema, PkgNames, PolicyMap, PoliciesByPackageName, ExecuteSuccessSchema, ExecuteFailSchema, PrecheckSuccessSchema, PrecheckFailSchema, any, any>, IpfsCid>;
|
|
8
31
|
ethersSigner: ethers.Signer;
|
|
9
|
-
}):
|
|
10
|
-
precheck(rawToolParams: z.infer<ToolParamsSchema>, { rpcUrl, delegatorPkpEthAddress, }: ToolClientContext & {
|
|
11
|
-
rpcUrl?: string;
|
|
12
|
-
}): Promise<ToolResponse<PrecheckSuccessSchema, PrecheckFailSchema, PoliciesByPackageName>>;
|
|
13
|
-
execute(rawToolParams: z.infer<ToolParamsSchema>, context: ToolClientContext): Promise<ToolResponse<ExecuteSuccessSchema, ExecuteFailSchema, PoliciesByPackageName>>;
|
|
14
|
-
};
|
|
32
|
+
}): VincentToolClient<ToolParamsSchema, PoliciesByPackageName, ExecuteSuccessSchema, ExecuteFailSchema, PrecheckSuccessSchema, PrecheckFailSchema>;
|
|
15
33
|
//# sourceMappingURL=vincentToolClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vincentToolClient.d.ts","sourceRoot":"","sources":["../../../src/toolClient/vincentToolClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"vincentToolClient.d.ts","sourceRoot":"","sources":["../../../src/toolClient/vincentToolClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EACV,WAAW,EAGX,kBAAkB,EAEnB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,yCAAyC,CAAC;AA8BjD,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAC;AAKjB,eAAO,MAAM,8BAA8B,GAAU,kCAGlD;IACD,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC;CAC7B,0DAyBA,CAAC;AAmMF;;;;;;;;;;;;;;;;;KAiBK;AACL,wBAAgB,oBAAoB,CAClC,KAAK,CAAC,OAAO,SAAS,MAAM,EAC5B,gBAAgB,SAAS,CAAC,CAAC,OAAO,EAClC,QAAQ,SAAS,MAAM,EACvB,SAAS,SAAS,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,EAC9C,qBAAqB,SAAS,SAAS,CAAC,qBAAqB,CAAC,EAC9D,oBAAoB,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,YAAY,EACvD,iBAAiB,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,YAAY,EACpD,qBAAqB,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,YAAY,EACxD,kBAAkB,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,YAAY,EACrD,MAAM,EAAE;IACR,kBAAkB,EAAE,kBAAkB,CACpC,WAAW,CACT,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,GAAG,EACH,GAAG,CACJ,EACD,OAAO,CACR,CAAC;IACF,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC;CAC7B,GAAG,iBAAiB,CACnB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,CACnB,CA8MA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// src/toolClient/vincentToolClient.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.generateVincentToolSessionSigs = void 0;
|
|
4
5
|
exports.getVincentToolClient = getVincentToolClient;
|
|
5
6
|
const tslib_1 = require("tslib");
|
|
6
7
|
const zod_1 = require("zod");
|
|
@@ -12,7 +13,7 @@ const getLitNodeClient_1 = require("../internal/LitNodeClient/getLitNodeClient")
|
|
|
12
13
|
const resultCreators_1 = require("./resultCreators");
|
|
13
14
|
const typeGuards_1 = require("./typeGuards");
|
|
14
15
|
const util = tslib_1.__importStar(require("node:util"));
|
|
15
|
-
const
|
|
16
|
+
const generateVincentToolSessionSigs = async ({ litNodeClient, ethersSigner, }) => {
|
|
16
17
|
return litNodeClient.getSessionSigs({
|
|
17
18
|
chain: 'ethereum',
|
|
18
19
|
resourceAbilityRequests: [
|
|
@@ -36,6 +37,7 @@ const generateSessionSigs = async ({ litNodeClient, ethersSigner, }) => {
|
|
|
36
37
|
},
|
|
37
38
|
});
|
|
38
39
|
};
|
|
40
|
+
exports.generateVincentToolSessionSigs = generateVincentToolSessionSigs;
|
|
39
41
|
async function runToolPolicyPrechecks(params) {
|
|
40
42
|
var _a, _b;
|
|
41
43
|
const { bundledVincentTool: { vincentTool, ipfsCid }, toolParams, context, policies, } = params;
|
|
@@ -112,6 +114,24 @@ async function runToolPolicyPrechecks(params) {
|
|
|
112
114
|
policiesContext,
|
|
113
115
|
};
|
|
114
116
|
}
|
|
117
|
+
/** A VincentToolClient provides a type-safe interface for executing tools, for both `precheck()`
|
|
118
|
+
* and `execute()` functionality.
|
|
119
|
+
*
|
|
120
|
+
* @typeParam IpfsCid {@removeTypeParameterCompletely}
|
|
121
|
+
* @typeParam ToolParamsSchema {@removeTypeParameterCompletely}
|
|
122
|
+
* @typeParam PkgNames {@removeTypeParameterCompletely}
|
|
123
|
+
* @typeParam PolicyMap {@removeTypeParameterCompletely}
|
|
124
|
+
* @typeParam PoliciesByPackageName {@removeTypeParameterCompletely}
|
|
125
|
+
* @typeParam ExecuteSuccessSchema {@removeTypeParameterCompletely}
|
|
126
|
+
* @typeParam ExecuteFailSchema {@removeTypeParameterCompletely}
|
|
127
|
+
* @typeParam PrecheckSuccessSchema {@removeTypeParameterCompletely}
|
|
128
|
+
* @typeParam PrecheckFailSchema {@removeTypeParameterCompletely}
|
|
129
|
+
*
|
|
130
|
+
* @param params
|
|
131
|
+
* @param {ethers.Signer} params.ethersSigner - An ethers signer that has been configured with your delegatee key
|
|
132
|
+
*
|
|
133
|
+
* @category API Methods
|
|
134
|
+
* */
|
|
115
135
|
function getVincentToolClient(params) {
|
|
116
136
|
var _a, _b;
|
|
117
137
|
const { bundledVincentTool, ethersSigner } = params;
|
|
@@ -193,7 +213,7 @@ function getVincentToolClient(params) {
|
|
|
193
213
|
};
|
|
194
214
|
}
|
|
195
215
|
const litNodeClient = await (0, getLitNodeClient_1.getLitNodeClientInstance)({ network });
|
|
196
|
-
const sessionSigs = await
|
|
216
|
+
const sessionSigs = await (0, exports.generateVincentToolSessionSigs)({ ethersSigner, litNodeClient });
|
|
197
217
|
const result = await litNodeClient.executeJs({
|
|
198
218
|
ipfsId: ipfsCid,
|
|
199
219
|
sessionSigs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vincentToolClient.js","sourceRoot":"","sources":["../../../src/toolClient/vincentToolClient.ts"],"names":[],"mappings":";AAAA,sCAAsC
|
|
1
|
+
{"version":3,"file":"vincentToolClient.js","sourceRoot":"","sources":["../../../src/toolClient/vincentToolClient.ts"],"names":[],"mappings":";AAAA,sCAAsC;;;AAyTtC,oDAgPC;;AAviBD,6BAAwB;AAExB,mCAAgC;AAEhC,6DAKoC;AAEpC,uDAAmE;AAkBnE,sEAeiD;AAEjD,iFAAsF;AAEtF,qDAO0B;AAS1B,6CAAyF;AACzF,wDAAkC;AAE3B,MAAM,8BAA8B,GAAG,KAAK,EAAE,EACnD,aAAa,EACb,YAAY,GAIb,EAAE,EAAE;IACH,OAAO,aAAa,CAAC,cAAc,CAAC;QAClC,KAAK,EAAE,UAAU;QACjB,uBAAuB,EAAE;YACvB,EAAE,QAAQ,EAAE,IAAI,6BAA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6D;YAC7D,MAAM,aAAa,GAAG,IAAA,yBAAc,EAClC,eAAe,CAAC,MAAM,EACtB,WAAW,EACX,SAAS,EACT,QAAQ,CACT,CAAC;YAEF,IAAI,IAAA,kCAAqB,EAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,OAAO,IAAA,0CAAyB,EAAC;oBAC/B,MAAM,EAAE,aAAa,CAAC,MAAM;oBAC5B,GAAG,aAAa;oBAChB,OAAO,EAAE,IAAI,CAAC,WAAW;iBAC1B,CAAiF,CAAC;YACrF,CAAC;YAED,MAAM,GAAG,GAA6C,aAAa,CAAC;YAEpE,OAAO,IAAA,0CAAyB,EAAC;gBAC/B,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,IAAI,CAAC,WAAW;aAC1B,CAAiF,CAAC;QACrF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { JWTConfig, VincentJWT, VincentJWTPayload } from './jwt/types';
|
|
2
2
|
export type { VincentWebAppClient, VincentAppClientConfig, RedirectToVincentConsentPageParams, } from './app/types';
|
|
3
|
+
export type { BaseToolContext } from './toolClient';
|
|
3
4
|
export type { ExpressAuthHelpers } from './express-authentication-middleware/types';
|
|
4
5
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract interaction utilities for Vincent MCP
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for interacting with the Vincent Diamond contract
|
|
5
|
+
* on the Lit Network. It includes constants, contract ABIs, and functions for
|
|
6
|
+
* fetching data from the contract.
|
|
7
|
+
*
|
|
8
|
+
* @module contracts
|
|
9
|
+
* @category Vincent MCP
|
|
10
|
+
*/
|
|
11
|
+
import { LIT_NETWORK } from '@lit-protocol/constants';
|
|
12
|
+
import { ethers } from 'ethers';
|
|
13
|
+
/**
|
|
14
|
+
* RPC endpoint for interacting with the Lit Network Contracts in Yellowstone
|
|
15
|
+
*/
|
|
16
|
+
export declare const rpc: "https://yellowstone-rpc.litprotocol.com";
|
|
17
|
+
/**
|
|
18
|
+
* Type representing the supported network for Vincent MCP
|
|
19
|
+
* Currently only supports the Datil network
|
|
20
|
+
*/
|
|
21
|
+
export type Network = typeof LIT_NETWORK.Datil;
|
|
22
|
+
export declare const PUBKEY_ROUTER_ABI: readonly ["function getEthAddress(uint256 tokenId) public view returns (address)", "function getPubkey(uint256 tokenId) public view returns (bytes memory)"];
|
|
23
|
+
export declare const APP_VIEW_ABI: readonly ["function getAppVersion(\n uint256 tokenId,\n uint256 version\n ) view returns (\n (\n uint256 id,\n string name,\n string description,\n bool isDeleted,\n uint8 deploymentStatus,\n address manager,\n uint256 latestVersion,\n address[] delegatees,\n string[] authorizedRedirectUris\n ) app,\n (\n uint256 version,\n bool enabled,\n uint256[] delegatedAgentPkpTokenIds,\n (\n string toolIpfsCid,\n (\n string policyIpfsCid,\n string[] parameterNames,\n uint8[] parameterTypes\n )[] policies\n )[] tools\n ) appVersion\n )"];
|
|
24
|
+
/**
|
|
25
|
+
* ABIs for different facets of the Vincent Diamond contract
|
|
26
|
+
* Each facet provides specific functionality of the contract
|
|
27
|
+
*/
|
|
28
|
+
export declare const FACET_ABIS: {
|
|
29
|
+
AppView: readonly ["function getAppVersion(\n uint256 tokenId,\n uint256 version\n ) view returns (\n (\n uint256 id,\n string name,\n string description,\n bool isDeleted,\n uint8 deploymentStatus,\n address manager,\n uint256 latestVersion,\n address[] delegatees,\n string[] authorizedRedirectUris\n ) app,\n (\n uint256 version,\n bool enabled,\n uint256[] delegatedAgentPkpTokenIds,\n (\n string toolIpfsCid,\n (\n string policyIpfsCid,\n string[] parameterNames,\n uint8[] parameterTypes\n )[] policies\n )[] tools\n ) appVersion\n )"];
|
|
30
|
+
PubKeyRouter: readonly ["function getEthAddress(uint256 tokenId) public view returns (address)", "function getPubkey(uint256 tokenId) public view returns (bytes memory)"];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Type representing the available facets of the Vincent Diamond contract
|
|
34
|
+
* Used to specify which facet to interact with
|
|
35
|
+
*/
|
|
36
|
+
export type ContractFacet = keyof typeof FACET_ABIS;
|
|
37
|
+
/**
|
|
38
|
+
* Mapping of network to Vincent Diamond contract address
|
|
39
|
+
* Used to interact with the correct contract based on the network
|
|
40
|
+
*/
|
|
41
|
+
export declare const VINCENT_ADDRESSES: Record<Network, Record<ContractFacet, string>>;
|
|
42
|
+
/**
|
|
43
|
+
* Get a contract instance for a specific facet of the Vincent Diamond
|
|
44
|
+
* @param network The network to connect to
|
|
45
|
+
* @param facet The contract facet to use
|
|
46
|
+
* @returns A contract instance for the specified facet
|
|
47
|
+
*/
|
|
48
|
+
export declare function getContract(network: Network, facet: ContractFacet): ethers.Contract;
|
|
49
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/utils/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAW,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,GAAG,2CAAgC,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,WAAW,CAAC,KAAK,CAAC;AAE/C,eAAO,MAAM,iBAAiB,8JAGpB,CAAC;AAEX,eAAO,MAAM,YAAY,wtBA8Bf,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,UAAU;;;CAGtB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,UAAU,CAAC;AAUpD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAKnE,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,mBAKjE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Contract interaction utilities for Vincent MCP
|
|
4
|
+
*
|
|
5
|
+
* This module provides utilities for interacting with the Vincent Diamond contract
|
|
6
|
+
* on the Lit Network. It includes constants, contract ABIs, and functions for
|
|
7
|
+
* fetching data from the contract.
|
|
8
|
+
*
|
|
9
|
+
* @module contracts
|
|
10
|
+
* @category Vincent MCP
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.VINCENT_ADDRESSES = exports.FACET_ABIS = exports.APP_VIEW_ABI = exports.PUBKEY_ROUTER_ABI = exports.rpc = void 0;
|
|
14
|
+
exports.getContract = getContract;
|
|
15
|
+
const constants_1 = require("@lit-protocol/constants");
|
|
16
|
+
const ethers_1 = require("ethers");
|
|
17
|
+
/**
|
|
18
|
+
* RPC endpoint for interacting with the Lit Network Contracts in Yellowstone
|
|
19
|
+
*/
|
|
20
|
+
exports.rpc = constants_1.LIT_RPC.CHRONICLE_YELLOWSTONE;
|
|
21
|
+
exports.PUBKEY_ROUTER_ABI = [
|
|
22
|
+
'function getEthAddress(uint256 tokenId) public view returns (address)',
|
|
23
|
+
'function getPubkey(uint256 tokenId) public view returns (bytes memory)',
|
|
24
|
+
];
|
|
25
|
+
exports.APP_VIEW_ABI = [
|
|
26
|
+
`function getAppVersion(
|
|
27
|
+
uint256 tokenId,
|
|
28
|
+
uint256 version
|
|
29
|
+
) view returns (
|
|
30
|
+
(
|
|
31
|
+
uint256 id,
|
|
32
|
+
string name,
|
|
33
|
+
string description,
|
|
34
|
+
bool isDeleted,
|
|
35
|
+
uint8 deploymentStatus,
|
|
36
|
+
address manager,
|
|
37
|
+
uint256 latestVersion,
|
|
38
|
+
address[] delegatees,
|
|
39
|
+
string[] authorizedRedirectUris
|
|
40
|
+
) app,
|
|
41
|
+
(
|
|
42
|
+
uint256 version,
|
|
43
|
+
bool enabled,
|
|
44
|
+
uint256[] delegatedAgentPkpTokenIds,
|
|
45
|
+
(
|
|
46
|
+
string toolIpfsCid,
|
|
47
|
+
(
|
|
48
|
+
string policyIpfsCid,
|
|
49
|
+
string[] parameterNames,
|
|
50
|
+
uint8[] parameterTypes
|
|
51
|
+
)[] policies
|
|
52
|
+
)[] tools
|
|
53
|
+
) appVersion
|
|
54
|
+
)`,
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* ABIs for different facets of the Vincent Diamond contract
|
|
58
|
+
* Each facet provides specific functionality of the contract
|
|
59
|
+
*/
|
|
60
|
+
exports.FACET_ABIS = {
|
|
61
|
+
AppView: exports.APP_VIEW_ABI,
|
|
62
|
+
PubKeyRouter: exports.PUBKEY_ROUTER_ABI,
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Vincent diamond address. This is the main address that redirects to any other contract involved in Vincent system
|
|
66
|
+
* If included in the diamond, the contract should be accessed through it to guarantee the last version is being used
|
|
67
|
+
*/
|
|
68
|
+
const VINCENT_DIAMOND_ADDRESSES = {
|
|
69
|
+
[constants_1.LIT_NETWORK.Datil]: '0x78Cd1d270Ff12BA55e98BDff1f3646426E25D932',
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Mapping of network to Vincent Diamond contract address
|
|
73
|
+
* Used to interact with the correct contract based on the network
|
|
74
|
+
*/
|
|
75
|
+
exports.VINCENT_ADDRESSES = {
|
|
76
|
+
[constants_1.LIT_NETWORK.Datil]: {
|
|
77
|
+
AppView: VINCENT_DIAMOND_ADDRESSES.datil,
|
|
78
|
+
PubKeyRouter: '0xF182d6bEf16Ba77e69372dD096D8B70Bc3d5B475',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Get a contract instance for a specific facet of the Vincent Diamond
|
|
83
|
+
* @param network The network to connect to
|
|
84
|
+
* @param facet The contract facet to use
|
|
85
|
+
* @returns A contract instance for the specified facet
|
|
86
|
+
*/
|
|
87
|
+
function getContract(network, facet) {
|
|
88
|
+
const abi = exports.FACET_ABIS[facet];
|
|
89
|
+
const provider = new ethers_1.ethers.providers.JsonRpcProvider(exports.rpc);
|
|
90
|
+
return new ethers_1.ethers.Contract(exports.VINCENT_ADDRESSES[network][facet], abi, provider);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/utils/contracts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AA6FH,kCAKC;AAhGD,uDAA+D;AAC/D,mCAAgC;AAEhC;;GAEG;AACU,QAAA,GAAG,GAAG,mBAAO,CAAC,qBAAqB,CAAC;AAQpC,QAAA,iBAAiB,GAAG;IAC/B,uEAAuE;IACvE,wEAAwE;CAChE,CAAC;AAEE,QAAA,YAAY,GAAG;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4BI;CACI,CAAC;AAEX;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,OAAO,EAAE,oBAAY;IACrB,YAAY,EAAE,yBAAiB;CAChC,CAAC;AAQF;;;GAGG;AACH,MAAM,yBAAyB,GAAG;IAChC,CAAC,uBAAW,CAAC,KAAK,CAAC,EAAE,4CAA4C;CACzD,CAAC;AAEX;;;GAGG;AACU,QAAA,iBAAiB,GAAmD;IAC/E,CAAC,uBAAW,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,EAAE,yBAAyB,CAAC,KAAK;QACxC,YAAY,EAAE,4CAA4C;KAC3D;CACO,CAAC;AAEX;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,OAAgB,EAAE,KAAoB;IAChE,MAAM,GAAG,GAAG,kBAAU,CAAC,KAAK,CAAC,CAAC;IAE9B,MAAM,QAAQ,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC,eAAe,CAAC,WAAG,CAAC,CAAC;IAC3D,OAAO,IAAI,eAAM,CAAC,QAAQ,CAAC,yBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Fetches the delegated agent PKP token IDs for a specific app version
|
|
4
|
+
*
|
|
5
|
+
* This function queries the Vincent AppView contract to get the PKP token IDs
|
|
6
|
+
* that have delegated to a specific app version. These token IDs can be used
|
|
7
|
+
* to identify the PKPs that are authorized to act as agents for the app.
|
|
8
|
+
*
|
|
9
|
+
* @param appId - The ID of the Vincent application
|
|
10
|
+
* @param version - The version number of the application
|
|
11
|
+
* @returns An array of BigNumber representing the delegated agent PKP token IDs
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const tokenIds = await fetchDelegatedAgentPKPTokenIds(123, 1);
|
|
16
|
+
* console.log(`App has ${tokenIds.length} delegated agent PKPs`);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchDelegatedAgentPKPTokenIds(appId: number, version: number): Promise<ethers.BigNumber[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves PKP information for all delegators of a specific app version
|
|
22
|
+
*
|
|
23
|
+
* This function fetches the delegated agent PKP token IDs for a given app version
|
|
24
|
+
* and then retrieves detailed PKP information for each token ID. This information
|
|
25
|
+
* can be used to identify and interact with the PKPs that are authorized as agents
|
|
26
|
+
* for the application.
|
|
27
|
+
*
|
|
28
|
+
* @param appId - The ID of the Vincent application
|
|
29
|
+
* @param appVersion - The version number of the application
|
|
30
|
+
* @returns An array of PKP information objects containing tokenId, ethAddress, and publicKey
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const pkpInfoArray = await getDelegatorsAgentPkpInfo(123, 1);
|
|
35
|
+
* console.log(`Found ${pkpInfoArray.length} delegator PKPs`);
|
|
36
|
+
* console.log(`First PKP address: ${pkpInfoArray[0].ethAddress}`);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function getDelegatorsAgentPkpInfo(appId: number, appVersion: number): Promise<{
|
|
40
|
+
tokenId: string;
|
|
41
|
+
ethAddress: string;
|
|
42
|
+
publicKey: string;
|
|
43
|
+
}[]>;
|
|
44
|
+
//# sourceMappingURL=delegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../../src/utils/delegation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOhC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,8BAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,+BASlF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;;;;KAShF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchDelegatedAgentPKPTokenIds = fetchDelegatedAgentPKPTokenIds;
|
|
4
|
+
exports.getDelegatorsAgentPkpInfo = getDelegatorsAgentPkpInfo;
|
|
5
|
+
const constants_1 = require("@lit-protocol/constants");
|
|
6
|
+
const contracts_1 = require("./contracts");
|
|
7
|
+
const pkp_1 = require("./pkp");
|
|
8
|
+
/**
|
|
9
|
+
* Fetches the delegated agent PKP token IDs for a specific app version
|
|
10
|
+
*
|
|
11
|
+
* This function queries the Vincent AppView contract to get the PKP token IDs
|
|
12
|
+
* that have delegated to a specific app version. These token IDs can be used
|
|
13
|
+
* to identify the PKPs that are authorized to act as agents for the app.
|
|
14
|
+
*
|
|
15
|
+
* @param appId - The ID of the Vincent application
|
|
16
|
+
* @param version - The version number of the application
|
|
17
|
+
* @returns An array of BigNumber representing the delegated agent PKP token IDs
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const tokenIds = await fetchDelegatedAgentPKPTokenIds(123, 1);
|
|
22
|
+
* console.log(`App has ${tokenIds.length} delegated agent PKPs`);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async function fetchDelegatedAgentPKPTokenIds(appId, version) {
|
|
26
|
+
try {
|
|
27
|
+
const contract = (0, contracts_1.getContract)(constants_1.LIT_NETWORK.Datil, 'AppView');
|
|
28
|
+
const appView = await contract.getAppVersion(appId, version);
|
|
29
|
+
return appView.appVersion.delegatedAgentPkpTokenIds;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
throw new Error(`Error fetching delegated agent PKP token IDs: ${error}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves PKP information for all delegators of a specific app version
|
|
37
|
+
*
|
|
38
|
+
* This function fetches the delegated agent PKP token IDs for a given app version
|
|
39
|
+
* and then retrieves detailed PKP information for each token ID. This information
|
|
40
|
+
* can be used to identify and interact with the PKPs that are authorized as agents
|
|
41
|
+
* for the application.
|
|
42
|
+
*
|
|
43
|
+
* @param appId - The ID of the Vincent application
|
|
44
|
+
* @param appVersion - The version number of the application
|
|
45
|
+
* @returns An array of PKP information objects containing tokenId, ethAddress, and publicKey
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const pkpInfoArray = await getDelegatorsAgentPkpInfo(123, 1);
|
|
50
|
+
* console.log(`Found ${pkpInfoArray.length} delegator PKPs`);
|
|
51
|
+
* console.log(`First PKP address: ${pkpInfoArray[0].ethAddress}`);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
async function getDelegatorsAgentPkpInfo(appId, appVersion) {
|
|
55
|
+
try {
|
|
56
|
+
const delegators = await fetchDelegatedAgentPKPTokenIds(appId, appVersion);
|
|
57
|
+
const delegatorsPkpInfo = await Promise.all(delegators.map(pkp_1.getPkpInfo));
|
|
58
|
+
return delegatorsPkpInfo;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw new Error(`Error fetching delegators agent PKP info: ${error}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=delegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../../src/utils/delegation.ts"],"names":[],"mappings":";;AAwBA,wEASC;AAqBD,8DASC;AA7DD,uDAAsD;AAEtD,2CAA0C;AAC1C,+BAAmC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,8BAA8B,CAAC,KAAa,EAAE,OAAe;IACjF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,uBAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,UAAU,CAAC,yBAA+C,CAAC;IAC5E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iDAAiD,KAAK,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,UAAU,yBAAyB,CAAC,KAAa,EAAE,UAAkB;IAC/E,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,8BAA8B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC3E,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,gBAAU,CAAC,CAAC,CAAC;QAExE,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDelegatorsAgentPkpInfo = exports.fetchDelegatedAgentPKPTokenIds = void 0;
|
|
4
|
+
const delegation_1 = require("./delegation");
|
|
5
|
+
Object.defineProperty(exports, "fetchDelegatedAgentPKPTokenIds", { enumerable: true, get: function () { return delegation_1.fetchDelegatedAgentPKPTokenIds; } });
|
|
6
|
+
Object.defineProperty(exports, "getDelegatorsAgentPkpInfo", { enumerable: true, get: function () { return delegation_1.getDelegatorsAgentPkpInfo; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyF;AAEhF,+GAFA,2CAA8B,OAEA;AAAE,0GAFA,sCAAyB,OAEA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves information about a PKP token
|
|
4
|
+
*
|
|
5
|
+
* This function queries the PKP Router contract to get the Ethereum address
|
|
6
|
+
* and public key associated with a PKP token ID.
|
|
7
|
+
*
|
|
8
|
+
* @param pkpTokenId - The PKP token ID as ethers.BigNumber
|
|
9
|
+
* @returns An object containing the token ID (as a hex string), Ethereum address, and public key
|
|
10
|
+
*/
|
|
11
|
+
export declare function getPkpInfo(pkpTokenId: ethers.BigNumber): Promise<{
|
|
12
|
+
tokenId: string;
|
|
13
|
+
ethAddress: string;
|
|
14
|
+
publicKey: string;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=pkp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkp.d.ts","sourceRoot":"","sources":["../../../src/utils/pkp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAaD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPkpInfo = getPkpInfo;
|
|
4
|
+
const constants_1 = require("@lit-protocol/constants");
|
|
5
|
+
const contracts_1 = require("./contracts");
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves information about a PKP token
|
|
8
|
+
*
|
|
9
|
+
* This function queries the PKP Router contract to get the Ethereum address
|
|
10
|
+
* and public key associated with a PKP token ID.
|
|
11
|
+
*
|
|
12
|
+
* @param pkpTokenId - The PKP token ID as ethers.BigNumber
|
|
13
|
+
* @returns An object containing the token ID (as a hex string), Ethereum address, and public key
|
|
14
|
+
*/
|
|
15
|
+
async function getPkpInfo(pkpTokenId) {
|
|
16
|
+
const pubkeyRouter = (0, contracts_1.getContract)(constants_1.LIT_NETWORK.Datil, 'PubKeyRouter');
|
|
17
|
+
const [ethAddress, publicKey] = await Promise.all([
|
|
18
|
+
pubkeyRouter.getEthAddress(pkpTokenId),
|
|
19
|
+
pubkeyRouter.getPubkey(pkpTokenId),
|
|
20
|
+
]);
|
|
21
|
+
return {
|
|
22
|
+
tokenId: pkpTokenId.toHexString(),
|
|
23
|
+
ethAddress,
|
|
24
|
+
publicKey,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=pkp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkp.js","sourceRoot":"","sources":["../../../src/utils/pkp.ts"],"names":[],"mappings":";;AAeA,gCAiBC;AA9BD,uDAAsD;AAEtD,2CAA0C;AAE1C;;;;;;;;GAQG;AACI,KAAK,UAAU,UAAU,CAAC,UAA4B;IAK3D,MAAM,YAAY,GAAG,IAAA,uBAAW,EAAC,uBAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAEpE,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChD,YAAY,CAAC,aAAa,CAAC,UAAU,CAAC;QACtC,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC;KACnC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,UAAU,CAAC,WAAW,EAAE;QACjC,UAAU;QACV,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-app-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-mcp1",
|
|
4
4
|
"description": "Vincent SDK for browser and backend",
|
|
5
5
|
"author": "Lit Protocol",
|
|
6
6
|
"license": "ISC",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"ethers": "5.8.0",
|
|
29
29
|
"tslib": "^2.8.1",
|
|
30
30
|
"zod": "3.25.64",
|
|
31
|
-
"@lit-protocol/vincent-tool-sdk": "1.0.
|
|
31
|
+
"@lit-protocol/vincent-tool-sdk": "1.0.1"
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|
|
34
34
|
"files": [
|