Skip to content

Commit 2680c17

Browse files
authored
Merge pull request #109 from lighthouse-web3/v0.3.1
V0.3.1
2 parents 4504f6e + d498c55 commit 2680c17

File tree

19 files changed

+95
-117
lines changed

19 files changed

+95
-117
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Lighthouse <img src="https://img.shields.io/badge/BETA-v0.3.0-green"/>
1+
# Lighthouse <img src="https://img.shields.io/badge/BETA-v0.3.1-green"/>
22

33
Lighthouse is a permanent decentralized file storage protocol that allows the ability to pay once and store forever. While traditionally, users need to repeatedly keep track and pay for their storage after every fixed amount of time, Lighthouse manages this for them and makes sure that user files are stored forever. The aim is to move users from a rent-based cost model where they are renting their own files on cloud storage to a permanent ownership model. It is built on top of IPFS, Filecoin, and Polygon. It uses the existing miner network and storage capacity of the filecoin network.
44

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lighthouse-web3/sdk",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "NPM package and CLI tool to interact with lighthouse protocol",
55
"main": "./dist/Lighthouse/index.js",
66
"types": "./dist/Lighthouse/index.d.ts",

src/Commands/balance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function (data: any, options: any) {
1515
spinner.start()
1616

1717
const response = await lighthouse.getBalance(
18-
config.get('LIGHTHOUSE_GLOBAL_PUBLICKEY') as string
18+
config.get('LIGHTHOUSE_GLOBAL_API_KEY') as string
1919
)
2020

2121
spinner.stop()

src/Commands/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import revokeAccess from './revoke-access'
1818
import resetPassword from './reset-password'
1919
import uploadEncrypted from './upload-encrypted'
2020
import podsi from './podsi'
21+
import { version } from '../../package.json'
2122

2223
const widgets = new Command('lighthouse-web3')
2324

@@ -72,7 +73,7 @@ Command.prototype.helpInformation = function (context: any) {
7273
}
7374

7475
widgets.addHelpText('before', 'Welcome to lighthouse-web3')
75-
widgets.version('0.3.0')
76+
widgets.version(version)
7677

7778
widgets
7879
.command('wallet')

src/Commands/podsi.ts

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,29 @@ export default async function (cid: any, options: any) {
1313
const { data } = await getPodsi(cid)
1414
console.log(bold().cyan('Piece Info:'))
1515
console.log(green('Piece CID:'), data.pieceCID)
16-
console.log(green('Piece Size:'), data.pieceSize)
17-
console.log(green('Car File Size:'), data.carFileSize)
1816

1917
console.log('\n' + bold().cyan('Proof Data:'))
20-
console.log(green('Piece CID:'), data.proof.pieceCID)
21-
console.log(green('ID:'), data.proof.id)
22-
console.log(
23-
green('Last Update:'),
24-
new Date(data.proof.lastUpdate * 1000).toLocaleString()
25-
)
2618

2719
console.log('\n' + bold().cyan('Inclusion Proof:'))
2820
console.log(
2921
green('Proof Index:'),
30-
data.proof.fileProof.inclusionProof.proofIndex.index
22+
data.dealInfo[0].proof.inclusionProof.proofIndex.index
3123
)
3224
console.log(green('Proof Paths:'))
33-
data.proof.fileProof.inclusionProof.proofIndex.path.forEach((path) => {
25+
data.dealInfo[0].proof.inclusionProof.proofIndex.path.forEach((path) => {
3426
console.log(yellow(' -'), path)
3527
})
3628

3729
console.log('\n' + bold().cyan('Proof Subtree:'))
3830
console.log(
3931
green('Index:'),
40-
data.proof.fileProof.inclusionProof.proofSubtree.index
32+
data.dealInfo[0].proof.inclusionProof.proofSubtree.index
4133
)
4234
console.log(green('Paths:'))
43-
data.proof.fileProof.inclusionProof.proofSubtree.path.forEach((path) => {
35+
data.dealInfo[0].proof.inclusionProof.proofSubtree.path.forEach((path) => {
4436
console.log(yellow(' -'), path)
4537
})
4638

47-
console.log('\n' + bold().cyan('Index Record:'))
48-
console.log(green('Checksum:'), data.proof.fileProof.indexRecord.checksum)
49-
console.log(
50-
green('Proof Index:'),
51-
data.proof.fileProof.indexRecord.proofIndex
52-
)
53-
console.log(
54-
green('Proof Subtree:'),
55-
data.proof.fileProof.indexRecord.proofSubtree
56-
)
57-
console.log(green('Size:'), data.proof.fileProof.indexRecord.size)
58-
59-
console.log('\n' + bold().cyan('Verifier Data:'))
60-
console.log(green('Comm Pc:'), data.proof.fileProof.verifierData.commPc)
61-
console.log(green('Size Pc:'), data.proof.fileProof.verifierData.sizePc)
62-
6339
console.log('\n' + bold().cyan('Deal Info:'))
6440
data.dealInfo.forEach((deal) => {
6541
console.log(green('Deal ID:'), deal.dealId)

src/Commands/upload-encrypted.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import bytesToSize from './utils/byteToSize'
88
import { config } from './utils/getNetwork'
99
import lighthouse from '../Lighthouse'
1010

11-
const getQuote = async (path: string, publicKey: string, Spinner: any) => {
11+
const getQuote = async (path: string, apiKey: string, Spinner: any) => {
1212
const spinner = new Spinner('Getting Quote...')
1313
spinner.start()
1414

15-
const quoteResponse: any = (await lighthouse.getQuote(path, publicKey)).data
15+
const quoteResponse: any = (await lighthouse.getQuote(path, apiKey)).data
1616
spinner.stop()
1717
process.stdout.clearLine(-1)
1818
process.stdout.cursorTo(0)
@@ -149,7 +149,7 @@ export default async function (_path: string) {
149149
// Display Quote
150150
const quoteResponse = await getQuote(
151151
path,
152-
config.get('LIGHTHOUSE_GLOBAL_PUBLICKEY') as string,
152+
config.get('LIGHTHOUSE_GLOBAL_API_KEY') as string,
153153
Spinner
154154
)
155155

src/Commands/upload.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import lighthouse from '../Lighthouse'
77
import bytesToSize from './utils/byteToSize'
88
import { config } from './utils/getNetwork'
99

10-
const getQuote = async (path: string, publicKey: string, Spinner: any) => {
10+
const getQuote = async (path: string, apiKey: string, Spinner: any) => {
1111
const spinner = new Spinner('Getting Quote...')
1212
spinner.start()
1313

14-
const quoteResponse: any = (await lighthouse.getQuote(path, publicKey)).data
14+
const quoteResponse: any = (await lighthouse.getQuote(path, apiKey)).data
1515
spinner.stop()
1616
process.stdout.clearLine(-1)
1717
process.stdout.cursorTo(0)
@@ -139,7 +139,7 @@ export default async function (_path: string) {
139139
// Display Quote
140140
const quoteResponse = await getQuote(
141141
path,
142-
config.get('LIGHTHOUSE_GLOBAL_PUBLICKEY') as string,
142+
config.get('LIGHTHOUSE_GLOBAL_API_KEY') as string,
143143
Spinner
144144
)
145145

src/Lighthouse/dealStatus/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ import axios from 'axios'
22
import { lighthouseConfig } from '../../lighthouse.config'
33

44
type dealData = {
5-
chainDealID: string
6-
endEpoch: string
5+
chainDealID: number
6+
endEpoch: number
77
publishCID: string
88
storageProvider: string
99
dealStatus: string
1010
bundleId: string
1111
dealUUID: string
12-
startEpoch: string
12+
startEpoch: number
13+
aggregateIn: string
1314
providerCollateral: string
15+
pieceCID: string
16+
payloadCid: string
17+
pieceSize: number
18+
carFileSize: number
1419
lastUpdate: number
1520
dealId: number
1621
miner: string
@@ -29,6 +34,7 @@ export default async (cid: string): Promise<dealResponse> => {
2934
`/api/lighthouse/deal_status?cid=${cid}`
3035
)
3136
).data
37+
3238
return { data: dealStatus }
3339
} catch (error: any) {
3440
throw new Error(error.message)

src/Lighthouse/getApiKey/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default async (
1414
try {
1515
const apiKey = (
1616
await axios.post(
17-
lighthouseConfig.lighthouseAPI + `/api/auth/get_api_key`,
17+
lighthouseConfig.lighthouseAPI + `/api/auth/create_api_key`,
1818
{
1919
publicKey: publicKey,
2020
signedMessage: signedMessage,

0 commit comments

Comments
 (0)