Skip to content

Commit

Permalink
nft-upload route logs w3upConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Mar 21, 2024
1 parent 6d14169 commit c4d1289
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/api/src/bindings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ export interface RouteContext {
ucanService: Service
auth?: Auth
W3UP_URL?: string
W3_NFTSTORAGE_PRINCIPAL?: string
W3_NFTSTORAGE_PROOF?: string
W3_NFTSTORAGE_SPACE?: string
w3up?: W3upClient
}

Expand Down
9 changes: 9 additions & 0 deletions packages/api/src/routes/nfts-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { createCarCid } from '../utils/car.js'
import { JSONResponse } from '../utils/json-response.js'
import { checkAuth } from '../utils/auth.js'
import { toNFTResponse } from '../utils/db-transforms.js'
import { createW3upClientFromConfig } from '../utils/w3up.js'

const MAX_BLOCK_SIZE = 1 << 21 // Maximum permitted block size in bytes (2MiB).
const decoders = [pb, raw, cbor]
Expand Down Expand Up @@ -105,6 +106,14 @@ export async function nftUpload(event, ctx) {
})
}

const w3upConfig = {
W3UP_URL: ctx.W3UP_URL,
W3_NFTSTORAGE_PRINCIPAL: ctx.W3_NFTSTORAGE_PRINCIPAL,
W3_NFTSTORAGE_PROOF: ctx.W3_NFTSTORAGE_PROOF,
W3_NFTSTORAGE_SPACE: ctx.W3_NFTSTORAGE_SPACE,
}
console.log('in nfts-upload handler w/ w3up', w3upConfig)

if (ctx.W3UP_URL) {
const w3upResponse = await fetch(ctx.W3UP_URL)
}
Expand Down

0 comments on commit c4d1289

Please sign in to comment.