@prosopo/account 2.8.63 → 2.8.65

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,5 +1,5 @@
1
1
 
2
- > @prosopo/account@2.8.63 build:cjs
2
+ > @prosopo/account@2.8.65 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -29,38 +29,20 @@ ViteCommonJSConfig: .
29
29
  '@prosopo/keyring'
30
30
  ]
31
31
  }
32
- vite v6.4.1 building SSR bundle for production...
32
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
33
+ vite v8.1.5 building ssr environment for production...
33
34
  Bundle build started
34
- transforming...
35
- ../../node_modules/@polkadot/x-randomvalues/node_modules/@polkadot/x-global/index.js (9:23): A comment
36
-
37
- "/*#__PURE__*/"
38
-
39
- in "../../node_modules/@polkadot/x-randomvalues/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
40
- ../../node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global/index.js (9:23): A comment
41
-
42
- "/*#__PURE__*/"
43
-
44
- in "../../node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
45
- ../../node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global/index.js (9:23): A comment
46
-
47
- "/*#__PURE__*/"
48
-
49
- in "../../node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
50
- ../../node_modules/@polkadot/util/node_modules/@polkadot/x-global/index.js (9:23): A comment
51
-
52
- "/*#__PURE__*/"
53
-
54
- in "../../node_modules/@polkadot/util/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
55
- Build end
56
- ✓ 6 modules transformed.
57
- Entry module "src/extension/ExtensionWeb2.ts" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
58
- Entry module "src/extension/ExtensionWeb3.ts" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
35
+ [plugin rolldown:vite-resolve] Module "node:module" has been externalized for browser compatibility, imported by "/home/runner/work/captcha/captcha/packages/util-crypto/dist/_virtual/_rolldown/runtime.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
36
+ 
37
+ ✓ 7 modules transformed.
59
38
  rendering chunks...
60
- dist/cjs/extension/Extension.cjs  0.14 kB
61
- dist/cjs/index.cjs  0.42 kB
62
- dist/cjs/extension/ExtensionWeb3.cjs  1.31 kB
63
- dist/cjs/extension/ExtensionWeb2.cjs  3.93 kB
64
- dist/cjs/workers/CryptoWorkerManager.cjs  4.14 kB
65
- dist/cjs/workers/cryptoWorker.cjs 51.55 kB
66
- ✓ built in 1.70s
39
+ computing gzip size...
40
+ dist/cjs/extension/Extension.cjs 0.15 kB │ gzip: 0.12 kB
41
+ dist/cjs/index.cjs 0.45 kB │ gzip: 0.18 kB
42
+ dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
43
+ dist/cjs/extension/ExtensionWeb3.cjs 1.27 kB │ gzip: 0.56 kB
44
+ dist/cjs/extension/ExtensionWeb2.cjs 2.73 kB │ gzip: 0.93 kB
45
+ dist/cjs/workers/CryptoWorkerManager.cjs 4.01 kB │ gzip: 1.53 kB
46
+ dist/cjs/workers/cryptoWorker.cjs 50.31 kB │ gzip: 22.50 kB
47
+
48
+ ✓ built in 81ms
@@ -1,17 +1,17 @@
1
1
 
2
- > @prosopo/account@2.8.63 build:tsc
2
+ > @prosopo/account@2.8.65 build:tsc
3
3
  > npm run typecheck && npm run build
4
4
 
5
5
 
6
- > @prosopo/account@2.8.63 typecheck
6
+ > @prosopo/account@2.8.65 typecheck
7
7
  > tsc --project tsconfig.types.json
8
8
 
9
9
 
10
- > @prosopo/account@2.8.63 build
10
+ > @prosopo/account@2.8.65 build
11
11
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
12
12
 
13
13
 
14
- > @prosopo/account@2.8.63 build:cross-env
14
+ > @prosopo/account@2.8.65 build:cross-env
15
15
  > vite build --config vite.esm.config.ts --mode production
16
16
 
17
17
  ViteEsmConfig: .
@@ -41,36 +41,19 @@ ViteEsmConfig: .
41
41
  '@prosopo/keyring'
42
42
  ]
43
43
  }
