Skip to content

Latest commit

 

History

History
305 lines (175 loc) · 7.51 KB

EthereumTBTCToken.md

File metadata and controls

305 lines (175 loc) · 7.51 KB

Class: EthereumTBTCToken

Implementation of the Ethereum TBTC v2 token handle.

See

for reference.

Hierarchy

  • EthersContractHandle<TBTCTypechain>

    EthereumTBTCToken

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new EthereumTBTCToken(config, chainId?): EthereumTBTCToken

Parameters

Name Type Default value
config EthereumContractConfig undefined
chainId Ethereum Chains.Ethereum.Local

Returns

EthereumTBTCToken

Overrides

EthersContractHandle&lt;TBTCTypechain&gt;.constructor

Defined in

src/lib/ethereum/tbtc-token.ts:26

Properties

_deployedAtBlockNumber

Protected Readonly _deployedAtBlockNumber: number

Number of a block within which the contract was deployed. Value is read from the contract deployment artifact. It can be overwritten by setting a EthersContractConfig.deployedAtBlockNumber property.

Inherited from

EthersContractHandle._deployedAtBlockNumber

Defined in

src/lib/ethereum/adapter.ts:80


_instance

Protected Readonly _instance: TBTC

Ethers instance of the deployed contract.

Inherited from

EthersContractHandle._instance

Defined in

src/lib/ethereum/adapter.ts:74


_totalRetryAttempts

Protected Readonly _totalRetryAttempts: number

Number of retries for ethereum requests.

Inherited from

EthersContractHandle._totalRetryAttempts

Defined in

src/lib/ethereum/adapter.ts:84

Methods

buildBridgeRequestRedemptionData

buildBridgeRequestRedemptionData(walletPublicKey, mainUtxo, redeemerOutputScript): Object

Parameters

Name Type
walletPublicKey Hex
mainUtxo BitcoinUtxo
redeemerOutputScript Hex

Returns

Object

Name Type
mainUtxo { txHash: string ; txOutputIndex: number = mainUtxo.outputIndex; txOutputValue: BigNumber = mainUtxo.value }
mainUtxo.txHash string
mainUtxo.txOutputIndex number
mainUtxo.txOutputValue BigNumber
prefixedRawRedeemerOutputScript string
walletPublicKeyHash string

Defined in

src/lib/ethereum/tbtc-token.ts:139


buildRequestRedemptionData

buildRequestRedemptionData(redeemer, walletPublicKey, mainUtxo, redeemerOutputScript): Hex

Parameters

Name Type
redeemer EthereumAddress
walletPublicKey Hex
mainUtxo BitcoinUtxo
redeemerOutputScript Hex

Returns

Hex

See

Implementation of

TBTCToken.buildRequestRedemptionData

Defined in

src/lib/ethereum/tbtc-token.ts:108


getAddress

getAddress(): EthereumAddress

Get address of the contract instance.

Returns

EthereumAddress

Address of this contract instance.

Inherited from

EthersContractHandle.getAddress

Defined in

src/lib/ethereum/adapter.ts:112


getChainIdentifier

getChainIdentifier(): ChainIdentifier

Returns

ChainIdentifier

See

Implementation of

TBTCToken.getChainIdentifier

Defined in

src/lib/ethereum/tbtc-token.ts:53


getEvents

getEvents(eventName, options?, ...filterArgs): Promise<Event[]>

Get events emitted by the Ethereum contract. It starts searching from provided block number. If the GetEvents.Options#fromBlock option is missing it looks for a contract's defined property _deployedAtBlockNumber. If the property is missing starts searching from block 0.

Parameters

Name Type Description
eventName string Name of the event.
options? Options Options for events fetching.
...filterArgs unknown[] Arguments for events filtering.

Returns

Promise<Event[]>

Array of found events.

Inherited from

EthersContractHandle.getEvents

Defined in

src/lib/ethereum/adapter.ts:127


requestRedemption

requestRedemption(walletPublicKey, mainUtxo, redeemerOutputScript, amount): Promise<Hex>

Parameters

Name Type
walletPublicKey Hex
mainUtxo BitcoinUtxo
redeemerOutputScript Hex
amount BigNumber

Returns

Promise<Hex>

See

Implementation of

TBTCToken.requestRedemption

Defined in

src/lib/ethereum/tbtc-token.ts:71


totalSupply

totalSupply(blockNumber?): Promise<BigNumber>

Parameters

Name Type
blockNumber? number

Returns

Promise<BigNumber>

See

Implementation of

TBTCToken.totalSupply

Defined in

src/lib/ethereum/tbtc-token.ts:61