message: Remove unnecessary promise wrapper
diff: @@ -16,7 +16,6 @@ export type GaiaHubConfig = {
  export function uploadToGaiaHub(filename: string, contents: any,
  hubConfig: GaiaHubConfig,
  contentType: string = 'application/octet-stream'): Promise<*> {
  - return new Promise((resolve) => {
  console.log(`uploadToGaiaHub: uploading ${filename} to ${hubConfig.server}`)
  return fetch(`${hubConfig.server}/store/${hubConfig.address}/${filename}`,
  { method: 'POST',
  @@ -27,10 +26,7 @@ export function uploadToGaiaHub(filename: string, contents: any,
  body: contents })
  .then((response) => response.text())
  .then((responseText) => JSON.parse(responseText))
  - .then((responseJSON) => {
  - resolve(responseJSON.publicURL)
  - })
  - })
  + .then((responseJSON) => responseJSON.publicURL)
  }
  export function getFullReadUrl(filename: string,
  @@ -40,10 +36,9 @@ export function getFullReadUrl(filename: string,
  export function connectToGaiaHub(gaiaHubUrl: string, challengeSignerHex: string): Promise<*> {
  console.log(`connectToGaiaHub: ${gaiaHubUrl}/hub_info`)
  - const challengeSigner = new bitcoin.ECPair(
  - bigi.fromHex(challengeSignerHex))
  - return new Promise((resolve) => {
  - fetch(`${gaiaHubUrl}/hub_info`)
  + const challengeSigner = new bitcoin.ECPair(bigi.fromHex(challengeSignerHex))
  +
  + return fetch(`${gaiaHubUrl}/hub_info`)
  .then((response) => response.text())
  .then((responseText) => JSON.parse(responseText))
  .then((responseJSON) => {
  @@ -57,11 +52,11 @@ export function connectToGaiaHub(gaiaHubUrl: string, challengeSignerHex: string)
  const token = new Buffer(JSON.stringify(
  { publickey, signature })).toString('base64')
  const address = challengeSigner.getAddress()
  - resolve({ url_prefix: readURL,
  + return { url_prefix: readURL,
  address,
  token,
  server: gaiaHubUrl }
  - ) }) })
  + })
  }
  /**
  @@ -93,7 +88,7 @@ export function setLocalGaiaHubConnection(): Promise<*> {
  export function getOrSetLocalGaiaHubConnection(): Promise<*> {
  const hubConfig = JSON.parse(localStorage.getItem(BLOCKSTACK_GAIA_HUB_LABEL))
  if (hubConfig !== null) {
  - return new Promise((resolve) => resolve(hubConfig))
  + return Promise.resolve(hubConfig)
  } else {
  return setLocalGaiaHubConnection()
  }
  @@ -102,15 +97,14 @@ export function getOrSetLocalGaiaHubConnection(): Promise<*> {
  export function getBucketUrl(gaiaHubUrl, appPrivateKey): Promise<*> {
  console.log(`connectToGaiaHub: ${gaiaHubUrl}/hub_info`)
  const challengeSigner = new bitcoin.ECPair(bigi.fromHex(appPrivateKey))
  - return new Promise((resolve) => {
  - fetch(`${gaiaHubUrl}/hub_info`)
  +
  + return fetch(`${gaiaHubUrl}/hub_info`)
  .then((response) => response.text())
  .then((responseText) => JSON.parse(responseText))
  .then((responseJSON) => {
  const readURL = responseJSON.read_url_prefix
  const address = challengeSigner.getAddress()
  const bucketUrl = `${readURL}${address}/`
  - resolve(bucketUrl)
  - })
  + return bucketUrl
  })
  }
  