44
- vite v6.4.1 building SSR bundle for production...
44
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
45
+ vite v8.1.5 building ssr environment for production...
45
46
  Bundle build started
46
- transforming...
47
- ../../node_modules/@polkadot/x-randomvalues/node_modules/@polkadot/x-global/index.js (9:23): A comment
48
-
49
- "/*#__PURE__*/"
50
-
51
- in "../../node_modules/@polkadot/x-randomvalues/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
52
- ../../node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global/index.js (9:23): A comment
53
-
54
- "/*#__PURE__*/"
55
-
56
- in "../../node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
57
- ../../node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global/index.js (9:23): A comment
58
-
59
- "/*#__PURE__*/"
60
-
61
- in "../../node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
62
- ../../node_modules/@polkadot/util/node_modules/@polkadot/x-global/index.js (9:23): A comment
63
-
64
- "/*#__PURE__*/"
65
-
66
- in "../../node_modules/@polkadot/util/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
67
- Build end
68
- ✓ 6 modules transformed.
47
+ 
48
+ ✓ 7 modules transformed.
69
49
  rendering chunks...
70
- dist/extension/Extension.js  0.04 kB
71
- dist/index.js  0.24 kB
72
- dist/extension/ExtensionWeb3.js  1.11 kB
73
- dist/extension/ExtensionWeb2.js  2.53 kB
74
- dist/workers/CryptoWorkerManager.js  4.00 kB
75
- dist/workers/cryptoWorker.js 51.55 kB
76
- ✓ built in 1.41s
50
+ computing gzip size...
51
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
52
+ dist/extension/Extension.js 0.14 kB │ gzip: 0.12 kB
53
+ dist/index.js 0.27 kB │ gzip: 0.12 kB
54
+ dist/extension/ExtensionWeb3.js 1.10 kB │ gzip: 0.53 kB
55
+ dist/extension/ExtensionWeb2.js 2.12 kB │ gzip: 0.81 kB
56
+ dist/workers/CryptoWorkerManager.js 3.93 kB │ gzip: 1.52 kB
57
+ dist/workers/cryptoWorker.js 50.48 kB │ gzip: 22.53 kB
58
+
59
+ ✓ built in 97ms
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/account@2.8.63 build
2
+ > @prosopo/account@2.8.65 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/account@2.8.63 build:cross-env
6
+ > @prosopo/account@2.8.65 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -33,36 +33,20 @@ ViteEsmConfig: .
33
33
  '@prosopo/keyring'
34
34
  ]
35
35
  }
36
- vite v6.4.1 building SSR bundle for production...
36
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
37
+ vite v8.1.5 building ssr environment for production...
37
38
  Bundle build started
38
- transforming...
39
- ../../node_modules/@polkadot/x-randomvalues/node_modules/@polkadot/x-global/index.js (9:23): A comment
40
-
41
- "/*#__PURE__*/"
42
-
43
- in "../../node_modules/@polkadot/x-randomvalues/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
44
- ../../node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global/index.js (9:23): A comment
45
-
46
- "/*#__PURE__*/"
47
-
48
- in "../../node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
49
- ../../node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global/index.js (9:23): A comment
50
-
51
- "/*#__PURE__*/"
52
-
53
- in "../../node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
54
- ../../node_modules/@polkadot/util/node_modules/@polkadot/x-global/index.js (9:23): A comment
55
-
56
- "/*#__PURE__*/"
57
-
58
- in "../../node_modules/@polkadot/util/node_modules/@polkadot/x-global/index.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
59
- Build end
60
- ✓ 6 modules transformed.
39
+ [plugin rolldown:vite-resolve] Module "node:module" has been externalized for browser compatibility, imported by "/home/runner/work/captcha/captcha/packages/util-crypto/dist/_virtual/_rolldown/runtime.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
40
+ 
41
+ ✓ 7 modules transformed.
61
42
  rendering chunks...
