Skip to content

Commit

Permalink
add W3_NFTSTORAGE_ env vars to bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Mar 21, 2024
1 parent 06b0718 commit ededb89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/api/src/bindings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UserOutput, UserOutputKey } from './utils/db-client-types.js'
import { DBClient } from './utils/db-client.js'
import { LinkdexApi } from './utils/linkdex.js'
import { Logging } from './utils/logs.js'
import { Client as W3upClient } from '@web3-storage/w3up-client'

export type RuntimeEnvironmentName = 'test' | 'dev' | 'staging' | 'production'

Expand Down Expand Up @@ -99,6 +100,12 @@ export interface ServiceConfiguration {

/** w3up connection URL (e.g. https://up.web3.storage) */
W3UP_URL?: string

/** base64 encoded multiformats ed25519 secretKey */
W3_NFTSTORAGE_PRINCIPAL?: string

/** CID (identity codec) of CAR-encoded UCAN DAG */
W3_NFTSTORAGE_PROOF?: string
}

export interface Ucan {
Expand Down Expand Up @@ -132,6 +139,7 @@ export interface RouteContext {
ucanService: Service
auth?: Auth
W3UP_URL?: string
w3up?: W3upClient
}

export type Handler = (
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/nfts-upload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -973,9 +973,9 @@ async function createListeningMockW3up() {
server.addListener('listening', () => resolve(undefined))
})
const serverAddress = server.address()
if (typeof serverAddress === 'string')
if (typeof serverAddress === 'string' || !serverAddress)
throw new Error('server.address() must not return a string')
const url = new URL(`http://localhost:${serverAddress?.port ?? ''}`)
const url = new URL(`http://localhost:${serverAddress.port}`)
return {
get requestCount() {
return requestCount
Expand Down

0 comments on commit ededb89

Please sign in to comment.