File tree Expand file tree Collapse file tree 6 files changed +60
-18
lines changed Expand file tree Collapse file tree 6 files changed +60
-18
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,20 @@ import axios from 'axios'
22import { lighthouseConfig } from '../../lighthouse.config'
33
44type 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 )
Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change @@ -8,13 +8,18 @@ export type balanceResponse = {
88 }
99}
1010
11- export default async ( publicKey : string ) : Promise < balanceResponse > => {
11+ export default async ( apiKey : string ) : Promise < balanceResponse > => {
1212 try {
1313 // Get users data usage
1414 const userDataUsage = (
1515 await axios . get (
1616 lighthouseConfig . lighthouseAPI +
17- `/api/user/user_data_usage?publicKey=${ publicKey } `
17+ `/api/user/user_data_usage` ,
18+ {
19+ headers : {
20+ Authorization : `Bearer ${ apiKey } ` ,
21+ } ,
22+ }
1823 )
1924 ) . data
2025 /*
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import getBalance from '../getBalance'
33import { walk } from '../upload/files/node'
44
55// Function return cost and file metadata
6- const getCosting = async ( path : string , publicKey : string ) => {
6+ const getCosting = async ( path : string , apiKey : string ) => {
77 const fs = eval ( `require` ) ( 'fs-extra' )
88 const mime = eval ( `require` ) ( 'mime-types' )
99 // Get users data usage
10- const user_data_usage = ( await getBalance ( publicKey ) ) . data
10+ const user_data_usage = ( await getBalance ( apiKey ) ) . data
1111 if ( fs . lstatSync ( path ) . isDirectory ( ) ) {
1212 // Get metadata and cid for all files
1313 const sources = await walk ( path )
@@ -63,9 +63,9 @@ const getCosting = async (path: string, publicKey: string) => {
6363 }
6464}
6565
66- export default async ( path : string , publicKey : string ) => {
66+ export default async ( path : string , apiKey : string ) => {
6767 try {
68- return await getCosting ( path , publicKey )
68+ return await getCosting ( path , apiKey )
6969 } catch ( error : any ) {
7070 throw new Error ( error . message )
7171 }
Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ export type uploadsResponseType = {
2424
2525export default async (
2626 authToken : string ,
27- pageNo = 1
27+ lastKey : string | null = null
2828) : Promise < uploadsResponseType > => {
2929 try {
3030 const uploads = (
3131 await axios . get (
3232 lighthouseConfig . lighthouseAPI +
33- `/api/user/files_uploaded?pageNo =${ pageNo } ` ,
33+ `/api/user/files_uploaded?lastKey =${ lastKey } ` ,
3434 {
3535 headers : {
3636 Authorization : `Bearer ${ authToken } ` ,
@@ -41,8 +41,7 @@ export default async (
4141
4242 /*
4343 {
44- data: {
45- "fileList":[
44+ "fileList":[
4645 {
4746 publicKey: '0xa3c960b3ba29367ecbcaf1430452c6cd7516f588',
4847 fileName: 'flow1.png',
@@ -57,8 +56,7 @@ export default async (
5756 encryption: true
5857 },
5958 ],
60- "totalFiles": 75
61- }
59+ "totalFiles": 75
6260 }
6361 */
6462 return { data : uploads }
Original file line number Diff line number Diff line change 11import axios from 'axios'
22import { defaultConfig } from '../../lighthouse.config'
3- import { IPodsiData } from '../../types'
43
5- export default async ( cid : string ) : Promise < { data : IPodsiData } > => {
4+ type Proof = {
5+ verifierData : {
6+ commPc : string
7+ sizePc : string
8+ }
9+ inclusionProof : {
10+ proofIndex : {
11+ index : string
12+ path : string [ ]
13+ }
14+ proofSubtree : {
15+ index : string
16+ path : string [ ]
17+ }
18+ indexRecord : {
19+ checksum : string
20+ proofIndex : string
21+ proofSubtree : number
22+ size : number
23+ }
24+ }
25+ }
26+
27+ type DealInfo = {
28+ dealId : number
29+ storageProvider : string
30+ proof : Proof
31+ }
32+
33+ type PODSIData = {
34+ pieceCID : string
35+ dealInfo : DealInfo [ ]
36+ }
37+
38+ export default async ( cid : string ) : Promise < { data : PODSIData } > => {
639 try {
740 const response = await axios . get (
841 defaultConfig . lighthouseAPI + `/api/lighthouse/get_proof?cid=${ cid } `
You can’t perform that action at this time.
0 commit comments