62
- dist/extension/Extension.js  0.04 kB
63
- dist/index.js  0.24 kB
64
- dist/extension/ExtensionWeb3.js  1.11 kB
65
- dist/extension/ExtensionWeb2.js  2.53 kB
66
- dist/workers/CryptoWorkerManager.js  4.00 kB
67
- dist/workers/cryptoWorker.js 51.54 kB
68
- ✓ built in 1.77s
43
+ computing gzip size...
44
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
45
+ dist/extension/Extension.js 0.14 kB │ gzip: 0.12 kB
46
+ dist/index.js 0.27 kB │ gzip: 0.12 kB
47
+ dist/extension/ExtensionWeb3.js 1.10 kB │ gzip: 0.53 kB
48
+ dist/extension/ExtensionWeb2.js 2.12 kB │ gzip: 0.81 kB
49
+ dist/workers/CryptoWorkerManager.js 3.93 kB │ gzip: 1.52 kB
50
+ dist/workers/cryptoWorker.js 50.31 kB │ gzip: 22.51 kB
51
+
52
+ ✓ built in 131ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @prosopo/account
2
2
 
3
+ ## 2.8.65
4
+ ### Patch Changes
5
+
6
+ - Updated dependencies [71a5952]
7
+ - @prosopo/keyring@2.9.62
8
+
9
+ ## 2.8.64
10
+ ### Patch Changes
11
+
12
+ - e14fce6: chore(deps): bump vite to 6.4.3 and mongoose to 8.24.1, and adjust types for the mongoose 8.24 Document/ObjectId changes
13
+ - Updated dependencies [2c47bb7]
14
+ - Updated dependencies [0e1171c]
15
+ - Updated dependencies [103318c]
16
+ - Updated dependencies [270a8d8]
17
+ - Updated dependencies [e14fce6]
18
+ - @prosopo/util@3.3.5
19
+ - @prosopo/types@4.10.0
20
+ - @prosopo/common@3.1.48
21
+ - @prosopo/fingerprint@2.7.19
22
+ - @prosopo/keyring@2.9.61
23
+
3
24
  ## 2.8.63
4
25
  ### Patch Changes
5
26
 
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+ //#endregion
3
+ export {};
@@ -0,0 +1,23 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ exports.__toESM = __toESM;
@@ -1,5 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- class Extension {
4
- }
1
+ //#region src/extension/Extension.ts
2
+ /**
3
+ * Class to interface with accounts.
4
+ */
5
+ var Extension = class {};
6
+ //#endregion
5
7
  exports.Extension = Extension;
@@ -1,95 +1,82 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_Extension = require("./Extension.cjs");
3
+ const require_CryptoWorkerManager = require("../workers/CryptoWorkerManager.cjs");
4
+ let _polkadot_extension_base_page_Signer = require("@polkadot/extension-base/page/Signer");
5
+ _polkadot_extension_base_page_Signer = require_runtime.__toESM(_polkadot_extension_base_page_Signer, 1);
6
+ let _polkadot_util = require("@polkadot/util");
7
+ let _prosopo_fingerprint = require("@prosopo/fingerprint");
8
+ let _prosopo_keyring = require("@prosopo/keyring");
9
+ let _prosopo_util = require("@prosopo/util");
10
+ let _prosopo_util_crypto = require("@prosopo/util-crypto");
11
+ //#region src/extension/ExtensionWeb2.ts
12
+ (0, _prosopo_fingerprint.prefetchFingerprint)();
13
+ require_CryptoWorkerManager.getCryptoWorkerManager().prewarm();
14
+ var EntropyToMnemonicLoader = async () => (await import("@prosopo/util-crypto")).entropyToMnemonic;
15
+ /**
16
+ * Class for interfacing with web3 accounts.
17
+ */
18
+ var ExtensionWeb2 = class extends require_Extension.Extension {
19
+ async getAccount(config) {
20
+ const account = await this.createAccount(config);
21
+ return {
22
+ account,
23
+ extension: this.createExtension(account)
24
+ };
25
+ }
26
+ createExtension(account) {
27
+ const signer = new _polkadot_extension_base_page_Signer.default(async () => {});
28
+ signer.signRaw = async (payload) => {
29
+ const signature = account.keypair.sign(payload.data);
30
+ return {
31
+ id: 1,
32
+ signature: (0, _prosopo_util.u8aToHex)(signature)
33
+ };
34
+ };
35
+ return {
36
+ accounts: {
37
+ get: async () => {
38
+ return [account];
39
+ },
40
+ subscribe: () => {
41
+ return () => {};
42
+ }
43
+ },
44
+ name: "procaptcha-web2",
45
+ version: _prosopo_util.version,
46
+ signer
47
+ };
48
+ }
49
+ async createAccount(config) {
50
+ const browserEntropy = await (0, _prosopo_fingerprint.getFingerprint)();
51
+ const entropy = (0, _prosopo_util_crypto.hexHash)(browserEntropy, 128).slice(2);
52
+ const u8Entropy = (0, _polkadot_util.stringToU8a)(entropy);
53
+ const type = "sr25519";
54
+ const keyring = new _prosopo_keyring.Keyring({ type });
55
+ const workerManager = require_CryptoWorkerManager.getCryptoWorkerManager();
56
+ try {
57
+ const { publicKey, secretKey } = await workerManager.entropyToKeypair(u8Entropy);
58
+ const keypair = keyring.addFromPair({
59
+ publicKey,
60
+ secretKey
61
+ }, {}, type);
62
+ const address = keypair.address;
63
+ return {
64
+ address,
65
+ name: address,
66
+ keypair
67
+ };
68
+ } catch (workerError) {
69
+ const mnemonic = (await EntropyToMnemonicLoader())(u8Entropy);
70
+ const keypair = keyring.addFromMnemonic(mnemonic);
71
+ const address = keypair.address;
72
+ return {
73
+ address,
74
+ name: address,
75
+ keypair
76
+ };
77
+ }
78
+ }
15
79
  };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
