MCPcopy
hub / github.com/bcoin-org/bcoin / from

Method from

lib/btc/amount.js:207–220  ·  view source on GitHub ↗

* Inject properties from unit. * @private * @param {String} unit * @param {Number|String} value * @returns {Amount}

(unit, value)

Source from the content-addressed store, hash-verified

205 */
206
207 from(unit, value) {
208 switch (unit) {
209 case 'sat':
210 return this.fromSatoshis(value);
211 case 'ubtc':
212 case 'bits':
213 return this.fromBits(value);
214 case 'mbtc':
215 return this.fromMBTC(value);
216 case 'btc':
217 return this.fromBTC(value);
218 }
219 throw new Error(`Unknown unit "${unit}".`);
220 }
221
222 /**
223 * Instantiate amount from options.

Callers 15

fromOptionsMethod · 0.95
handleConnectMethod · 0.80
initMethod · 0.80
wipeTXDBFunction · 0.80
patchAccountsFunction · 0.80
indexPathsFunction · 0.80
patchPathMapsFunction · 0.80
chaindb2to3.jsFile · 0.80
migrateKeysFunction · 0.80
updateKeysFunction · 0.80
migrateKeysFunction · 0.80
getEntriesMethod · 0.80

Calls 4

fromSatoshisMethod · 0.95
fromBitsMethod · 0.95
fromMBTCMethod · 0.95
fromBTCMethod · 0.95

Tested by

no test coverage detected