fix(near): don't block/throw wallet on account creation network call
This commit is contained in:
parent
b45f4369c0
commit
757ed43909
@ -88,25 +88,23 @@ export class NearWallet {
|
||||
const accountId = `dev-${Date.now()}-${randomNumber}`
|
||||
const publicKey = keyPair.getPublicKey().toString()
|
||||
|
||||
return fetch(`https://helper.testnet.near.org/account`, {
|
||||
fetch(`https://helper.testnet.near.org/account`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
newAccountId: accountId,
|
||||
newAccountPublicKey: publicKey
|
||||
})
|
||||
}).then(res => {
|
||||
if (res.ok) {
|
||||
}).catch(error => {
|
||||
console.error('Failed to create NEAR dev account: ', error)
|
||||
})
|
||||
|
||||
return {
|
||||
accountId,
|
||||
keyPair
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('Failed to create NEAR dev account')
|
||||
})
|
||||
}
|
||||
|
||||
private constructor(networkId: string, keyStore: nearKeyStores.KeyStore) {
|
||||
this.networkId = networkId
|
||||
this.keyStore = keyStore
|
||||
|
Loading…
Reference in New Issue
Block a user