25
- const Signer = require("@polkadot/extension-base/page/Signer");
26
- const util$1 = require("@polkadot/util");
27
- const fingerprint = require("@prosopo/fingerprint");
28
- const keyring = require("@prosopo/keyring");
29
- const util = require("@prosopo/util");
30
- const utilCrypto = require("@prosopo/util-crypto");
31
- const CryptoWorkerManager = require("../workers/CryptoWorkerManager.cjs");
32
- const Extension = require("./Extension.cjs");
33
- fingerprint.prefetchFingerprint();
34
- CryptoWorkerManager.getCryptoWorkerManager().prewarm();
35
- const EntropyToMnemonicLoader = async () => (await import("@prosopo/util-crypto")).entropyToMnemonic;
36
- class ExtensionWeb2 extends Extension.Extension {
37
- async getAccount(config) {
38
- const account = await this.createAccount(config);
39
- const extension = this.createExtension(account);
40
- return {
41
- account,
42
- extension
43
- };
44
- }
45
- createExtension(account) {
46
- const signer = new Signer(async () => {
47
- return;
48
- });
49
- signer.signRaw = async (payload) => {
50
- const signature = account.keypair.sign(payload.data);
51
- return {
52
- id: 1,
53
- // the id of the request to sign. This should be incremented each time and adjust the signature, but we're hacking around this. Hence the signature will always be the same given the same payload.
54
- signature: util.u8aToHex(signature)
55
- };
56
- };
57
- return {
58
- accounts: {
59
- get: async () => {
60
- return [account];
61
- },
62
- subscribe: () => {
63
- return () => {
64
- return;
65
- };
66
- }
67
- },
68
- name: "procaptcha-web2",
69
- version: util.version,
70
- signer
71
- };
72
- }
73
- async createAccount(config) {
74
- const browserEntropy = await fingerprint.getFingerprint();
75
- const entropy = utilCrypto.hexHash(browserEntropy, 128).slice(2);
76
- const u8Entropy = util$1.stringToU8a(entropy);
77
- const type = "sr25519";
78
- const keyring$1 = new keyring.Keyring({ type });
79
- const workerManager = CryptoWorkerManager.getCryptoWorkerManager();
80
- try {
81
- const { publicKey, secretKey } = await workerManager.entropyToKeypair(u8Entropy);
82
- const keypair = keyring$1.addFromPair({ publicKey, secretKey }, {}, type);
83
- const address = keypair.address;
84
- return { address, name: address, keypair };
85
- } catch (workerError) {
86
- const entropyToMnemonic = await EntropyToMnemonicLoader();
87
- const mnemonic = entropyToMnemonic(u8Entropy);
88
- const keypair = keyring$1.addFromMnemonic(mnemonic);
89
- const address = keypair.address;
90
- return { address, name: address, keypair };
91
- }
92
- }
93
- }
80
+ //#endregion
94
81
  exports.ExtensionWeb2 = ExtensionWeb2;
