@lit-protocol/vincent-app-sdk 1.0.1-mcp1 → 1.0.1-mcp3

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.
@@ -18,27 +18,23 @@ import { ethers } from 'ethers';
18
18
  */
19
19
  export declare function fetchDelegatedAgentPKPTokenIds(appId: number, version: number): Promise<ethers.BigNumber[]>;
20
20
  /**
21
- * Retrieves PKP information for all delegators of a specific app version
21
+ * Retrieves PKP Eth addresses for all delegators of a specific app version
22
22
  *
23
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
24
+ * and then retrieves the PKP Eth address for each token ID. This information
25
25
  * can be used to identify and interact with the PKPs that are authorized as agents
26
26
  * for the application.
27
27
  *
28
28
  * @param appId - The ID of the Vincent application
29
29
  * @param appVersion - The version number of the application
30
- * @returns An array of PKP information objects containing tokenId, ethAddress, and publicKey
30
+ * @returns An array of PKP Eth addresses
31
31
  *
32
32
  * @example
33
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}`);
34
+ * const pkpEthAddresses = await getDelegatorsAgentPkpAddresses(123, 1);
35
+ * console.log(`Found ${pkpEthAddresses.length} delegator PKPs`);
36
+ * console.log(`First PKP eth address: ${pkpEthAddresses[0]}`);
37
37
  * ```
38
38
  */
39
- export declare function getDelegatorsAgentPkpInfo(appId: number, appVersion: number): Promise<{
40
- tokenId: string;
41
- ethAddress: string;
42
- publicKey: string;
43
- }[]>;
39
+ export declare function getDelegatorsAgentPkpAddresses(appId: number, appVersion: number): Promise<string[]>;
44
40
  //# sourceMappingURL=delegation.d.ts.map
@@ -1 +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"}
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;AAgCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,8BAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBASrF"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchDelegatedAgentPKPTokenIds = fetchDelegatedAgentPKPTokenIds;
4
- exports.getDelegatorsAgentPkpInfo = getDelegatorsAgentPkpInfo;
4
+ exports.getDelegatorsAgentPkpAddresses = getDelegatorsAgentPkpAddresses;
5
5
  const constants_1 = require("@lit-protocol/constants");
6
6
  const contracts_1 = require("./contracts");
7
7
  const pkp_1 = require("./pkp");
@@ -32,30 +32,54 @@ async function fetchDelegatedAgentPKPTokenIds(appId, version) {
32
32
  throw new Error(`Error fetching delegated agent PKP token IDs: ${error}`);
33
33
  }
34
34
  }
35
+ async function processWithConcurrency(items, processFn, concurrencyLimit) {
36
+ const results = [];
37
+ let index = 0;
38
+ // Start initial set of promises
39
+ const workers = Array(concurrencyLimit)
40
+ .fill(null)
41
+ .map(async () => {
42
+ while (index < items.length) {
43
+ const currentIndex = index++;
44
+ if (currentIndex >= items.length)
45
+ break;
46
+ try {
47
+ const result = await processFn(items[currentIndex]);
48
+ results[currentIndex] = result;
49
+ }
50
+ catch (error) {
51
+ // Store the error but don't throw until all are done
52
+ results[currentIndex] = error;
53
+ }
54
+ }
55
+ });
56
+ await Promise.all(workers);
57
+ return results;
58
+ }
35
59
  /**
36
- * Retrieves PKP information for all delegators of a specific app version
60
+ * Retrieves PKP Eth addresses for all delegators of a specific app version
37
61
  *
38
62
  * 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
63
+ * and then retrieves the PKP Eth address for each token ID. This information
40
64
  * can be used to identify and interact with the PKPs that are authorized as agents
41
65
  * for the application.
42
66
  *
43
67
  * @param appId - The ID of the Vincent application
44
68
  * @param appVersion - The version number of the application
45
- * @returns An array of PKP information objects containing tokenId, ethAddress, and publicKey
69
+ * @returns An array of PKP Eth addresses
46
70
  *
47
71
  * @example
48
72
  * ```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}`);
73
+ * const pkpEthAddresses = await getDelegatorsAgentPkpAddresses(123, 1);
74
+ * console.log(`Found ${pkpEthAddresses.length} delegator PKPs`);
75
+ * console.log(`First PKP eth address: ${pkpEthAddresses[0]}`);
52
76
  * ```
53
77
  */
