jupiter-fs
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -6,2 +6,9 @@ # Changelog | ||
## [0.1.1] - 2020-07-20 | ||
### Added | ||
- Update jupiter-node-sdk version supporting jupiter subtypes for metis | ||
### Changed | ||
- Using SUBTYPE_MESSAGING_METIS_DATA subtype to filter request by the sutbypte | ||
## [0.1.0] - 2020-07-07 | ||
@@ -8,0 +15,0 @@ ### Added |
@@ -41,2 +41,4 @@ "use strict"; | ||
const CHUNK_SIZE_PATTERN = /.{1,40000}/g; | ||
const TYPE_MESSAGING = 1; | ||
const SUBTYPE_MESSAGING_METIS_DATA = 15; | ||
return { | ||
@@ -85,3 +87,3 @@ key: `jupiter-fs`, | ||
}; | ||
await this.client.storeRecord(newAddyInfo); | ||
await this.client.storeRecord(newAddyInfo, SUBTYPE_MESSAGING_METIS_DATA); | ||
addy = newAddyInfo; | ||
@@ -115,3 +117,3 @@ } | ||
// Get all the transactions for the main jupiter account | ||
const allTxns = await this.client.getAllTransactions(); | ||
const allTxns = await this.client.getAllTransactions(true, TYPE_MESSAGING, SUBTYPE_MESSAGING_METIS_DATA); | ||
// for each transaction, check if contains the jupiter-fs metaDataKey and | ||
@@ -140,3 +142,3 @@ // decrypt the chuncked transactions | ||
async ls() { | ||
const allTxns = await this.client.getAllTransactions(); | ||
const allTxns = await this.client.getAllTransactions(true, TYPE_MESSAGING, SUBTYPE_MESSAGING_METIS_DATA); | ||
const allFilesObj = (await Promise.all(allTxns.map(async (txn) => { | ||
@@ -181,4 +183,4 @@ try { | ||
return await this.binaryClient.storeRecord({ | ||
data: str, | ||
}); | ||
data: str | ||
}, SUBTYPE_MESSAGING_METIS_DATA); | ||
}, errorCallback); | ||
@@ -194,7 +196,7 @@ return transaction; | ||
}; | ||
await this.client.storeRecord(masterRecord); | ||
await this.client.storeRecord(masterRecord, SUBTYPE_MESSAGING_METIS_DATA); | ||
return masterRecord; | ||
}, | ||
async deleteFile(id) { | ||
await this.client.storeRecord({ id, isDeleted: true }); | ||
await this.client.storeRecord({ id, isDeleted: true }, SUBTYPE_MESSAGING_METIS_DATA); | ||
return true; | ||
@@ -217,3 +219,3 @@ }, | ||
// if not found, search in the confirmed transactions | ||
txns = await this.binaryClient.getAllConfirmedTransactions(); | ||
txns = await this.binaryClient.getAllConfirmedTransactions(true, TYPE_MESSAGING, SUBTYPE_MESSAGING_METIS_DATA); | ||
const files = await this.ls(); | ||
@@ -220,0 +222,0 @@ const targetFile = files.find((t) => (id && id === t.id) || t.fileName === name); |
@@ -17,9 +17,8 @@ "use strict"; | ||
describe('JupiterFs', function () { | ||
assert_1.default(process.env.JUPITER_ADDRESS, 'JUPITER_ADDRESS env variable is not set'); | ||
assert_1.default(process.env.JUPITER_PASSPHRASE, 'JUPITER_PASSPHRASE env variable is not set'); | ||
// const fs = JupiterFs({ server: 'http://localhost:6876' }) | ||
this.timeout(40000); | ||
// const fs = JupiterFs({ server: 'http://localhost:7876' }) | ||
const jupFs = JupiterFs_1.default({ | ||
server: process.env.JUPITER_SERVER || 'http://104.131.166.136:6876/test', | ||
address: process.env.JUPITER_ADDRESS, | ||
passphrase: process.env.JUPITER_PASSPHRASE, | ||
server: 'http://localhost:6876', | ||
address: 'JUP-XTAE-VA6X-4SRT-AU89L', | ||
passphrase: 'b', | ||
}); | ||
@@ -39,3 +38,3 @@ const testFilename = `${uuid_1.v1()}.js`; | ||
}); | ||
xdescribe('#ls()', function () { | ||
describe('#ls()', function () { | ||
it(`should fetch a list of files for a jupiter account`, async () => { | ||
@@ -50,3 +49,5 @@ const files = await jupFs.ls(); | ||
console.log("filename " + testFilename); | ||
const res = await jupFs.writeFile(testFilename, fileData, assert_1.default.fail); | ||
const res = await jupFs.writeFile(testFilename, fileData, function (errorr) { | ||
console.log("erorrrrrrrrrrrrr" + errorr); | ||
}); | ||
assert_1.default.strictEqual(res.fileName, testFilename); | ||
@@ -53,0 +54,0 @@ assert_1.default.strictEqual(res.txns.length > 0, true); |
{ | ||
"name": "jupiter-fs", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A small file system implementation for the Jupiter blockchain.", | ||
@@ -26,3 +26,3 @@ "main": "./dist/JupiterFs.js", | ||
"dependencies": { | ||
"jupiter-node-sdk": "^0.2.1", | ||
"jupiter-node-sdk": "^0.3.1", | ||
"uuid": "^8.3.2" | ||
@@ -29,0 +29,0 @@ }, |
@@ -47,11 +47,1 @@ # jupiter-fs | ||
await jupFs.deleteFile('123e4567-e89b-42d3-a456-556642440000') | ||
``` | ||
# Tips w/ cryptocurrency | ||
I love FOSS (free and open source software) and for the most part don't want to charge for the software I build. It does however take a good bit of time keeping up with feature requests and bug fixes, so if you have the desire and ability to send me a free coffee, it would be greatly appreciated! | ||
- Bitcoin (BTC): `3D779dP5SZo4szHivWHyFd6J2ESumwDmph` | ||
- Ethereum (ETH and ERC-20 tokens): `0xF3ffa9706b3264EDd1DAa93D5F5D70C8f71fAc99` | ||
- Stellar (XLM): `GACH6YMYFZ574FSGCV7IJXTGETEQL3DLQK64Z6DFGD57PZL5RH6LYOJT` | ||
- Jupiter (JUP) mainnet: `JUP-TUWZ-4B8Z-9REP-2YVH5` |
@@ -13,14 +13,10 @@ import assert from 'assert' | ||
describe('JupiterFs', function() { | ||
assert(process.env.JUPITER_ADDRESS, 'JUPITER_ADDRESS env variable is not set') | ||
assert( | ||
process.env.JUPITER_PASSPHRASE, | ||
'JUPITER_PASSPHRASE env variable is not set' | ||
) | ||
this.timeout(40000) | ||
// const fs = JupiterFs({ server: 'http://localhost:6876' }) | ||
const jupFs = JupiterFs({ | ||
server: process.env.JUPITER_SERVER || 'http://104.131.166.136:6876/test', | ||
address: process.env.JUPITER_ADDRESS, | ||
passphrase: process.env.JUPITER_PASSPHRASE, | ||
}) | ||
// const fs = JupiterFs({ server: 'http://localhost:7876' }) | ||
const jupFs = JupiterFs({ | ||
server: 'http://localhost:6876', | ||
address: 'JUP-XTAE-VA6X-4SRT-AU89L', | ||
passphrase: 'b', | ||
}); | ||
const testFilename = `${uuidv1()}.js` | ||
@@ -42,3 +38,3 @@ | ||
xdescribe('#ls()', function() { | ||
describe('#ls()', function() { | ||
it(`should fetch a list of files for a jupiter account`, async () => { | ||
@@ -50,3 +46,3 @@ const files = await jupFs.ls() | ||
describe('#writeFile()', function() { | ||
describe('#writeFile()', function() { | ||
it(`should write a file to a jupiter account without error`, async () => { | ||
@@ -58,3 +54,5 @@ const fileData = await fs.promises.readFile( | ||
console.log("filename " + testFilename); | ||
const res = await jupFs.writeFile(testFilename, fileData, assert.fail) | ||
const res = await jupFs.writeFile(testFilename, fileData, function(errorr: any){ | ||
console.log("erorrrrrrrrrrrrr" + errorr) | ||
}) | ||
assert.strictEqual(res.fileName, testFilename) | ||
@@ -61,0 +59,0 @@ assert.strictEqual(res.txns.length > 0, true) |
@@ -28,2 +28,5 @@ import assert from 'assert' | ||
const TYPE_MESSAGING = 1; | ||
const SUBTYPE_MESSAGING_METIS_DATA = 15; | ||
return { | ||
@@ -80,3 +83,3 @@ key: `jupiter-fs`, | ||
} | ||
await this.client.storeRecord(newAddyInfo) | ||
await this.client.storeRecord(newAddyInfo, SUBTYPE_MESSAGING_METIS_DATA) | ||
addy = newAddyInfo | ||
@@ -117,3 +120,3 @@ } | ||
// Get all the transactions for the main jupiter account | ||
const allTxns = await this.client.getAllTransactions() | ||
const allTxns = await this.client.getAllTransactions(true, TYPE_MESSAGING, SUBTYPE_MESSAGING_METIS_DATA) | ||
// for each transaction, check if contains the jupiter-fs metaDataKey and | ||
@@ -152,3 +155,3 @@ // decrypt the chuncked transactions | ||
async ls() { | ||
const allTxns = await this.client.getAllTransactions() | ||
const allTxns = await this.client.getAllTransactions(true, TYPE_MESSAGING, SUBTYPE_MESSAGING_METIS_DATA) | ||
const allFilesObj: any = ( | ||
@@ -210,4 +213,4 @@ await Promise.all( | ||
return await this.binaryClient.storeRecord({ | ||
data: str, | ||
}) | ||
data: str | ||
}, SUBTYPE_MESSAGING_METIS_DATA) | ||
}, errorCallback) | ||
@@ -226,3 +229,3 @@ return transaction | ||
await this.client.storeRecord(masterRecord) | ||
await this.client.storeRecord(masterRecord, SUBTYPE_MESSAGING_METIS_DATA) | ||
return masterRecord | ||
@@ -232,3 +235,3 @@ }, | ||
async deleteFile(id: string): Promise<boolean> { | ||
await this.client.storeRecord({ id, isDeleted: true }) | ||
await this.client.storeRecord({ id, isDeleted: true }, SUBTYPE_MESSAGING_METIS_DATA) | ||
return true | ||
@@ -259,3 +262,3 @@ }, | ||
// if not found, search in the confirmed transactions | ||
txns = await this.binaryClient.getAllConfirmedTransactions() | ||
txns = await this.binaryClient.getAllConfirmedTransactions(true, TYPE_MESSAGING, SUBTYPE_MESSAGING_METIS_DATA) | ||
const files = await this.ls() | ||
@@ -262,0 +265,0 @@ const targetFile = files.find( |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
237938
15
843
1
0
47
+ Addedjupiter-node-sdk@0.3.1(transitive)
- Removedjupiter-node-sdk@0.2.1(transitive)
Updatedjupiter-node-sdk@^0.3.1