Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Latest commit

 

History

History
483 lines (260 loc) · 12.1 KB

faketransaction.md

File metadata and controls

483 lines (260 loc) · 12.1 KB

ethereumjs-tx > FakeTransaction

Class: FakeTransaction

Creates a new transaction object that doesn't need to be signed.

param: A transaction can be initialized with its rlp representation, an array containing the value of its fields in order, or an object containing them by name.

param: The transaction's options, used to indicate the chain and hardfork the transactions belongs to.

see: Transaction

Hierarchy

Transaction

↳ FakeTransaction

Index

Constructors

Properties

Methods


Constructors

constructor

new FakeTransaction(data?: Buffer | PrefixedHexString | BufferLike[] | FakeTxData, opts?: TransactionOptions): FakeTransaction

Overrides Transaction.constructor

Defined in fake.ts:22

Parameters:

Name Type Default value
Default value data Buffer | PrefixedHexString | BufferLike[] | FakeTxData {}
Default value opts TransactionOptions {}

Returns: FakeTransaction


Properties

<Protected>``<Optional> _from

● _from: Buffer

Inherited from Transaction._from

Defined in transaction.ts:37


data

● data: Buffer

Inherited from Transaction.data

Defined in transaction.ts:30


from

● from: Buffer

Defined in fake.ts:22

Set from address to bypass transaction signing. This is not an optional property, as its getter never returns undefined.


gasLimit

● gasLimit: Buffer

Inherited from Transaction.gasLimit

Defined in transaction.ts:26


gasPrice

● gasPrice: Buffer

Inherited from Transaction.gasPrice

Defined in transaction.ts:27


nonce

● nonce: Buffer

Inherited from Transaction.nonce

Defined in transaction.ts:25


r

● r: Buffer

Inherited from Transaction.r

Defined in transaction.ts:32


raw

● raw: Buffer[]

Inherited from Transaction.raw

Defined in transaction.ts:24


s

● s: Buffer

Inherited from Transaction.s

Defined in transaction.ts:33


to

● to: Buffer

Inherited from Transaction.to

Defined in transaction.ts:28


v

● v: Buffer

Inherited from Transaction.v

Defined in transaction.ts:31


value

● value: Buffer

Inherited from Transaction.value

Defined in transaction.ts:29


Methods

getBaseFee

getBaseFee(): BN

Inherited from Transaction.getBaseFee

Defined in transaction.ts:296

the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)

Returns: BN


getChainId

getChainId(): number

Inherited from Transaction.getChainId

Defined in transaction.ts:202

returns chain ID

Returns: number


getDataFee

getDataFee(): BN

Inherited from Transaction.getDataFee

Defined in transaction.ts:282

The amount of gas paid for the data in this tx

Returns: BN


getSenderAddress

getSenderAddress(): Buffer

Inherited from Transaction.getSenderAddress

Defined in transaction.ts:209

returns the sender's address

Returns: Buffer


getSenderPublicKey

getSenderPublicKey(): Buffer

Inherited from Transaction.getSenderPublicKey

Defined in transaction.ts:221

returns the public key of the sender

Returns: Buffer


getUpfrontCost

getUpfrontCost(): BN

Inherited from Transaction.getUpfrontCost

Defined in transaction.ts:307

the up front amount that an account must have for this transaction to be valid

Returns: BN


hash

hash(includeSignature?: boolean): Buffer

Overrides Transaction.hash

Defined in fake.ts:53

Computes a sha3-256 hash of the serialized tx, using the sender address to generate a fake signature.

Parameters:

Name Type Default value Description
Default value includeSignature boolean true Whether or not to include the signature

Returns: Buffer


serialize

serialize(): Buffer

Inherited from Transaction.serialize

Defined in transaction.ts:337

Returns the rlp encoding of the transaction

Returns: Buffer


sign

sign(privateKey: Buffer): void

Inherited from Transaction.sign

Defined in transaction.ts:262

sign a transaction with a given private key

Parameters:

Name Type Description
privateKey Buffer Must be 32 bytes in length

Returns: void


toCreationAddress

toCreationAddress(): boolean

Inherited from Transaction.toCreationAddress

Defined in transaction.ts:169

If the tx's to is to the creation address

Returns: boolean


toJSON

toJSON(labels?: boolean): object | string[]

Inherited from Transaction.toJSON

Defined in transaction.ts:346

Returns the transaction in JSON format

see: ethereumjs-util

Parameters:

Name Type Default value
Default value labels boolean false

Returns: object | string[]


validate

validate(): boolean

validate(stringError: false): boolean

validate(stringError: true): string

Inherited from Transaction.validate

Defined in transaction.ts:314

Validates the signature and checks to see if it has enough gas.

Returns: boolean

Inherited from Transaction.validate

Defined in transaction.ts:315

Parameters:

Name Type
stringError false

Returns: boolean

Inherited from Transaction.validate

Defined in transaction.ts:316

Parameters:

Name Type
stringError true

Returns: string


verifySignature

verifySignature(): boolean

Inherited from Transaction.verifySignature

Defined in transaction.ts:233

Determines if the signature is valid

Returns: boolean