@beclab/olaresid 0.1.1 → 0.1.2

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.
Files changed (87) hide show
  1. package/CLI.md +1300 -0
  2. package/README.md +37 -31
  3. package/TAG.md +589 -0
  4. package/dist/abi/RootResolver2ABI.d.ts +54 -0
  5. package/dist/abi/RootResolver2ABI.d.ts.map +1 -0
  6. package/dist/abi/RootResolver2ABI.js +240 -0
  7. package/dist/abi/RootResolver2ABI.js.map +1 -0
  8. package/dist/business/index.d.ts +302 -0
  9. package/dist/business/index.d.ts.map +1 -0
  10. package/dist/business/index.js +1209 -0
  11. package/dist/business/index.js.map +1 -0
  12. package/dist/business/tag-context.d.ts +219 -0
  13. package/dist/business/tag-context.d.ts.map +1 -0
  14. package/dist/business/tag-context.js +537 -0
  15. package/dist/business/tag-context.js.map +1 -0
  16. package/dist/cli.js +2085 -39
  17. package/dist/cli.js.map +1 -1
  18. package/dist/debug.d.ts.map +1 -1
  19. package/dist/debug.js +14 -2
  20. package/dist/debug.js.map +1 -1
  21. package/dist/index.d.ts +50 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +229 -9
  24. package/dist/index.js.map +1 -1
  25. package/dist/utils/crypto-utils.d.ts +130 -0
  26. package/dist/utils/crypto-utils.d.ts.map +1 -0
  27. package/dist/utils/crypto-utils.js +402 -0
  28. package/dist/utils/crypto-utils.js.map +1 -0
  29. package/dist/utils/error-parser.d.ts +35 -0
  30. package/dist/utils/error-parser.d.ts.map +1 -0
  31. package/dist/utils/error-parser.js +202 -0
  32. package/dist/utils/error-parser.js.map +1 -0
  33. package/dist/utils/tag-abi-codec.d.ts +69 -0
  34. package/dist/utils/tag-abi-codec.d.ts.map +1 -0
  35. package/dist/utils/tag-abi-codec.js +144 -0
  36. package/dist/utils/tag-abi-codec.js.map +1 -0
  37. package/dist/utils/tag-type-builder.d.ts +158 -0
  38. package/dist/utils/tag-type-builder.d.ts.map +1 -0
  39. package/dist/utils/tag-type-builder.js +410 -0
  40. package/dist/utils/tag-type-builder.js.map +1 -0
  41. package/examples/crypto-utilities.ts +140 -0
  42. package/examples/domain-context.ts +80 -0
  43. package/examples/generate-mnemonic.ts +149 -0
  44. package/examples/index.ts +1 -1
  45. package/examples/ip.ts +171 -0
  46. package/examples/legacy.ts +10 -10
  47. package/examples/list-wallets.ts +81 -0
  48. package/examples/quasar-demo/.eslintrc.js +23 -0
  49. package/examples/quasar-demo/.quasar/app.js +43 -0
  50. package/examples/quasar-demo/.quasar/client-entry.js +38 -0
  51. package/examples/quasar-demo/.quasar/client-prefetch.js +130 -0
  52. package/examples/quasar-demo/.quasar/quasar-user-options.js +16 -0
  53. package/examples/quasar-demo/README.md +49 -0
  54. package/examples/quasar-demo/index.html +11 -0
  55. package/examples/quasar-demo/package-lock.json +6407 -0
  56. package/examples/quasar-demo/package.json +36 -0
  57. package/examples/quasar-demo/quasar.config.js +73 -0
  58. package/examples/quasar-demo/src/App.vue +13 -0
  59. package/examples/quasar-demo/src/css/app.scss +1 -0
  60. package/examples/quasar-demo/src/layouts/MainLayout.vue +21 -0
  61. package/examples/quasar-demo/src/pages/IndexPage.vue +905 -0
  62. package/examples/quasar-demo/src/router/index.ts +25 -0
  63. package/examples/quasar-demo/src/router/routes.ts +11 -0
  64. package/examples/quasar-demo/tsconfig.json +28 -0
  65. package/examples/register-subdomain.ts +152 -0
  66. package/examples/rsa-keypair.ts +148 -0
  67. package/examples/tag-builder.ts +235 -0
  68. package/examples/tag-management.ts +534 -0
  69. package/examples/tag-nested-tuple.ts +190 -0
  70. package/examples/tag-simple.ts +149 -0
  71. package/examples/tag-tagger.ts +217 -0
  72. package/examples/test-nested-tuple-conversion.ts +143 -0
  73. package/examples/test-type-bytes-parser.ts +70 -0
  74. package/examples/transfer-domain.ts +197 -0
  75. package/examples/wallet-management.ts +196 -0
  76. package/package.json +24 -15
  77. package/src/abi/RootResolver2ABI.ts +237 -0
  78. package/src/business/index.ts +1490 -0
  79. package/src/business/tag-context.ts +713 -0
  80. package/src/cli.ts +2755 -39
  81. package/src/debug.ts +17 -2
  82. package/src/index.ts +300 -14
  83. package/src/utils/crypto-utils.ts +459 -0
  84. package/src/utils/error-parser.ts +225 -0
  85. package/src/utils/tag-abi-codec.ts +158 -0
  86. package/src/utils/tag-type-builder.ts +469 -0
  87. package/tsconfig.json +1 -1
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Example: Generate mnemonic and derive keys using Trust Wallet Core
3
+ *
4
+ * This implementation is compatible with TermiPass and the entire Olares ecosystem.
5
+ * It uses Trust Wallet Core for key derivation, ensuring consistency across all projects.
6
+ */
7
+
8
+ import {
9
+ generateMnemonic,
10
+ getEthereumAddressFromMnemonic,
11
+ getDIDFromMnemonic,
12
+ generateDIDKeyData,
13
+ deriveDIDFromMnemonic
14
+ } from '../src/index';
15
+
16
+ async function example1_generateNew() {
17
+ console.log('='.repeat(60));
18
+ console.log('Example 1: Generate New Mnemonic and Keys');
19
+ console.log('Using Trust Wallet Core (Same as TermiPass)');
20
+ console.log('='.repeat(60));
21
+
22
+ // Generate a 12-word mnemonic
23
+ console.log('\n🔑 Generating 12-word mnemonic...');
24
+ const mnemonic12 = generateMnemonic(12);
25
+ console.log(`Mnemonic: ${mnemonic12}`);
26
+
27
+ console.log('\n⏳ Deriving keys using Trust Wallet Core...');
28
+ const owner12 = await getEthereumAddressFromMnemonic(mnemonic12);
29
+ const did12 = await getDIDFromMnemonic(mnemonic12);
30
+
31
+ console.log('\n✅ Derived keys:');
32
+ console.log(` Ethereum Address: ${owner12}`);
33
+ console.log(` DID: ${did12}`);
34
+
35
+ // Generate a 24-word mnemonic
36
+ console.log('\n' + '-'.repeat(60));
37
+ console.log('\n🔑 Generating 24-word mnemonic...');
38
+ const mnemonic24 = generateMnemonic(24);
39
+ console.log(`Mnemonic: ${mnemonic24}`);
40
+
41
+ console.log('\n⏳ Deriving keys...');
42
+ const owner24 = await getEthereumAddressFromMnemonic(mnemonic24);
43
+ const did24 = await getDIDFromMnemonic(mnemonic24);
44
+
45
+ console.log('\n✅ Derived keys:');
46
+ console.log(` Ethereum Address: ${owner24}`);
47
+ console.log(` DID: ${did24}`);
48
+ }
49
+
50
+ async function example2_useGenerateDIDKeyData() {
51
+ console.log('\n\n' + '='.repeat(60));
52
+ console.log('Example 2: Generate Everything at Once');
53
+ console.log('='.repeat(60));
54
+
55
+ console.log('\n⏳ Generating mnemonic and deriving keys...');
56
+ const keyData = await generateDIDKeyData(12);
57
+
58
+ console.log('\n✅ Generated DID Key Data:');
59
+ console.log(` Mnemonic: ${keyData.mnemonic}`);
60
+ console.log(` Owner (Ethereum): ${keyData.owner}`);
61
+ console.log(` DID: ${keyData.did}`);
62
+ }
63
+
64
+ async function example3_testCompatibility() {
65
+ console.log('\n\n' + '='.repeat(60));
66
+ console.log('Example 3: Verify Compatibility with TermiPass');
67
+ console.log('='.repeat(60));
68
+
69
+ // Use the same test mnemonic as in TermiPass
70
+ const testMnemonic =
71
+ 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about';
72
+
73
+ console.log(`\n📝 Input mnemonic (standard test mnemonic):`);
74
+ console.log(testMnemonic);
75
+
76
+ try {
77
+ console.log('\n⏳ Deriving keys using Trust Wallet Core...');
78
+ const { owner, did } = await deriveDIDFromMnemonic(testMnemonic);
79
+
80
+ console.log('\n✅ Derived keys:');
81
+ console.log(` Ethereum Address: ${owner}`);
82
+ console.log(` DID: ${did}`);
83
+
84
+ console.log('\n💡 Note: These keys should match with TermiPass output');
85
+ console.log(
86
+ ' You can verify this by running the same mnemonic in TermiPass'
87
+ );
88
+ } catch (error: any) {
89
+ console.error(`\n❌ Error: ${error.message}`);
90
+ }
91
+ }
92
+
93
+ async function example4_parallelDerivation() {
94
+ console.log('\n\n' + '='.repeat(60));
95
+ console.log('Example 4: Parallel Key Derivation (Performance Test)');
96
+ console.log('='.repeat(60));
97
+
98
+ const mnemonic = generateMnemonic(12);
99
+ console.log(`\n📝 Mnemonic: ${mnemonic}`);
100
+
101
+ console.log('\n⏳ Deriving owner and DID in parallel...');
102
+ const startTime = Date.now();
103
+
104
+ const { owner, did } = await deriveDIDFromMnemonic(mnemonic);
105
+
106
+ const endTime = Date.now();
107
+ const duration = endTime - startTime;
108
+
109
+ console.log('\n✅ Results:');
110
+ console.log(` Owner: ${owner}`);
111
+ console.log(` DID: ${did}`);
112
+ console.log(` Time taken: ${duration}ms`);
113
+ }
114
+
115
+ async function main() {
116
+ console.log('🔐 Trust Wallet Core Integration - Key Generation Examples\n');
117
+ console.log('This implementation ensures compatibility with TermiPass');
118
+ console.log('and the entire Olares ecosystem.\n');
119
+
120
+ try {
121
+ await example1_generateNew();
122
+ await example2_useGenerateDIDKeyData();
123
+ await example3_testCompatibility();
124
+ await example4_parallelDerivation();
125
+
126
+ console.log('\n\n' + '='.repeat(60));
127
+ console.log('✅ All examples completed successfully!');
128
+ console.log('='.repeat(60));
129
+ console.log(
130
+ '\n⚠️ SECURITY WARNING: Never share your mnemonic phrase!'
131
+ );
132
+ console.log(
133
+ ' Store it securely and never commit it to version control.'
134
+ );
135
+ console.log(
136
+ '\n💡 These keys are compatible with TermiPass and other Olares tools.\n'
137
+ );
138
+ } catch (error: any) {
139
+ console.error('\n❌ Error:', error.message || error);
140
+ if (error.stack) {
141
+ console.error('\nStack trace:');
142
+ console.error(error.stack);
143
+ }
144
+ process.exit(1);
145
+ }
146
+ }
147
+
148
+ // Run the examples
149
+ main();
package/examples/index.ts CHANGED
@@ -6,7 +6,7 @@ async function main() {
6
6
  const domain = await olaresId.fetchDomain('tw7613781.olares.com');
7
7
  console.log(domain);
8
8
 
9
- // 获取所有域名数据 (主网上数据量较大,测试网数据量较小,测试的话建议在测试网环境下体验此函数)
9
+ // Get all domain data (the mainnet has a large amount of data, the testnet has a small amount of data, for testing it is recommended to experience this function in the testnet environment)
10
10
  // await olaresId.fetchAll();
11
11
  // console.log('All Domains:', olaresId.allDomainCache);
12
12
  // console.log('Domain Tree Cache:', olaresId.treesCache);
package/examples/ip.ts ADDED
@@ -0,0 +1,171 @@
1
+ import OlaresID, { ipv4ToBytes4, bytes4ToIpv4 } from '../src/index';
2
+
3
+ async function main() {
4
+ console.log('='.repeat(60));
5
+ console.log('Testing DNS A Record (IP) Methods');
6
+ console.log('='.repeat(60));
7
+
8
+ // Test 1: Convert IPv4 to bytes4
9
+ console.log('\n🔄 Test 1: ipv4ToBytes4()');
10
+ console.log('-'.repeat(60));
11
+ try {
12
+ const testIPs = [
13
+ '127.0.0.1',
14
+ '192.168.1.1',
15
+ '8.8.8.8',
16
+ '255.255.255.255'
17
+ ];
18
+
19
+ for (const ip of testIPs) {
20
+ const bytes4 = ipv4ToBytes4(ip);
21
+ console.log(` ${ip} → ${bytes4}`);
22
+ }
23
+ console.log('✅ Successfully converted IPv4 to bytes4');
24
+ } catch (error) {
25
+ console.error('❌ Failed:', error);
26
+ }
27
+
28
+ // Test 2: Convert bytes4 to IPv4
29
+ console.log('\n🔄 Test 2: bytes4ToIpv4()');
30
+ console.log('-'.repeat(60));
31
+ try {
32
+ const testBytes = [
33
+ '0x7f000001',
34
+ '0xc0a80101',
35
+ '0x08080808',
36
+ '0xffffffff'
37
+ ];
38
+
39
+ for (const bytes of testBytes) {
40
+ const ip = bytes4ToIpv4(bytes);
41
+ console.log(` ${bytes} → ${ip}`);
42
+ }
43
+ console.log('✅ Successfully converted bytes4 to IPv4');
44
+ } catch (error) {
45
+ console.error('❌ Failed:', error);
46
+ }
47
+
48
+ // Test 3: Round-trip conversion
49
+ console.log('\n🔄 Test 3: Round-trip conversion');
50
+ console.log('-'.repeat(60));
51
+ try {
52
+ const originalIP = '192.168.1.100';
53
+ const bytes4 = ipv4ToBytes4(originalIP);
54
+ const convertedIP = bytes4ToIpv4(bytes4);
55
+
56
+ console.log(` Original: ${originalIP}`);
57
+ console.log(` Bytes4: ${bytes4}`);
58
+ console.log(` Converted: ${convertedIP}`);
59
+
60
+ if (originalIP === convertedIP) {
61
+ console.log('✅ Round-trip conversion successful!');
62
+ } else {
63
+ console.log('⚠️ Round-trip conversion mismatch');
64
+ }
65
+ } catch (error) {
66
+ console.error('❌ Failed:', error);
67
+ }
68
+
69
+ // Test 4: Blockchain operations
70
+ if (process.env.PRIVATE_KEY_OR_MNEMONIC) {
71
+ console.log('\n📝 Test 4: setIP()');
72
+ console.log('-'.repeat(60));
73
+
74
+ const didConsole = OlaresID.createTestnet();
75
+ await didConsole.setSigner(process.env.PRIVATE_KEY_OR_MNEMONIC);
76
+
77
+ const testDomain = '1.com';
78
+ const domain = didConsole.domain(testDomain);
79
+ const testIP = '192.168.1.100';
80
+
81
+ try {
82
+ const result = await domain.setIP(testIP);
83
+
84
+ if (result.success) {
85
+ console.log('✅ Success:');
86
+ console.log(' Transaction Hash:', result.transactionHash);
87
+ console.log(' Gas Used:', result.gasUsed?.toString());
88
+
89
+ // Wait for the blockchain to index the data
90
+ console.log('⏳ Waiting for blockchain to index data...');
91
+ await new Promise((resolve) => setTimeout(resolve, 5000));
92
+ } else {
93
+ console.log('❌ Failed:', result.error);
94
+ }
95
+ } catch (error) {
96
+ console.error('❌ Failed:', error);
97
+ }
98
+
99
+ // Test 5: Verify IP was set
100
+ console.log('\n🔍 Test 5: getIP()');
101
+ console.log('-'.repeat(60));
102
+ try {
103
+ const storedIP = await domain.getIP();
104
+ if (storedIP) {
105
+ console.log('✅ DNS A Record found on chain:', storedIP);
106
+
107
+ if (storedIP === testIP) {
108
+ console.log('✅ Stored IP matches our original IP!');
109
+ } else {
110
+ console.log('⚠️ Stored IP differs from original');
111
+ console.log(' Expected:', testIP);
112
+ console.log(' Got:', storedIP);
113
+ }
114
+ } else {
115
+ console.log('❌ No DNS A Record found');
116
+ }
117
+ } catch (error) {
118
+ console.error('❌ Failed:', error);
119
+ }
120
+
121
+ // Test 6: Remove IP
122
+ console.log('\n🗑️ Test 6: removeIP()');
123
+ console.log('-'.repeat(60));
124
+ try {
125
+ const removeResult = await domain.removeIP();
126
+
127
+ if (removeResult.success) {
128
+ console.log('✅ Success:');
129
+ console.log(
130
+ ' Transaction Hash:',
131
+ removeResult.transactionHash
132
+ );
133
+ console.log(' Gas Used:', removeResult.gasUsed?.toString());
134
+
135
+ // Wait for the blockchain to index the data
136
+ console.log('⏳ Waiting for blockchain to index data...');
137
+ await new Promise((resolve) => setTimeout(resolve, 5000));
138
+ } else {
139
+ console.log('❌ Failed:', removeResult.error);
140
+ }
141
+ } catch (error) {
142
+ console.error('❌ Failed:', error);
143
+ }
144
+
145
+ // Test 7: Verify IP was removed
146
+ console.log('\n🔍 Test 7: Verify IP after removal');
147
+ console.log('-'.repeat(60));
148
+ try {
149
+ const removedIP = await domain.getIP();
150
+ if (removedIP) {
151
+ console.log('❌ DNS A Record still exists:', removedIP);
152
+ } else {
153
+ console.log('✅ DNS A Record successfully removed');
154
+ }
155
+ } catch (error) {
156
+ console.error('❌ Failed:', error);
157
+ }
158
+
159
+ didConsole.clearSigner();
160
+ } else {
161
+ console.log(
162
+ '\n⚠️ Skipping blockchain tests (no PRIVATE_KEY_OR_MNEMONIC provided)'
163
+ );
164
+ }
165
+
166
+ console.log('\n' + '='.repeat(60));
167
+ console.log('✅ All tests completed!');
168
+ console.log('='.repeat(60));
169
+ }
170
+
171
+ main().catch(console.error);
@@ -1,16 +1,16 @@
1
1
  import DID from '../src/index';
2
2
 
3
- // op sepolia 测试网环境
3
+ // op sepolia testnet environment
4
4
  const RPC = 'https://sepolia.optimism.io';
5
- const CONTRACT_DID = '0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8'; // DID 合约地址
6
- const CONTRACT_ROOT_RESOLVER = '0xeF727cb066Fee98F88Db84555830063b4A24ddfc'; // RootResolver 合约地址
7
- const CONTRACT_ABI_TYPE = '0x7386fCBae6Ad4CCE1499d9153D99bc950B589718'; // ABIType 合约地址
5
+ const CONTRACT_DID = '0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8'; // DID contract address
6
+ const CONTRACT_ROOT_RESOLVER = '0xeF727cb066Fee98F88Db84555830063b4A24ddfc'; // RootResolver contract address
7
+ const CONTRACT_ABI_TYPE = '0x7386fCBae6Ad4CCE1499d9153D99bc950B589718'; // ABIType contract address
8
8
 
9
- // // op 主网环境
9
+ // // op mainnet environment
10
10
  // const RPC = 'https://optimism-rpc.publicnode.com';
11
- // const CONTRACT_DID = '0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D'; // DID 合约地址
12
- // const CONTRACT_ROOT_RESOLVER = '0xE2EABA0979277A90511F8873ae1e8cA26B54E740'; // RootResolver 合约地址
13
- // const CONTRACT_ABI_TYPE = '0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365'; // ABIType 合约地址
11
+ // const CONTRACT_DID = '0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D'; // DID contract address
12
+ // const CONTRACT_ROOT_RESOLVER = '0xE2EABA0979277A90511F8873ae1e8cA26B54E740'; // RootResolver contract address
13
+ // const CONTRACT_ABI_TYPE = '0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365'; // ABIType contract address
14
14
 
15
15
  async function main() {
16
16
  const did = DID.createConsole(
@@ -20,11 +20,11 @@ async function main() {
20
20
  CONTRACT_ABI_TYPE
21
21
  );
22
22
 
23
- // 获取特定域名数据
23
+ // Get specific domain data
24
24
  const domain = await did.fetchDomain('tw7613781.olares.com');
25
25
  console.log('Domain Data:', domain);
26
26
 
27
- // 获取所有域名数据 (主网上数据量较大,测试网数据量较小,测试的话建议在测试网环境下体验此函数)
27
+ // Get all domain data (the mainnet has a large amount of data, the testnet has a small amount of data, for testing it is recommended to experience this function in the testnet environment)
28
28
  await did.fetchAll();
29
29
  console.log('All Domains:', did.allDomainCache);
30
30
  console.log('Domain Tree Cache:', did.treesCache);
@@ -0,0 +1,81 @@
1
+ import OlaresID from '../src/index';
2
+
3
+ /**
4
+ * Example: List All Wallets for a Domain
5
+ *
6
+ * This example shows how to query all authenticated wallet addresses
7
+ * (both EVM and Solana) for an Olares Name.
8
+ *
9
+ * Note: This is a read-only operation, no signer required.
10
+ *
11
+ * Optional environment variables:
12
+ * - DOMAIN_NAME: The Olares Name to query (default: use command line argument)
13
+ */
14
+
15
+ async function main() {
16
+ // Get domain name from environment or command line
17
+ const domainName = process.env.DOMAIN_NAME || process.argv[2];
18
+
19
+ if (!domainName) {
20
+ console.error('\n❌ Please provide a domain name:');
21
+ console.error(' node examples/list-wallets.js your.olares');
22
+ console.error(' OR');
23
+ console.error(
24
+ ' export DOMAIN_NAME="your.olares" && node examples/list-wallets.js\n'
25
+ );
26
+ process.exit(1);
27
+ }
28
+
29
+ console.log('\n📋 Listing Wallets for Domain\n');
30
+ console.log(`Domain: ${domainName}\n`);
31
+
32
+ // Initialize OlaresID (no signer needed for read operations)
33
+ // Use createMainnet() for production, createTestnet() for testing
34
+ const olaresId = OlaresID.createTestnet();
35
+
36
+ // Get domain context
37
+ const domain = olaresId.domain(domainName);
38
+
39
+ // Get EVM wallets
40
+ console.log('⏳ Fetching EVM wallets...');
41
+ const evmWallets = await domain.getEVMWallets();
42
+
43
+ console.log(`\n💰 EVM Wallets (${evmWallets.length}):\n`);
44
+ if (evmWallets.length === 0) {
45
+ console.log(' (No EVM wallets found)\n');
46
+ } else {
47
+ evmWallets.forEach((addr, i) => {
48
+ console.log(` ${i + 1}. ${addr}`);
49
+ });
50
+ console.log('');
51
+ }
52
+
53
+ // Get Solana wallets
54
+ console.log('⏳ Fetching Solana wallets...');
55
+ const solanaWallets = await domain.getSolanaWallets();
56
+
57
+ console.log(`\n🌟 Solana Wallets (${solanaWallets.length}):\n`);
58
+ if (solanaWallets.length === 0) {
59
+ console.log(' (No Solana wallets found)\n');
60
+ } else {
61
+ solanaWallets.forEach((addr, i) => {
62
+ console.log(` ${i + 1}. ${addr}`);
63
+ });
64
+ console.log('');
65
+ }
66
+
67
+ // Summary
68
+ const totalWallets = evmWallets.length + solanaWallets.length;
69
+ console.log('📊 Summary:');
70
+ console.log(` Total: ${totalWallets} wallet(s)`);
71
+ console.log(` EVM: ${evmWallets.length}`);
72
+ console.log(` Solana: ${solanaWallets.length}`);
73
+
74
+ console.log('\n✨ Done!\n');
75
+ }
76
+
77
+ // Run the example
78
+ main().catch((error) => {
79
+ console.error('\n❌ Error:', error.message);
80
+ process.exit(1);
81
+ });
@@ -0,0 +1,23 @@
1
+ module.exports = {
2
+ root: true,
3
+ parserOptions: {
4
+ parser: '@typescript-eslint/parser',
5
+ ecmaVersion: 2021
6
+ },
7
+ env: {
8
+ browser: true,
9
+ es2021: true,
10
+ node: true
11
+ },
12
+ extends: [
13
+ 'plugin:vue/vue3-essential',
14
+ 'eslint:recommended',
15
+ '@vue/typescript/recommended',
16
+ 'prettier'
17
+ ],
18
+ plugins: ['vue', '@typescript-eslint'],
19
+ rules: {
20
+ '@typescript-eslint/no-explicit-any': 'off',
21
+ '@typescript-eslint/no-unused-vars': 'warn'
22
+ }
23
+ };
@@ -0,0 +1,43 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * THIS FILE IS GENERATED AUTOMATICALLY.
4
+ * DO NOT EDIT.
5
+ *
6
+ * You are probably looking on adding startup/initialization code.
7
+ * Use "quasar new boot <name>" and add it there.
8
+ * One boot file per concern. Then reference the file(s) in quasar.config.js > boot:
9
+ * boot: ['file', ...] // do not add ".js" extension to it.
10
+ *
11
+ * Boot files are your "main.js"
12
+ **/
13
+
14
+ import { Quasar } from 'quasar';
15
+ import { markRaw } from 'vue';
16
+ import RootComponent from 'app/src/App.vue';
17
+
18
+ import createRouter from 'app/src/router/index';
19
+
20
+ export default async function (createAppFn, quasarUserOptions) {
21
+ // Create the app instance.
22
+ // Here we inject into it the Quasar UI, the router & possibly the store.
23
+ const app = createAppFn(RootComponent);
24
+
25
+ app.config.performance = true;
26
+
27
+ app.use(Quasar, quasarUserOptions);
28
+
29
+ const router = markRaw(
30
+ typeof createRouter === 'function'
31
+ ? await createRouter({})
32
+ : createRouter
33
+ );
34
+
35
+ // Expose the app, the router and the store.
36
+ // Note that we are not mounting the app here, since bootstrapping will be
37
+ // different depending on whether we are in a browser or on the server.
38
+ return {
39
+ app,
40
+
41
+ router
42
+ };
43
+ }
@@ -0,0 +1,38 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * THIS FILE IS GENERATED AUTOMATICALLY.
4
+ * DO NOT EDIT.
5
+ *
6
+ * You are probably looking on adding startup/initialization code.
7
+ * Use "quasar new boot <name>" and add it there.
8
+ * One boot file per concern. Then reference the file(s) in quasar.config.js > boot:
9
+ * boot: ['file', ...] // do not add ".js" extension to it.
10
+ *
11
+ * Boot files are your "main.js"
12
+ **/
13
+
14
+ import { createApp } from 'vue';
15
+
16
+ import '@quasar/extras/roboto-font/roboto-font.css';
17
+
18
+ import '@quasar/extras/material-icons/material-icons.css';
19
+
20
+ // We load Quasar stylesheet file
21
+ import 'quasar/dist/quasar.css';
22
+
23
+ import 'src/css/app.scss';
24
+
25
+ import createQuasarApp from './app.js';
26
+ import quasarUserOptions from './quasar-user-options.js';
27
+
28
+ console.info('[Quasar] Running SPA.');
29
+
30
+ const publicPath = `/`;
31
+
32
+ async function start({ app, router }) {
33
+ app.use(router);
34
+
35
+ app.mount('#q-app');
36
+ }
37
+
38
+ createQuasarApp(createApp, quasarUserOptions).then(start);
@@ -0,0 +1,130 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * THIS FILE IS GENERATED AUTOMATICALLY.
4
+ * DO NOT EDIT.
5
+ *
6
+ * You are probably looking on adding startup/initialization code.
7
+ * Use "quasar new boot <name>" and add it there.
8
+ * One boot file per concern. Then reference the file(s) in quasar.config.js > boot:
9
+ * boot: ['file', ...] // do not add ".js" extension to it.
10
+ *
11
+ * Boot files are your "main.js"
12
+ **/
13
+
14
+ import App from 'app/src/App.vue';
15
+ let appPrefetch =
16
+ typeof App.preFetch === 'function'
17
+ ? App.preFetch
18
+ : // Class components return the component options (and the preFetch hook) inside __c property
19
+ App.__c !== void 0 && typeof App.__c.preFetch === 'function'
20
+ ? App.__c.preFetch
21
+ : false;
22
+
23
+ function getMatchedComponents(to, router) {
24
+ const route = to
25
+ ? to.matched
26
+ ? to
27
+ : router.resolve(to).route
28
+ : router.currentRoute.value;
29
+
30
+ if (!route) {
31
+ return [];
32
+ }
33
+
34
+ const matched = route.matched.filter((m) => m.components !== void 0);
35
+
36
+ if (matched.length === 0) {
37
+ return [];
38
+ }
39
+
40
+ return Array.prototype.concat.apply(
41
+ [],
42
+ matched.map((m) => {
43
+ return Object.keys(m.components).map((key) => {
44
+ const comp = m.components[key];
45
+ return {
46
+ path: m.path,
47
+ c: comp
48
+ };
49
+ });
50
+ })
51
+ );
52
+ }
53
+
54
+ export function addPreFetchHooks({ router, publicPath }) {
55
+ // Add router hook for handling preFetch.
56
+ // Doing it after initial route is resolved so that we don't double-fetch
57
+ // the data that we already have. Using router.beforeResolve() so that all
58
+ // async components are resolved.
59
+ router.beforeResolve((to, from, next) => {
60
+ const urlPath = window.location.href.replace(
61
+ window.location.origin,
62
+ ''
63
+ ),
64
+ matched = getMatchedComponents(to, router),
65
+ prevMatched = getMatchedComponents(from, router);
66
+
67
+ let diffed = false;
68
+ const preFetchList = matched
69
+ .filter((m, i) => {
70
+ return (
71
+ diffed ||
72
+ (diffed =
73
+ !prevMatched[i] ||
74
+ prevMatched[i].c !== m.c ||
75
+ m.path.indexOf('/:') > -1) // does it has params?
76
+ );
77
+ })
78
+ .filter(
79
+ (m) =>
80
+ m.c !== void 0 &&
81
+ (typeof m.c.preFetch === 'function' ||
82
+ // Class components return the component options (and the preFetch hook) inside __c property
83
+ (m.c.__c !== void 0 &&
84
+ typeof m.c.__c.preFetch === 'function'))
85
+ )
86
+ .map((m) => (m.c.__c !== void 0 ? m.c.__c.preFetch : m.c.preFetch));
87
+
88
+ if (appPrefetch !== false) {
89
+ preFetchList.unshift(appPrefetch);
90
+ appPrefetch = false;
91
+ }
92
+
93
+ if (preFetchList.length === 0) {
94
+ return next();
95
+ }
96
+
97
+ let hasRedirected = false;
98
+ const redirect = (url) => {
99
+ hasRedirected = true;
100
+ next(url);
101
+ };
102
+ const proceed = () => {
103
+ if (hasRedirected === false) {
104
+ next();
105
+ }
106
+ };
107
+
108
+ preFetchList
109
+ .reduce(
110
+ (promise, preFetch) =>
111
+ promise.then(
112
+ () =>
113
+ hasRedirected === false &&
114
+ preFetch({
115
+ currentRoute: to,
116
+ previousRoute: from,
117
+ redirect,
118
+ urlPath,
119
+ publicPath
120
+ })
121
+ ),
122
+ Promise.resolve()
123
+ )
124
+ .then(proceed)
125
+ .catch((e) => {
126
+ console.error(e);
127
+ proceed();
128
+ });
129
+ });
130
+ }