MCPcopy Create free account
hub / github.com/bitpay/bitcore / fromObj

Method fromObj

packages/bitcore-wallet-client/src/lib/api.ts:414–430  ·  view source on GitHub ↗
(credentials)

Source from the content-addressed store, hash-verified

412 }
413
414 fromObj(credentials) {
415 $.checkArgument(credentials && typeof credentials === 'object' && !Array.isArray(credentials), 'Argument should be an object');
416
417 try {
418 credentials = Credentials.fromObj(credentials);
419 this.credentials = credentials;
420 } catch (ex) {
421 log.warn(`Error importing wallet: ${ex}`);
422 if (ex.toString().match(/Obsolete/)) {
423 throw new Errors.OBSOLETE_BACKUP();
424 } else {
425 throw new Errors.INVALID_BACKUP();
426 }
427 }
428 this.request.setCredentials(this.credentials);
429 return this;
430 }
431
432 /**
433 * Import credentials from a string

Callers 12

fromStringMethod · 0.95
toCloneMethod · 0.95
cloneMethod · 0.95
createMethod · 0.45
createFromTssMethod · 0.45
loadMethod · 0.45
importMethod · 0.45
api.test.tsFile · 0.45
helpers.tsFile · 0.45
createWalletMethod · 0.45
joinWalletMethod · 0.45
serverAssistedImportMethod · 0.45

Calls 4

warnMethod · 0.80
matchMethod · 0.80
setCredentialsMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected