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

Method fromAddress

lib/script/script.js:1622–1638  ·  view source on GitHub ↗

* Inject properties from an address. * @private * @param {Address|AddressString} address

(address)

Source from the content-addressed store, hash-verified

1620 */
1621
1622 fromAddress(address) {
1623 if (typeof address === 'string')
1624 address = Address.fromString(address);
1625
1626 assert(address instanceof Address, 'Not an address.');
1627
1628 if (address.isPubkeyhash())
1629 return this.fromPubkeyhash(address.hash);
1630
1631 if (address.isScripthash())
1632 return this.fromScripthash(address.hash);
1633
1634 if (address.isProgram())
1635 return this.fromProgram(address.version, address.hash);
1636
1637 throw new Error('Unknown address type.');
1638 }
1639
1640 /**
1641 * Create an output script from an address.

Callers

nothing calls this directly

Calls 7

fromPubkeyhashMethod · 0.95
fromScripthashMethod · 0.95
fromProgramMethod · 0.95
fromStringMethod · 0.45
isPubkeyhashMethod · 0.45
isScripthashMethod · 0.45
isProgramMethod · 0.45

Tested by

no test coverage detected