The web3.eth.Iban
function lets convert Ethereum addresses from and to IBAN and BBAN.
This's instance of Iban
> Iban { _iban: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS' }
new web3.eth.Iban(ibanAddress)
Generates a iban object with conversion methods and validity checks. Also has singleton functions for conversion like :ref:`Iban.toAddress() <_eth-iban-toaddress>`, :ref:`Iban.toIban() <_eth-iban-toiban>`, :ref:`Iban.fromAddress() <_eth-iban-fromaddress>`, :ref:`Iban.fromBban() <_eth-iban-frombban>`, :ref:`Iban.createIndirect() <_eth-iban-createindirect>`, :ref:`Iban.isValid() <_eth-iban-isvalid>`.
String
: the IBAN address to instantiate an Iban instance from.
Object
- The Iban instance.
var iban = new web3.eth.Iban("XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS");
> Iban { _iban: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS' }
static function
web3.eth.Iban.toAddress(ibanAddress)
Singleton: Converts a direct IBAN address into an Ethereum address.
Note
This method also exists on the IBAN instance.
String
: the IBAN address to convert.
String
- The Ethereum address.
web3.eth.Iban.toAddress("XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS");
> "0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8"
static function
web3.eth.Iban.toIban(address)
Singleton: Converts an Ethereum address to a direct IBAN address.
String
: the Ethereum address to convert.
String
- The IBAN address.
web3.eth.Iban.toIban("0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8");
> "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"
static function, return IBAN instance
web3.eth.Iban.fromAddress(address)
Singleton: Converts an Ethereum address to a direct IBAN instance.
String
: the Ethereum address to convert.
Object
- The IBAN instance.
web3.eth.Iban.fromAddress("0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8");
> Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"}
static function, return IBAN instance
web3.eth.Iban.fromBban(bbanAddress)
Singleton: Converts an BBAN address to a direct IBAN instance.
String
: the BBAN address to convert.
Object
- The IBAN instance.
web3.eth.Iban.fromBban('ETHXREGGAVOFYORK');
> Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"}
static function, return IBAN instance
web3.eth.Iban.createIndirect(options)
Singleton: Creates an indirect IBAN address from a institution and identifier.
Object
: the options object as follows:institution
-String
: the institution to be assignedidentifier
-String
: the identifier to be assigned
Object
- The IBAN instance.
web3.eth.Iban.createIndirect({
institution: "XREG",
identifier: "GAVOFYORK"
});
> Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"}
static function, return boolean
web3.eth.Iban.isValid(ibanAddress)
Singleton: Checks if an IBAN address is valid.
Note
This method also exists on the IBAN instance.
String
: the IBAN address to check.
Boolean
web3.eth.Iban.isValid("XE81ETHXREGGAVOFYORK");
> true
web3.eth.Iban.isValid("XE82ETHXREGGAVOFYORK");
> false // because the checksum is incorrect
method of Iban instance
web3.eth.Iban.prototype.isValid()
Singleton: Checks if an IBAN address is valid.
Note
This method also exists on the IBAN instance.
String
: the IBAN address to check.
Boolean
var iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK");
iban.isValid();
> true
method of Iban instance
web3.eth.Iban.prototype.isDirect()
Checks if the IBAN instance is direct.
none
Boolean
var iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK");
iban.isDirect();
> false
method of Iban instance
web3.eth.Iban.prototype.isIndirect()
Checks if the IBAN instance is indirect.
none
Boolean
var iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK");
iban.isIndirect();
> true
method of Iban instance
web3.eth.Iban.prototype.checksum()
Returns the checksum of the IBAN instance.
none
String
: The checksum of the IBAN
var iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK");
iban.checksum();
> "81"
method of Iban instance
web3.eth.Iban.prototype.institution()
Returns the institution of the IBAN instance.
none
String
: The institution of the IBAN
var iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK");
iban.institution();
> 'XREG'
method of Iban instance
web3.eth.Iban.prototype.client()
Returns the client of the IBAN instance.
none
String
: The client of the IBAN
var iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK");
iban.client();
> 'GAVOFYORK'
method of Iban instance
web3.eth.Iban.prototype.toString()
Returns the Ethereum address of the IBAN instance.
none
String
: The Ethereum address of the IBAN
var iban = new web3.eth.Iban('XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS');
iban.toAddress();
> '0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8'
method of Iban instance
web3.eth.Iban.prototype.toString()
Returns the IBAN address of the IBAN instance.
none
String
: The IBAN address.
var iban = new web3.eth.Iban('XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS');
iban.toString();
> 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'