Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit 5f7fa28

Browse files
committed
Merge branch 'release/v0.35.0'
2 parents f6bb52c + fd4c1f5 commit 5f7fa28

19 files changed

Lines changed: 568 additions & 233 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ And a few other smaller modules (these can be found in `package.json`).
160160

161161
## Maintainer
162162

163-
This repository is maintained by [yukan.id](https://explorer.blockstack.org/name/yukan.id).
163+
This repository is maintained by [hankstoever.id](https://explorer.blockstack.org/name/hankstoever.id).
164164

165165
## Testing
166166

app/js/account/store/account/actions.js

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -433,62 +433,46 @@ function withdrawBitcoinFromCoreWallet(
433433
}
434434
}
435435

436-
function refreshBalances(insightUrl, addresses, coreAPIPassword) {
436+
function refreshBalances(balanceURL, addresses) {
437437
return dispatch => {
438438
const results = []
439439
return Promise.all(
440440
addresses.map(address => {
441-
logger.debug(
441+
logger.debug(
442442
`refreshBalances: refreshing balances for address ${address}`
443443
)
444-
const insightUrls = getInsightUrls(insightUrl, address, coreAPIPassword)
445-
const confirmedBalanceUrl = insightUrls.confirmedBalanceUrl
446-
const unconfirmedBalanceUrl = insightUrls.unconfirmedBalanceUrl
447-
return fetch(confirmedBalanceUrl)
444+
445+
return fetch(`${balanceURL}${address}`)
448446
.then(response => response.text())
449-
.then(responseText => {
450-
const confirmedBalance = parseInt(responseText, 10)
451-
fetch(unconfirmedBalanceUrl)
452-
.then(response => response.text())
453-
.then(balanceResponseText => {
454-
const unconfirmedBalance = parseInt(balanceResponseText, 10)
455-
results.push({
456-
address,
457-
balance: satoshisToBtc(unconfirmedBalance + confirmedBalance)
458-
})
459-
460-
if (results.length >= addresses.length) {
461-
let balances = {}
462-
let total = 0.0
463-
464-
for (let i = 0; i < results.length; i++) {
465-
const thisAddress = results[i].address
466-
if (!balances.hasOwnProperty(thisAddress)) {
467-
const balance = results[i].balance
468-
total = total + balance
469-
balances[thisAddress] = balance
470-
} else {
471-
logger.error(
472-
`refreshBalances: Duplicate address ${thisAddress} in addresses array`
473-
)
474-
}
475-
}
476-
477-
balances.total = total
478-
479-
dispatch(updateBalances(balances))
447+
.then(response => {
448+
results.push({
449+
address,
450+
balance: satoshisToBtc(parseInt(response))
451+
})
452+
453+
if (results.length >= addresses.length) {
454+
let balances = {}
455+
let total = 0.0
456+
457+
for (let i = 0; i < results.length; i++) {
458+
const thisAddress = results[i].address
459+
if (!balances.hasOwnProperty(thisAddress)) {
460+
const balance = results[i].balance
461+
total = total + balance
462+
balances[thisAddress] = balance
463+
} else {
464+
logger.error(
465+
`refreshBalances: Duplicate address ${thisAddress} in addresses array`
466+
)
480467
}
481-
})
482-
.catch(error => {
483-
logger.error(
484-
`refreshBalances: error fetching ${address} unconfirmed balance`,
485-
error
486-
)
487-
})
468+
}
469+
balances.total = total
470+
dispatch(updateBalances(balances))
471+
}
488472
})
489473
.catch(error => {
490474
logger.error(
491-
`refreshBalances: error fetching ${address} confirmed balance`,
475+
`refreshBalances: error fetching ${address} balance`,
492476
error
493477
)
494478
})

app/js/account/store/settings/actions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function resetApi(api) {
6363
}
6464
}
6565

66-
function connectStorage() {
66+
function connectStorage(customGaiaUrl) {
6767
return async (dispatch, getState) => {
6868
logger.info('connectStorage')
6969
const state = getState()
@@ -75,9 +75,12 @@ function connectStorage() {
7575
return Promise.reject()
7676
}
7777

78-
return connectToGaiaHub(api.gaiaHubUrl, idKeypairs[0].key).then(gaiaHubConfig => {
78+
const gaiaHubUrl = customGaiaUrl || api.gaiaHubUrl
79+
80+
return connectToGaiaHub(gaiaHubUrl, idKeypairs[0].key).then(gaiaHubConfig => {
7981
const newApi = Object.assign({}, api, {
8082
gaiaHubConfig,
83+
gaiaHubUrl,
8184
hostedDataLocation: BLOCKSTACK_INC
8285
})
8386
dispatch(updateApi(newApi))

app/js/account/store/settings/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const DEFAULT_API = {
2121
bitcoinAddressLookupUrl: `${DEFAULT_CORE_API_ENDPOINT}/v1/addresses/bitcoin/{address}`,
2222
zeroConfBalanceUrl: `${DEFAULT_CORE_API_ENDPOINT}/v1/wallet/balance/0`,
2323
insightUrl: 'https://utxo.blockstack.org/insight-api/addr/{address}',
24+
btcBalanceUrl: 'https://blockchain.info/q/addressbalance/',
2425
broadcastUrl: 'https://utxo.blockstack.org/insight-api/tx/send',
2526
priceUrl: `${DEFAULT_CORE_API_ENDPOINT}/v1/prices/names/{name}`,
2627
networkFeeUrl: 'https://bitcoinfees.21.co/api/v1/fees/recommended',

app/js/auth/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ class AuthPage extends React.Component {
271271
profile.apps = apps
272272
const signedProfileTokenData = signProfileForUpload(
273273
profile,
274-
nextProps.identityKeypairs[identityIndex]
274+
nextProps.identityKeypairs[identityIndex],
275+
this.props.api
275276
)
276277
logger.debug(
277278
'componentWillReceiveProps: uploading updated profile with new apps array'

app/js/components/styled/onboarding/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,20 @@ const Loading = styled.div`
433433
}
434434
`
435435

436+
const RecommendedHubPlaceholder = styled.div`
437+
background: #ececec;
438+
text-align: center;
439+
font-weight: 500;
440+
padding: 10px;
441+
margin-bottom: 2em;
442+
`
443+
444+
const Hr = styled.hr`
445+
border-top: 1px solid #ececec;
446+
width: 100%;
447+
margin-bottom: 2em;
448+
`
449+
436450
const PanelCard = ({ children, ...rest }) => (
437451
<Card {...rest}>
438452
<PlaceholderStyles />
@@ -458,5 +472,7 @@ Panel.Card.ErrorMessage.Icon = Icon
458472
Panel.Progress = Progress
459473
Panel.Progress.Dot = Dot
460474
Panel.Loading = Loading
475+
Panel.RecommendedHubPlaceholder = RecommendedHubPlaceholder
476+
Panel.Hr = Hr
461477

462478
export default Panel

app/js/profiles/components/registration/RegistrationSelectView.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function mapStateToProps(state) {
3030
balanceUrl: state.settings.api.zeroConfBalanceUrl,
3131
encryptedBackupPhrase: state.account.encryptedBackupPhrase,
3232
balances: state.account.bitcoinAccount.balances,
33-
insightUrl: state.settings.api.insightUrl
33+
btcBalanceUrl: state.settings.api.btcBalanceUrl
3434
}
3535
}
3636

@@ -54,7 +54,7 @@ class AddUsernameSelectPage extends Component {
5454
encryptedBackupPhrase: PropTypes.string.isRequired,
5555
addresses: PropTypes.array.isRequired,
5656
balances: PropTypes.object.isRequired,
57-
insightUrl: PropTypes.string.isRequired,
57+
btcBalanceUrl: PropTypes.string.isRequired,
5858
refreshBalances: PropTypes.func.isRequired
5959
}
6060

@@ -93,8 +93,7 @@ class AddUsernameSelectPage extends Component {
9393
if (!enoughMoney) {
9494
this.paymentTimer = setInterval(() => {
9595
logger.debug('paymentTimer: calling refreshBalances...')
96-
that.props.refreshBalances(that.props.insightUrl, that.props.addresses,
97-
that.props.api.coreAPIPassword)
96+
that.props.refreshBalances(that.props.btcBalanceUrl, that.props.addresses)
9897
}, CHECK_FOR_PAYMENT_INTERVAL)
9998
}
10099
this.state = {
@@ -114,8 +113,7 @@ class AddUsernameSelectPage extends Component {
114113

115114
componentDidMount() {
116115
logger.info('componentDidMount')
117-
this.props.refreshBalances(this.props.insightUrl, this.props.addresses,
118-
this.props.api.coreAPIPassword)
116+
this.props.refreshBalances(this.props.btcBalanceUrl, this.props.addresses)
119117

120118
// Only consider top level domains for showing the alert
121119
if (!isSubdomain(this.props.routeParams.name)) {

app/js/profiles/store/identity/actions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ function createNewProfile(
271271
function refreshIdentities(
272272
api: {
273273
bitcoinAddressLookupUrl: string,
274-
nameLookupUrl: string
274+
nameLookupUrl: string,
275+
gaiaHubConfig: {
276+
url_prefix: string,
277+
},
275278
},
276279
ownerAddresses: Array<string>
277280
) {
@@ -292,7 +295,7 @@ function refreshIdentities(
292295
)
293296
const gaiaBucketAddress = ownerAddresses[0]
294297
return fetchProfileLocations(
295-
'https://gaia.blockstack.org/hub',
298+
api.gaiaHubConfig.url_prefix,
296299
address,
297300
gaiaBucketAddress,
298301
index

app/js/profiles/store/registration/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function registerName(api, domainName, identity, identityIndex,
147147
return dispatch => {
148148
logger.debug(`Signing a new profile for ${domainName}`)
149149
const profile = identity.profile || DEFAULT_PROFILE
150-
const signedProfileTokenData = signProfileForUpload(profile, keypair)
150+
const signedProfileTokenData = signProfileForUpload(profile, keypair, api)
151151

152152
dispatch(profileUploading())
153153
logger.info(`Uploading ${domainName} profile...`)

app/js/sign-in/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ class SignIn extends React.Component {
206206
this.props.api,
207207
this.props.identityAddresses
208208
)
209+
const identity = this.props.localIdentities[0]
210+
if (identity && identity.profile && identity.profile.api) {
211+
const newApi = {
212+
...this.props.api,
213+
...identity.profile.api
214+
}
215+
this.props.updateApi(newApi)
216+
}
209217
logger.debug('refreshIdentities complete')
210218
updateEmail(this.state.email)
211219
logger.debug('updated email')
@@ -427,7 +435,8 @@ SignIn.propTypes = {
427435
refreshIdentities: PropTypes.func.isRequired,
428436
localIdentities: PropTypes.array.isRequired,
429437
encryptedBackupPhrase: PropTypes.string,
430-
connectStorage: PropTypes.func.isRequired
438+
connectStorage: PropTypes.func.isRequired,
439+
updateApi: PropTypes.func.isRequired
431440
}
432441

433442
export default withRouter(

0 commit comments

Comments
 (0)