Web3.js 中文Api文档

🌙
手机阅读
本文目录结构

.. _eth-iban:

========= web3.eth.Iban

The web3.eth.Iban function converts Ethereum addresses from and to IBAN and BBAN.


Iban instance

This instance of Iban.


    > Iban { _iban: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS' }

Iban contructor


    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>

参数

  1. String: the IBAN address to instantiate an Iban instance from.

返回值

Object - The Iban instance.


例子


    var iban = new web3.eth.Iban("XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS");
    > Iban { _iban: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS' }

.. _eth-iban-toaddress:

toAddress

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.


参数

  1. String: the IBAN address to convert.

返回值

String - The Ethereum address.


例子


    web3.eth.Iban.toAddress("XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS");
    > "0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8"

.. _eth-iban-toiban:

toIban

Static function.


    web3.eth.Iban.toIban(address)

Singleton: Converts an Ethereum address to a direct IBAN address.


参数

  1. String: the Ethereum address to convert.

返回值

String - The IBAN address.


例子


    web3.eth.Iban.toIban("0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8");
    > "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"

.. _eth-iban-fromaddress:

fromAddress

Static function, returns IBAN instance.


    web3.eth.Iban.fromAddress(address)

Singleton: Converts an Ethereum address to a direct IBAN instance.


参数

  1. String: the Ethereum address to convert.

返回值

Object - The IBAN instance.


例子


    web3.eth.Iban.fromAddress("0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8");
    > Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"}

.. _eth-iban-frombban:

static function, return IBAN instance

fromBban


    web3.eth.Iban.fromBban(bbanAddress)

Singleton: Converts an BBAN address to a direct IBAN instance.


参数

  1. String: the BBAN address to convert.

返回值

Object - The IBAN instance.


例子


    web3.eth.Iban.fromBban('ETHXREGGAVOFYORK');
    > Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"}

.. _eth-iban-createindirect:

static function, return IBAN instance

createIndirect


    web3.eth.Iban.createIndirect(options)

Singleton: Creates an indirect IBAN address from an institution and identifier.


参数

  1. Object: the options object as follows:
    • institution - String: the institution to be assigned.
    • identifier - String: the identifier to be assigned.

返回值

Object - The IBAN instance.


例子


    web3.eth.Iban.createIndirect({
        institution: "XREG",
        identifier: "GAVOFYORK"
    });
    > Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"}

.. _eth-iban-isvalid:

Static function, returns boolean.

isValid


    web3.eth.Iban.isValid(ibanAddress)

Singleton: Checks if an IBAN address is valid.

.. note:: This method also exists on the IBAN instance.


参数

  1. String: the IBAN address to check.

返回值

Boolean


例子


    web3.eth.Iban.isValid("XE81ETHXREGGAVOFYORK");
    > true

    web3.eth.Iban.isValid("XE82ETHXREGGAVOFYORK");
    > false // because the checksum is incorrect

prototype.isValid

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.


参数

  1. String: the IBAN address to check.

返回值

Boolean


例子


    var iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK");
    iban.isValid();
    > true

prototype.isDirect

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

prototype.isIndirect

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

prototype.checksum

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"

prototype.institution

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'

prototype.client

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'

prototype.toAddress

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'

prototype.toString

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'

AXIHE / 精选资源

浏览全部教程

面试题

学习网站

前端培训
自己甄别

前端书籍

关于朱安邦

我叫 朱安邦,阿西河的站长,在杭州。

以前是一名平面设计师,后来开始接接触前端开发,主要研究前端技术中的JS方向。

业余时间我喜欢分享和交流自己的技术,欢迎大家关注我的 Bilibili

关注我: Github / 知乎

于2021年离开前端领域,目前重心放在研究区块链上面了

我叫朱安邦,阿西河的站长

目前在杭州从事区块链周边的开发工作,机械专业,以前从事平面设计工作。

2014年底脱产在老家自学6个月的前端技术,自学期间几乎从未出过家门,最终找到了满意的前端工作。更多>

于2021年离开前端领域,目前从事区块链方面工作了