54
- async function getDelegatorsAgentPkpInfo(appId, appVersion) {
78
+ async function getDelegatorsAgentPkpAddresses(appId, appVersion) {
55
79
  try {
56
80
  const delegators = await fetchDelegatedAgentPKPTokenIds(appId, appVersion);
57
- const delegatorsPkpInfo = await Promise.all(delegators.map(pkp_1.getPkpInfo));
58
- return delegatorsPkpInfo;
81
+ const delegatorsPkpEthAddresses = await processWithConcurrency(delegators, pkp_1.getPkpEthAddress, 5);
82
+ return delegatorsPkpEthAddresses;
59
83
  }
60
84
  catch (error) {
61
85
  throw new Error(`Error fetching delegators agent PKP info: ${error}`);
@@ -1 +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"}
1
+ {"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../../src/utils/delegation.ts"],"names":[],"mappings":";;AAwBA,wEASC;AAmDD,wEASC;AA3FD,uDAAsD;AAEtD,2CAA0C;AAC1C,+BAAyC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,8BA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;;GAkBG;AACI,KAAK,UAAU,8BAA8B,CAAC,KAAa,EAAE,UAAkB;IACpF,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,8BAA8B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC3E,MAAM,yBAAyB,GAAG,MAAM,sBAAsB,CAAC,UAAU,EAAE,sBAAgB,EAAE,CAAC,CAAC,CAAC;QAEhG,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
@@ -1,3 +1,3 @@
1
- import { fetchDelegatedAgentPKPTokenIds, getDelegatorsAgentPkpInfo } from './delegation';
2
- export { fetchDelegatedAgentPKPTokenIds, getDelegatorsAgentPkpInfo };
1
+ import { fetchDelegatedAgentPKPTokenIds, getDelegatorsAgentPkpAddresses } from './delegation';
2
+ export { fetchDelegatedAgentPKPTokenIds, getDelegatorsAgentPkpAddresses };
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAE9F,OAAO,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDelegatorsAgentPkpInfo = exports.fetchDelegatedAgentPKPTokenIds = void 0;
3
+ exports.getDelegatorsAgentPkpAddresses = exports.fetchDelegatedAgentPKPTokenIds = void 0;
4
4
  const delegation_1 = require("./delegation");
5
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; } });
6
+ Object.defineProperty(exports, "getDelegatorsAgentPkpAddresses", { enumerable: true, get: function () { return delegation_1.getDelegatorsAgentPkpAddresses; } });
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,6CAA8F;AAErF,+GAFA,2CAA8B,OAEA;AAAE,+GAFA,2CAA8B,OAEA"}
@@ -1,16 +1,12 @@
1
1
  import { ethers } from 'ethers';
2
2
  /**
3
- * Retrieves information about a PKP token
3
+ * Retrieves PKP Eth Address
4
4
  *
5
5
  * This function queries the PKP Router contract to get the Ethereum address
6
- * and public key associated with a PKP token ID.
6
+ * associated with a PKP token ID.
7
7
  *
8
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
9
+ * @returns The PKP Eth address
10
10
  */
11
- export declare function getPkpInfo(pkpTokenId: ethers.BigNumber): Promise<{
12
- tokenId: string;
13
- ethAddress: string;
14
- publicKey: string;
15
- }>;
11
+ export declare function getPkpEthAddress(pkpTokenId: ethers.BigNumber): Promise<string>;
16
12
  //# sourceMappingURL=pkp.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"pkp.d.ts","sourceRoot":"","sources":["../../../src/utils/pkp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAIpF"}
@@ -1,27 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPkpInfo = getPkpInfo;
3
+ exports.getPkpEthAddress = getPkpEthAddress;
4
4
  const constants_1 = require("@lit-protocol/constants");
5
5
  const contracts_1 = require("./contracts");
6
6
  /**
7
- * Retrieves information about a PKP token
7
+ * Retrieves PKP Eth Address
8
8
  *
9
9
  * This function queries the PKP Router contract to get the Ethereum address
10
- * and public key associated with a PKP token ID.
10
+ * associated with a PKP token ID.
11
11
  *
12
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
13
+ * @returns The PKP Eth address
14
14
  */
15
- async function getPkpInfo(pkpTokenId) {
15
+ async function getPkpEthAddress(pkpTokenId) {
16
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
- };
17
+ return await pubkeyRouter.getEthAddress(pkpTokenId);
26
18
  }
27
19
  //# sourceMappingURL=pkp.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"pkp.js","sourceRoot":"","sources":["../../../src/utils/pkp.ts"],"names":[],"mappings":";;AAcA,4CAIC;AAlBD,uDAAsD;AAGtD,2CAA0C;AAE1C;;;;;;;;GAQG;AACI,KAAK,UAAU,gBAAgB,CAAC,UAA4B;IACjE,MAAM,YAAY,GAAG,IAAA,uBAAW,EAAC,uBAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAEpE,OAAO,MAAM,YAAY,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACtD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lit-protocol/vincent-app-sdk",
3
- "version": "1.0.1-mcp1",
3
+ "version": "1.0.1-mcp3",
4
4
  "description": "Vincent SDK for browser and backend",
5
5
  "author": "Lit Protocol",
6
6
  "license": "ISC",