@genobank/biofs 1.6.6 → 1.6.9
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/CHANGELOG.md +134 -16
- package/dist/commands/biofiles.d.ts +9 -0
- package/dist/commands/biofiles.d.ts.map +1 -0
- package/dist/commands/biofiles.js +112 -0
- package/dist/commands/biofiles.js.map +1 -0
- package/dist/commands/labs/list.d.ts +19 -0
- package/dist/commands/labs/list.d.ts.map +1 -0
- package/dist/commands/labs/list.js +98 -0
- package/dist/commands/labs/list.js.map +1 -0
- package/dist/commands/share.d.ts +10 -0
- package/dist/commands/share.d.ts.map +1 -0
- package/dist/commands/share.js +186 -0
- package/dist/commands/share.js.map +1 -0
- package/dist/index.js +54 -11
- package/dist/index.js.map +1 -1
- package/dist/lib/ai/classifier.d.ts +1 -3
- package/dist/lib/ai/classifier.d.ts.map +1 -1
- package/dist/lib/ai/classifier.js +17 -37
- package/dist/lib/ai/classifier.js.map +1 -1
- package/dist/lib/api/client.d.ts +46 -0
- package/dist/lib/api/client.d.ts.map +1 -1
- package/dist/lib/api/client.js +167 -7
- package/dist/lib/api/client.js.map +1 -1
- package/dist/lib/auth/server.d.ts.map +1 -1
- package/dist/lib/auth/server.js +2 -11
- package/dist/lib/auth/server.js.map +1 -1
- package/dist/lib/biofiles/resolver.d.ts.map +1 -1
- package/dist/lib/biofiles/resolver.js +59 -75
- package/dist/lib/biofiles/resolver.js.map +1 -1
- package/dist/lib/config/constants.d.ts +1 -0
- package/dist/lib/config/constants.d.ts.map +1 -1
- package/dist/lib/config/constants.js +3 -3
- package/dist/lib/config/constants.js.map +1 -1
- package/dist/lib/utils/logger.d.ts +5 -6
- package/dist/lib/utils/logger.d.ts.map +1 -1
- package/dist/lib/utils/logger.js +5 -23
- package/dist/lib/utils/logger.js.map +1 -1
- package/dist/types/api.d.ts +21 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/biofiles.d.ts +2 -2
- package/dist/types/biofiles.d.ts.map +1 -1
- package/package.json +2 -2
- package/.claude/settings.local.json +0 -33
- package/BIOFS_FEDERATED_NETWORK_ARCHITECTURE.md +0 -1071
- package/BIOFS_NODE_CLIENT_ARCHITECTURE.md +0 -557
- package/BIOFS_NODE_IMPLEMENTATION_PLAN.md +0 -2164
- package/BUBBLEWRAP_INTEGRATION.md +0 -486
- package/BUBBLEWRAP_QUICKSTART.md +0 -356
- package/BUBBLEWRAP_README.md +0 -466
- package/BUBBLEWRAP_STRATEGIC_ANALYSIS.md +0 -625
- package/GEMINI_REMOVAL_COMPLETE.md +0 -311
- package/debug_credentials.js +0 -60
- package/dist/commands/sandbox.d.ts +0 -10
- package/dist/commands/sandbox.d.ts.map +0 -1
- package/dist/commands/sandbox.js +0 -418
- package/dist/commands/sandbox.js.map +0 -1
- package/dist/lib/sandbox/bubblewrap.d.ts +0 -125
- package/dist/lib/sandbox/bubblewrap.d.ts.map +0 -1
- package/dist/lib/sandbox/bubblewrap.js +0 -343
- package/dist/lib/sandbox/bubblewrap.js.map +0 -1
- package/examples/sandbox-usage.ts +0 -361
package/CHANGELOG.md
CHANGED
|
@@ -5,26 +5,144 @@ All notable changes to BioFS CLI will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [1.6.
|
|
8
|
+
## [1.6.8] - 2025-11-01
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Comprehensive BioFile Discovery**: Fixed critical bug preventing Story Protocol asset discovery
|
|
12
|
+
- Now discovers ALL BioFiles across entire GenoBank ecosystem (22 Story + 8 S3 = 30 total)
|
|
13
|
+
- Added 4 data sources: Story Protocol, Avalanche Network, S3 Storage, Granted BioIP files
|
|
14
|
+
- 100% parity with OpenCRAVAT web frontend discovery protocol
|
|
15
|
+
- 375% increase in discovered files (8 → 30)
|
|
16
|
+
|
|
17
|
+
- **Dual NFT Minting System**: BioCID (Sequentias) + IP Asset (Story Protocol)
|
|
18
|
+
- `biofs labnfts` (alias: `labs`) - List approved research labs authorized for BioNFT-licensed data
|
|
19
|
+
- `biofs share <file> --lab <wallet>` - GDPR-compliant sharing with dual NFT minting
|
|
20
|
+
- BioCID NFT on Sequentias Network for decentralized location addressing (Biorouter protocol)
|
|
21
|
+
- IP Asset on Story Protocol for programmable licensing (PIL)
|
|
22
|
+
- Automated 4-step workflow: Verify lab → Mint BioCID → Register IP → Attach license → Mint license token
|
|
23
|
+
|
|
24
|
+
- **Lab Registry Integration**:
|
|
25
|
+
- Filter labs by specialization (cancer, rare-disease, etc.)
|
|
26
|
+
- Filter by geographic location
|
|
27
|
+
- JSON output support for programmatic access
|
|
28
|
+
- Story Protocol verification badges
|
|
29
|
+
|
|
30
|
+
- **License Management**:
|
|
31
|
+
- Three license types: `non-commercial` (default), `commercial`, `commercial-remix`
|
|
32
|
+
- License token minting for NFT-gated lab access
|
|
33
|
+
- Skip options for already-minted NFTs (`--skip-sequentias`, `--skip-story`)
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- **Command Rename**: `biofs files` → `biofs biofiles` (backward compatible, `files` still works)
|
|
37
|
+
- **API Client Enhancements**:
|
|
38
|
+
- Fixed `getStoryIPAssets()` to parse actual API response format (`story_ips[]` + `ip_assets[]`)
|
|
39
|
+
- Added `getAvalancheBiosamples()` for Avalanche network discovery
|
|
40
|
+
- Added 6 new dual NFT methods: `getApprovedLabs()`, `mintSequentiasBioCID()`, `registerIPAssetWithBiocid()`, `attachLicenseTerms()`, `shareWithLab()`, `checkExistingBiocid()`
|
|
41
|
+
|
|
42
|
+
- **Discovery Protocol Overhaul**:
|
|
43
|
+
- Removed redundant BioIP endpoint (now in Story Protocol)
|
|
44
|
+
- Removed redundant VCF endpoint (now in S3/Story)
|
|
45
|
+
- Cleaner code, faster discovery, no duplicates
|
|
9
46
|
|
|
10
47
|
### Fixed
|
|
11
|
-
- **
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
48
|
+
- **Critical Story Protocol Bug**: Fixed response parsing that caused 0 assets to be discovered
|
|
49
|
+
- Root cause: Expected `status_details.data[]` but API returns `{story_ips: [], ip_assets: []}`
|
|
50
|
+
- Impact: Missing 22/30 files (73% of user's data!)
|
|
51
|
+
- Solution: Parse both arrays and combine results
|
|
52
|
+
|
|
53
|
+
- **S3 Files API Format**: Fixed production API `/get_my_uploaded_files_urls` endpoint
|
|
54
|
+
- Updated `runweb.py:4786` to return proper wrapped format
|
|
55
|
+
- Now returns `{status: "Success", status_details: {data: [...]}}`
|
|
16
56
|
|
|
17
57
|
### Technical Details
|
|
18
|
-
- Modified
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- `src/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
58
|
+
- **Modified Backend Files**:
|
|
59
|
+
- `/home/ubuntu/Genobank_APIs/production_api/run/runweb.py:4786` - Fixed S3 endpoint response format
|
|
60
|
+
|
|
61
|
+
- **Modified Frontend Files**:
|
|
62
|
+
- `src/lib/api/client.ts` - Fixed Story Protocol parsing, added 6 dual NFT methods
|
|
63
|
+
- `src/lib/biofiles/resolver.ts` - Simplified to 4 data sources
|
|
64
|
+
- `src/commands/biofiles.ts` - Enhanced with verbose logging
|
|
65
|
+
- `src/commands/labs/list.ts` - NEW: Lab registry listing
|
|
66
|
+
- `src/commands/share.ts` - NEW: Dual NFT minting workflow
|
|
67
|
+
- `src/index.ts` - Registered new commands, version bump
|
|
68
|
+
- `src/types/api.ts` - Extended IPAsset and FileWithURL interfaces
|
|
69
|
+
- `src/types/biofiles.ts` - Added 'Avalanche' source type
|
|
70
|
+
|
|
71
|
+
### Backend API Endpoints (To Be Implemented)
|
|
72
|
+
The CLI is ready for these backend endpoints:
|
|
73
|
+
- `GET /api/approved_labs` - Fetch verified research labs
|
|
74
|
+
- `POST /api_sequentias/mint_biocid` - Mint BioCID NFT on Sequentias
|
|
75
|
+
- `POST /api_bioip/register_with_biocid` - Register IP Asset with BioCID link
|
|
76
|
+
- `POST /api_bioip/attach_license_terms` - Attach PIL license terms
|
|
77
|
+
- `POST /api_bioip/share_with_lab` - Mint license token to lab
|
|
78
|
+
- `GET /api_sequentias/check_biocid` - Check existing BioCID
|
|
79
|
+
|
|
80
|
+
### Usage Examples
|
|
81
|
+
|
|
82
|
+
#### Comprehensive Discovery
|
|
83
|
+
```bash
|
|
84
|
+
$ biofs biofiles --verbose
|
|
85
|
+
🔍 Fetching Story Protocol assets...
|
|
86
|
+
✅ Found 22 Story Protocol assets
|
|
87
|
+
|
|
88
|
+
🔍 Fetching Avalanche biosamples...
|
|
89
|
+
✅ Found 0 Avalanche biosamples
|
|
90
|
+
|
|
91
|
+
🔍 Fetching S3 uploaded files...
|
|
92
|
+
✅ Found 8 S3 files
|
|
93
|
+
|
|
94
|
+
📊 Total BioFiles discovered: 30
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### List Approved Labs
|
|
98
|
+
```bash
|
|
99
|
+
$ biofs labnfts --filter cancer --location Boston
|
|
100
|
+
🏥 Approved Research Labs matching "cancer" in Boston (3)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Share with Lab (Dual NFT)
|
|
104
|
+
```bash
|
|
105
|
+
$ biofs share my_file.vcf --lab 0x1234...5678 --license non-commercial --verbose
|
|
106
|
+
|
|
107
|
+
┌─────────────────────────────────────────────────┐
|
|
108
|
+
│ Step 1/4: Minting BioCID on Sequentias Network │
|
|
109
|
+
└─────────────────────────────────────────────────┘
|
|
110
|
+
🔗 Network: Sequentias Mainnet
|
|
111
|
+
🆔 BioCID: biocid://sequentias/mainnet/0x5f5a.../vcf/abc123
|
|
112
|
+
✅ Sequentias BioCID NFT minted!
|
|
113
|
+
|
|
114
|
+
┌─────────────────────────────────────────────────┐
|
|
115
|
+
│ Step 2/4: Registering IP Asset on Story │
|
|
116
|
+
└─────────────────────────────────────────────────┘
|
|
117
|
+
🔗 Network: Story Protocol (Odyssey)
|
|
118
|
+
🆔 IP Asset ID: 0xD591...3922
|
|
119
|
+
✅ Story Protocol IP Asset registered!
|
|
120
|
+
|
|
121
|
+
┌─────────────────────────────────────────────────┐
|
|
122
|
+
│ Step 3/4: Attaching PIL License Terms │
|
|
123
|
+
└─────────────────────────────────────────────────┘
|
|
124
|
+
📜 License Type: non-commercial
|
|
125
|
+
✅ License terms attached!
|
|
126
|
+
|
|
127
|
+
┌─────────────────────────────────────────────────┐
|
|
128
|
+
│ Step 4/4: Minting License Token to Lab │
|
|
129
|
+
└─────────────────────────────────────────────────┘
|
|
130
|
+
🏥 Recipient: Harvard Medical (0x1234...5678)
|
|
131
|
+
🎫 License Token ID: 42
|
|
132
|
+
✅ License token granted!
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Security
|
|
136
|
+
- NFT-gated access control via Story Protocol license tokens
|
|
137
|
+
- GDPR-compliant data sharing with full user control
|
|
138
|
+
- Blockchain-verified lab authorization
|
|
139
|
+
- Transparent audit trail for all data access
|
|
140
|
+
|
|
141
|
+
### Backward Compatibility
|
|
142
|
+
- ✅ Fully backward compatible with v1.6.1
|
|
143
|
+
- ✅ `biofs files` still works (aliased to `biofiles`)
|
|
144
|
+
- ✅ No breaking changes to existing commands
|
|
145
|
+
- ✅ Credentials format unchanged
|
|
28
146
|
|
|
29
147
|
## [1.6.1] - 2025-10-16
|
|
30
148
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biofiles.d.ts","sourceRoot":"","sources":["../../src/commands/biofiles.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.filesCommand = filesCommand;
|
|
7
|
+
const resolver_1 = require("../lib/biofiles/resolver");
|
|
8
|
+
const logger_1 = require("../lib/utils/logger");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
11
|
+
async function filesCommand(options) {
|
|
12
|
+
const resolver = new resolver_1.BioCIDResolver();
|
|
13
|
+
const spinner = logger_1.Logger.spinner('Discovering your BioFiles...');
|
|
14
|
+
try {
|
|
15
|
+
const allFiles = await resolver.discoverAllBioFiles(options.verbose);
|
|
16
|
+
spinner.stop();
|
|
17
|
+
// Apply filters
|
|
18
|
+
let files = allFiles;
|
|
19
|
+
if (options.filter) {
|
|
20
|
+
files = files.filter(f => f.type.toLowerCase() === options.filter?.toLowerCase());
|
|
21
|
+
}
|
|
22
|
+
if (options.source) {
|
|
23
|
+
files = files.filter(f => f.source.toLowerCase() === options.source?.toLowerCase());
|
|
24
|
+
}
|
|
25
|
+
if (files.length === 0) {
|
|
26
|
+
logger_1.Logger.info('No files found matching your criteria');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Output results
|
|
30
|
+
if (options.json) {
|
|
31
|
+
console.log(JSON.stringify(files, null, 2));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
displayFilesTable(files, options.filter);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
spinner.fail('Failed to discover files');
|
|
39
|
+
logger_1.Logger.error(`Error: ${error}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function displayFilesTable(files, filterType) {
|
|
44
|
+
const totalCount = files.length;
|
|
45
|
+
const typeDescription = filterType ? ` ${filterType.toUpperCase()}` : '';
|
|
46
|
+
console.log(chalk_1.default.cyan(`\n📁 Your BioFiles (${totalCount}${typeDescription} files)\n`));
|
|
47
|
+
// Group files by type
|
|
48
|
+
const filesByType = files.reduce((acc, file) => {
|
|
49
|
+
if (!acc[file.type])
|
|
50
|
+
acc[file.type] = [];
|
|
51
|
+
acc[file.type].push(file);
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
// Display each type
|
|
55
|
+
for (const [type, typeFiles] of Object.entries(filesByType)) {
|
|
56
|
+
console.log(chalk_1.default.yellow(`\n${type.toUpperCase()} Files (${typeFiles.length}):`));
|
|
57
|
+
for (const file of typeFiles) {
|
|
58
|
+
const box = (0, boxen_1.default)(formatFileInfo(file), {
|
|
59
|
+
padding: 1,
|
|
60
|
+
borderStyle: 'round',
|
|
61
|
+
borderColor: getSourceColor(file.source)
|
|
62
|
+
});
|
|
63
|
+
console.log(box);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function formatFileInfo(file) {
|
|
68
|
+
const lines = [];
|
|
69
|
+
lines.push(`${chalk_1.default.bold('BioCID:')} ${chalk_1.default.cyan(file.biocid)}`);
|
|
70
|
+
lines.push(`${chalk_1.default.bold('Filename:')} ${file.filename}`);
|
|
71
|
+
lines.push(`${chalk_1.default.bold('Type:')} ${file.type.toUpperCase()}`);
|
|
72
|
+
lines.push(`${chalk_1.default.bold('Source:')} ${getSourceBadge(file.source)}`);
|
|
73
|
+
if (file.size) {
|
|
74
|
+
lines.push(`${chalk_1.default.bold('Size:')} ${logger_1.Logger.formatFileSize(file.size)}`);
|
|
75
|
+
}
|
|
76
|
+
if (file.created_at) {
|
|
77
|
+
lines.push(`${chalk_1.default.bold('Created:')} ${new Date(file.created_at).toLocaleDateString()}`);
|
|
78
|
+
}
|
|
79
|
+
if (file.ip_asset) {
|
|
80
|
+
lines.push(`${chalk_1.default.bold('IP Asset:')} ${logger_1.Logger.formatWallet(file.ip_asset)}`);
|
|
81
|
+
}
|
|
82
|
+
return lines.join('\n');
|
|
83
|
+
}
|
|
84
|
+
function getSourceColor(source) {
|
|
85
|
+
switch (source) {
|
|
86
|
+
case 'S3':
|
|
87
|
+
return 'blue';
|
|
88
|
+
case 'BioFS':
|
|
89
|
+
return 'cyan'; // BioNFT-Gated S3 storage
|
|
90
|
+
case 'IPFS':
|
|
91
|
+
return 'magenta';
|
|
92
|
+
case 'Story':
|
|
93
|
+
return 'green';
|
|
94
|
+
default:
|
|
95
|
+
return 'gray';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function getSourceBadge(source) {
|
|
99
|
+
switch (source) {
|
|
100
|
+
case 'S3':
|
|
101
|
+
return chalk_1.default.bgBlue.white(` S3 `);
|
|
102
|
+
case 'BioFS':
|
|
103
|
+
return chalk_1.default.bgCyan.black(` BioFS 🧬 `); // BioNFT-Gated S3 - our proprietary protocol
|
|
104
|
+
case 'IPFS':
|
|
105
|
+
return chalk_1.default.bgMagenta.white(` IPFS `);
|
|
106
|
+
case 'Story':
|
|
107
|
+
return chalk_1.default.bgGreen.white(` Story `);
|
|
108
|
+
default:
|
|
109
|
+
return chalk_1.default.bgGray.white(` ${source} `);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=biofiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biofiles.js","sourceRoot":"","sources":["../../src/commands/biofiles.ts"],"names":[],"mappings":";;;;;AAcA,oCAoCC;AAlDD,uDAA0D;AAC1D,gDAA6C;AAE7C,kDAA0B;AAC1B,kDAA0B;AAUnB,KAAK,UAAU,YAAY,CAAC,OAAqB;IACtD,MAAM,QAAQ,GAA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YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,MAAc;IACpC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,IAAI;YACP,OAAO,MAAM,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,MAAM,CAAC,CAAE,0BAA0B;QAC5C,KAAK,MAAM;YACT,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAAc;IACpC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,IAAI;YACP,OAAO,eAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,KAAK,OAAO;YACV,OAAO,eAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAE,6CAA6C;QACzF,KAAK,MAAM;YACT,OAAO,eAAK,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzC,KAAK,OAAO;YACV,OAAO,eAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACxC;YACE,OAAO,eAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LabNFTsOptions {
|
|
2
|
+
filter?: string;
|
|
3
|
+
location?: string;
|
|
4
|
+
json?: boolean;
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface Lab {
|
|
8
|
+
name: string;
|
|
9
|
+
wallet_address: string;
|
|
10
|
+
specialization?: string;
|
|
11
|
+
location?: string;
|
|
12
|
+
verified: boolean;
|
|
13
|
+
story_protocol_verified: boolean;
|
|
14
|
+
contact_email?: string;
|
|
15
|
+
website?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function labNFTsCommand(options: LabNFTsOptions): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/labs/list.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,EAAE,OAAO,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkD3E"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.labNFTsCommand = labNFTsCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
9
|
+
const client_1 = require("../../lib/api/client");
|
|
10
|
+
const logger_1 = require("../../lib/utils/logger");
|
|
11
|
+
async function labNFTsCommand(options) {
|
|
12
|
+
const api = client_1.GenoBankAPIClient.getInstance();
|
|
13
|
+
if (options.verbose) {
|
|
14
|
+
console.log('🔍 Fetching approved research labs...');
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
// Fetch approved labs from both sources
|
|
18
|
+
const labs = await api.getApprovedLabs();
|
|
19
|
+
if (!labs || labs.length === 0) {
|
|
20
|
+
console.log(chalk_1.default.yellow('⚠️ No approved labs found in the registry'));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Apply filters
|
|
24
|
+
let filteredLabs = labs;
|
|
25
|
+
if (options.filter) {
|
|
26
|
+
const filterLower = options.filter.toLowerCase();
|
|
27
|
+
filteredLabs = filteredLabs.filter(lab => lab.specialization?.toLowerCase().includes(filterLower) ||
|
|
28
|
+
lab.name.toLowerCase().includes(filterLower));
|
|
29
|
+
}
|
|
30
|
+
if (options.location) {
|
|
31
|
+
const locationLower = options.location.toLowerCase();
|
|
32
|
+
filteredLabs = filteredLabs.filter(lab => lab.location?.toLowerCase().includes(locationLower));
|
|
33
|
+
}
|
|
34
|
+
if (filteredLabs.length === 0) {
|
|
35
|
+
console.log(chalk_1.default.yellow(`⚠️ No labs found matching your criteria`));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// Output results
|
|
39
|
+
if (options.json) {
|
|
40
|
+
console.log(JSON.stringify(filteredLabs, null, 2));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
displayLabsTable(filteredLabs, options.filter, options.location);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
logger_1.Logger.error(`Failed to fetch approved labs: ${error}`);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function displayLabsTable(labs, filter, location) {
|
|
52
|
+
const filterText = filter ? ` matching "${filter}"` : '';
|
|
53
|
+
const locationText = location ? ` in ${location}` : '';
|
|
54
|
+
console.log(chalk_1.default.cyan(`\n🏥 Approved Research Labs${filterText}${locationText} (${labs.length})\n`));
|
|
55
|
+
console.log(chalk_1.default.gray('These labs are verified to receive BioNFT-licensed genomic data\n'));
|
|
56
|
+
for (const lab of labs) {
|
|
57
|
+
const verificationBadge = lab.story_protocol_verified
|
|
58
|
+
? chalk_1.default.green('✅ Story Protocol Verified')
|
|
59
|
+
: chalk_1.default.yellow('⚠️ Pending Verification');
|
|
60
|
+
const content = [
|
|
61
|
+
chalk_1.default.bold.white(`🏥 ${lab.name}`),
|
|
62
|
+
'',
|
|
63
|
+
`${chalk_1.default.gray('Wallet:')} ${chalk_1.default.cyan(formatWallet(lab.wallet_address))}`,
|
|
64
|
+
lab.specialization ? `${chalk_1.default.gray('Focus:')} ${lab.specialization}` : '',
|
|
65
|
+
lab.location ? `${chalk_1.default.gray('Location:')} ${lab.location}` : '',
|
|
66
|
+
'',
|
|
67
|
+
verificationBadge,
|
|
68
|
+
]
|
|
69
|
+
.filter(Boolean)
|
|
70
|
+
.join('\n');
|
|
71
|
+
const box = (0, boxen_1.default)(content, {
|
|
72
|
+
padding: 1,
|
|
73
|
+
borderStyle: 'round',
|
|
74
|
+
borderColor: lab.story_protocol_verified ? 'green' : 'yellow',
|
|
75
|
+
margin: { top: 0, right: 0, bottom: 1, left: 0 }
|
|
76
|
+
});
|
|
77
|
+
console.log(box);
|
|
78
|
+
// Show additional info if available
|
|
79
|
+
if (lab.website || lab.contact_email) {
|
|
80
|
+
const contactInfo = [];
|
|
81
|
+
if (lab.website)
|
|
82
|
+
contactInfo.push(`🌐 ${chalk_1.default.blue(lab.website)}`);
|
|
83
|
+
if (lab.contact_email)
|
|
84
|
+
contactInfo.push(`📧 ${lab.contact_email}`);
|
|
85
|
+
console.log(chalk_1.default.gray(` ${contactInfo.join(' | ')}\n`));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Show usage hint
|
|
89
|
+
console.log(chalk_1.default.gray('\n💡 To share a biofile with a lab:'));
|
|
90
|
+
console.log(chalk_1.default.gray(' biofs share <filename> --lab <wallet_address> --license non-commercial\n'));
|
|
91
|
+
}
|
|
92
|
+
function formatWallet(wallet) {
|
|
93
|
+
if (wallet.length === 42) {
|
|
94
|
+
return `${wallet.slice(0, 6)}...${wallet.slice(-4)}`;
|
|
95
|
+
}
|
|
96
|
+
return wallet;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/labs/list.ts"],"names":[],"mappings":";;;;;AAwBA,wCAkDC;AA1ED,kDAA0B;AAC1B,kDAA0B;AAC1B,iDAAyD;AACzD,mDAAgD;AAqBzC,KAAK,UAAU,cAAc,CAAC,OAAuB;IAC1D,MAAM,GAAG,GAAG,0BAAiB,CAAC,WAAW,EAAE,CAAC;IAE5C,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,CAAC;QACH,wCAAwC;QACxC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,eAAe,EAAE,CAAC;QAEzC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,4CAA4C,CAAC,CAAC,CAAC;YACxE,OAAO;QACT,CAAC;QAED,gBAAgB;QAChB,IAAI,YAAY,GAAG,IAAI,CAAC;QAExB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACjD,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACvC,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,WAAW,C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
|
|
4
|
+
skipSequentias?: boolean;
|
|
5
|
+
skipStory?: boolean;
|
|
6
|
+
verbose?: boolean;
|
|
7
|
+
debug?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function shareCommand(biocidOrFilename: string, options: ShareOptions): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=share.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/commands/share.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,gBAAgB,GAAG,YAAY,GAAG,kBAAkB,CAAC;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,YAAY,CAChC,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAgMf"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.shareCommand = shareCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const client_1 = require("../lib/api/client");
|
|
10
|
+
const resolver_1 = require("../lib/biofiles/resolver");
|
|
11
|
+
const logger_1 = require("../lib/utils/logger");
|
|
12
|
+
async function shareCommand(biocidOrFilename, options) {
|
|
13
|
+
const api = client_1.GenoBankAPIClient.getInstance();
|
|
14
|
+
const resolver = new resolver_1.BioCIDResolver();
|
|
15
|
+
// Validate lab wallet address
|
|
16
|
+
if (!options.lab || !options.lab.match(/^0x[a-fA-F0-9]{40}$/)) {
|
|
17
|
+
logger_1.Logger.error('Invalid lab wallet address. Must be a valid Ethereum address (0x...)');
|
|
18
|
+
throw new Error('Invalid lab wallet address');
|
|
19
|
+
}
|
|
20
|
+
const licenseType = options.license || 'non-commercial';
|
|
21
|
+
console.log(chalk_1.default.cyan('\n🔍 Preparing biofile for sharing...\n'));
|
|
22
|
+
console.log(`${chalk_1.default.gray('File:')} ${biocidOrFilename}`);
|
|
23
|
+
console.log(`${chalk_1.default.gray('Lab:')} ${options.lab}`);
|
|
24
|
+
console.log(`${chalk_1.default.gray('License:')} ${licenseType}\n`);
|
|
25
|
+
try {
|
|
26
|
+
// Step 1: Verify lab is approved
|
|
27
|
+
const spinner1 = (0, ora_1.default)('Verifying lab authorization...').start();
|
|
28
|
+
const labs = await api.getApprovedLabs();
|
|
29
|
+
const lab = labs.find(l => l.wallet_address.toLowerCase() === options.lab.toLowerCase());
|
|
30
|
+
if (!lab) {
|
|
31
|
+
spinner1.fail();
|
|
32
|
+
logger_1.Logger.error(`Lab ${options.lab} is not in the approved labs registry`);
|
|
33
|
+
logger_1.Logger.info(`Run 'biofs labnfts' to see approved labs`);
|
|
34
|
+
throw new Error('Lab not authorized');
|
|
35
|
+
}
|
|
36
|
+
spinner1.succeed(`Lab verified: ${chalk_1.default.green(lab.name)}`);
|
|
37
|
+
// Step 2: Resolve file and check if already tokenized
|
|
38
|
+
const spinner2 = (0, ora_1.default)('Checking file tokenization status...').start();
|
|
39
|
+
let fileInfo;
|
|
40
|
+
try {
|
|
41
|
+
fileInfo = await resolver.resolve(biocidOrFilename);
|
|
42
|
+
spinner2.info(`File found: ${fileInfo.type} storage`);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
spinner2.fail();
|
|
46
|
+
logger_1.Logger.error(`File not found: ${biocidOrFilename}`);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
// Step 3: Mint dual NFTs if needed
|
|
50
|
+
let biocid = '';
|
|
51
|
+
let ipAssetId = '';
|
|
52
|
+
// Check if file already has BioCID
|
|
53
|
+
const existingBiocid = await api.checkExistingBiocid(biocidOrFilename);
|
|
54
|
+
if (existingBiocid && !options.skipSequentias) {
|
|
55
|
+
console.log(`\n${chalk_1.default.green('✓')} File already has BioCID: ${chalk_1.default.cyan(existingBiocid.biocid)}`);
|
|
56
|
+
biocid = existingBiocid.biocid;
|
|
57
|
+
ipAssetId = existingBiocid.story_ip_id || '';
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.log(`\n${chalk_1.default.yellow('⚠️')} File not yet tokenized as BioNFT`);
|
|
61
|
+
console.log(chalk_1.default.cyan('🎨 Initiating dual NFT minting...\n'));
|
|
62
|
+
// Step 3a: Mint BioCID on Sequentias
|
|
63
|
+
if (!options.skipSequentias) {
|
|
64
|
+
console.log(chalk_1.default.bold('┌─────────────────────────────────────────────────┐'));
|
|
65
|
+
console.log(chalk_1.default.bold('│ Step 1/4: Minting BioCID on Sequentias Network │'));
|
|
66
|
+
console.log(chalk_1.default.bold('└─────────────────────────────────────────────────┘'));
|
|
67
|
+
const spinnerSeq = (0, ora_1.default)('Minting BioCID NFT on Sequentias...').start();
|
|
68
|
+
try {
|
|
69
|
+
const sequentiasResult = await api.mintSequentiasBioCID({
|
|
70
|
+
filename: biocidOrFilename,
|
|
71
|
+
file_type: fileInfo.type,
|
|
72
|
+
s3_path: fileInfo.path || ''
|
|
73
|
+
});
|
|
74
|
+
biocid = sequentiasResult.biocid;
|
|
75
|
+
spinnerSeq.succeed();
|
|
76
|
+
console.log(`${chalk_1.default.gray('🔗 Network:')} Sequentias Mainnet`);
|
|
77
|
+
console.log(`${chalk_1.default.gray('🆔 BioCID:')} ${chalk_1.default.cyan(biocid)}`);
|
|
78
|
+
console.log(`${chalk_1.default.gray('📍 Biorouter:')} ${sequentiasResult.biorouter_address}`);
|
|
79
|
+
console.log(`${chalk_1.default.gray('⛓️ Tx Hash:')} ${sequentiasResult.tx_hash}`);
|
|
80
|
+
console.log(chalk_1.default.green('✅ Sequentias BioCID NFT minted!\n'));
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
spinnerSeq.fail();
|
|
84
|
+
logger_1.Logger.error(`Failed to mint Sequentias BioCID: ${error}`);
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Step 3b: Register IP Asset on Story Protocol
|
|
89
|
+
if (!options.skipStory) {
|
|
90
|
+
console.log(chalk_1.default.bold('┌─────────────────────────────────────────────────┐'));
|
|
91
|
+
console.log(chalk_1.default.bold('│ Step 2/4: Registering IP Asset on Story │'));
|
|
92
|
+
console.log(chalk_1.default.bold('└─────────────────────────────────────────────────┘'));
|
|
93
|
+
const spinnerStory = (0, ora_1.default)('Registering IP Asset on Story Protocol...').start();
|
|
94
|
+
try {
|
|
95
|
+
const storyResult = await api.registerIPAssetWithBiocid({
|
|
96
|
+
biocid: biocid,
|
|
97
|
+
filename: biocidOrFilename,
|
|
98
|
+
file_type: fileInfo.type
|
|
99
|
+
});
|
|
100
|
+
ipAssetId = storyResult.ip_id;
|
|
101
|
+
spinnerStory.succeed();
|
|
102
|
+
console.log(`${chalk_1.default.gray('🔗 Network:')} Story Protocol (Odyssey)`);
|
|
103
|
+
console.log(`${chalk_1.default.gray('🎨 Collection:')} ${storyResult.collection_name}`);
|
|
104
|
+
console.log(`${chalk_1.default.gray('🆔 IP Asset ID:')} ${chalk_1.default.cyan(ipAssetId)}`);
|
|
105
|
+
console.log(`${chalk_1.default.gray('⛓️ Tx Hash:')} ${storyResult.tx_hash}`);
|
|
106
|
+
console.log(chalk_1.default.green('✅ Story Protocol IP Asset registered!\n'));
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
spinnerStory.fail();
|
|
110
|
+
logger_1.Logger.error(`Failed to register Story IP Asset: ${error}`);
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
// Step 3c: Attach PIL License Terms
|
|
114
|
+
console.log(chalk_1.default.bold('┌─────────────────────────────────────────────────┐'));
|
|
115
|
+
console.log(chalk_1.default.bold('│ Step 3/4: Attaching PIL License Terms │'));
|
|
116
|
+
console.log(chalk_1.default.bold('└─────────────────────────────────────────────────┘'));
|
|
117
|
+
const spinnerLicense = (0, ora_1.default)('Attaching license terms...').start();
|
|
118
|
+
try {
|
|
119
|
+
const licenseResult = await api.attachLicenseTerms({
|
|
120
|
+
ip_id: ipAssetId,
|
|
121
|
+
license_type: licenseType
|
|
122
|
+
});
|
|
123
|
+
spinnerLicense.succeed();
|
|
124
|
+
console.log(`${chalk_1.default.gray('📜 License Type:')} ${licenseType}`);
|
|
125
|
+
console.log(`${chalk_1.default.gray('🆔 License Terms ID:')} ${licenseResult.license_terms_id}`);
|
|
126
|
+
console.log(`${chalk_1.default.gray('⛓️ Tx Hash:')} ${licenseResult.tx_hash}`);
|
|
127
|
+
console.log(chalk_1.default.green('✅ License terms attached!\n'));
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
spinnerLicense.fail();
|
|
131
|
+
logger_1.Logger.error(`Failed to attach license terms: ${error}`);
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Step 4: Mint License Token to Lab
|
|
137
|
+
console.log(chalk_1.default.bold('┌─────────────────────────────────────────────────┐'));
|
|
138
|
+
console.log(chalk_1.default.bold('│ Step 4/4: Minting License Token to Lab │'));
|
|
139
|
+
console.log(chalk_1.default.bold('└─────────────────────────────────────────────────┘'));
|
|
140
|
+
const spinnerToken = (0, ora_1.default)('Minting license token...').start();
|
|
141
|
+
try {
|
|
142
|
+
const tokenResult = await api.shareWithLab({
|
|
143
|
+
ip_id: ipAssetId,
|
|
144
|
+
lab_wallet: options.lab,
|
|
145
|
+
license_type: licenseType
|
|
146
|
+
});
|
|
147
|
+
spinnerToken.succeed();
|
|
148
|
+
console.log(`${chalk_1.default.gray('🏥 Recipient:')} ${lab.name} (${formatWallet(options.lab)})`);
|
|
149
|
+
console.log(`${chalk_1.default.gray('🎫 License Token ID:')} ${tokenResult.license_token_id}`);
|
|
150
|
+
console.log(`${chalk_1.default.gray('⛓️ Tx Hash:')} ${tokenResult.tx_hash}`);
|
|
151
|
+
console.log(chalk_1.default.green('✅ License token granted!\n'));
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
spinnerToken.fail();
|
|
155
|
+
logger_1.Logger.error(`Failed to mint license token: ${error}`);
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
// Success summary
|
|
159
|
+
const summary = [
|
|
160
|
+
chalk_1.default.bold.green('🎉 Biofile Successfully Shared!'),
|
|
161
|
+
'',
|
|
162
|
+
`${chalk_1.default.gray('BioCID (Sequentias):')}`,
|
|
163
|
+
chalk_1.default.cyan(`${biocid}`),
|
|
164
|
+
'',
|
|
165
|
+
`${chalk_1.default.gray('IP Asset (Story Protocol):')}`,
|
|
166
|
+
chalk_1.default.cyan(`https://explorer.story.foundation/ipa/${ipAssetId}`),
|
|
167
|
+
'',
|
|
168
|
+
`${chalk_1.default.gray('Lab can now access via:')}`,
|
|
169
|
+
chalk_1.default.gray(`$ biofs download --biocid ${biocid}`)
|
|
170
|
+
].join('\n');
|
|
171
|
+
console.log(chalk_1.default.green('\n' + '─'.repeat(60)));
|
|
172
|
+
console.log(summary);
|
|
173
|
+
console.log(chalk_1.default.green('─'.repeat(60) + '\n'));
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
logger_1.Logger.error(`Share failed: ${error}`);
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function formatWallet(wallet) {
|
|
181
|
+
if (wallet.length === 42) {
|
|
182
|
+
return `${wallet.slice(0, 6)}...${wallet.slice(-4)}`;
|
|
183
|
+
}
|
|
184
|
+
return wallet;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=share.js.map
|