95
82
  exports.default = ExtensionWeb2;
@@ -1,33 +1,28 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const extensionDapp = require("@polkadot/extension-dapp");
4
- const utilCrypto = require("@polkadot/util-crypto");
5
- const common = require("@prosopo/common");
6
- const Extension = require("./Extension.cjs");
7
- class ExtensionWeb3 extends Extension.Extension {
8
- async getAccount(config) {
9
- const { dappName, userAccountAddress: address } = config;
10
- if (!address) {
11
- throw new common.ProsopoError("WIDGET.NO_ACCOUNTS_FOUND", {
12
- context: { error: "No account address provided" }
13
- });
14
- }
15
- await utilCrypto.cryptoWaitReady();
16
- const extensions = await extensionDapp.web3Enable(dappName);
17
- if (extensions.length === 0) {
18
- throw new common.ProsopoError("WIDGET.NO_EXTENSION_FOUND");
19
- }
20
- for (const extension of extensions) {
21
- const accounts = await extension.accounts.get();
22
- const account = accounts.find((account2) => account2.address === address);
23
- if (account) {
24
- return { account, extension };
25
- }
26
- }
27
- throw new common.ProsopoError("WIDGET.ACCOUNT_NOT_FOUND", {
28
- context: { error: `No account found matching ${address}` }
29
- });
30
- }
31
- }
1
+ const require_Extension = require("./Extension.cjs");
2
+ let _polkadot_extension_dapp = require("@polkadot/extension-dapp");
3
+ let _polkadot_util_crypto = require("@polkadot/util-crypto");
4
+ let _prosopo_common = require("@prosopo/common");
5
+ //#region src/extension/ExtensionWeb3.ts
6
+ /**
7
+ * Class for interfacing with web3 accounts.
8
+ */
9
+ var ExtensionWeb3 = class extends require_Extension.Extension {
10
+ async getAccount(config) {
11
+ const { dappName, userAccountAddress: address } = config;
12
+ if (!address) throw new _prosopo_common.ProsopoError("WIDGET.NO_ACCOUNTS_FOUND", { context: { error: "No account address provided" } });
13
+ await (0, _polkadot_util_crypto.cryptoWaitReady)();
14
+ const extensions = await (0, _polkadot_extension_dapp.web3Enable)(dappName);
15
+ if (extensions.length === 0) throw new _prosopo_common.ProsopoError("WIDGET.NO_EXTENSION_FOUND");
16
+ for (const extension of extensions) {
17
+ const account = (await extension.accounts.get()).find((account) => account.address === address);
18
+ if (account) return {
19
+ account,
20
+ extension
21
+ };
22
+ }
23
+ throw new _prosopo_common.ProsopoError("WIDGET.ACCOUNT_NOT_FOUND", { context: { error: `No account found matching ${address}` } });
24
+ }
25
+ };
26
+ //#endregion
32
27
  exports.ExtensionWeb3 = ExtensionWeb3;
33
28
  exports.default = ExtensionWeb3;
@@ -1,8 +1,7 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Extension = require("./extension/Extension.cjs");
4
- const ExtensionWeb2 = require("./extension/ExtensionWeb2.cjs");
5
- const ExtensionWeb3 = require("./extension/ExtensionWeb3.cjs");
6
- exports.Extension = Extension.Extension;
7
- exports.ExtensionWeb2 = ExtensionWeb2.ExtensionWeb2;
8
- exports.ExtensionWeb3 = ExtensionWeb3.ExtensionWeb3;
2
+ const require_Extension = require("./extension/Extension.cjs");
3
+ const require_ExtensionWeb2 = require("./extension/ExtensionWeb2.cjs");
4
+ const require_ExtensionWeb3 = require("./extension/ExtensionWeb3.cjs");
5
+ exports.Extension = require_Extension.Extension;
6
+ exports.ExtensionWeb2 = require_ExtensionWeb2.ExtensionWeb2;
7
+ exports.ExtensionWeb3 = require_ExtensionWeb3.ExtensionWeb3;