ethereumjs-tx > 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
↳ FakeTransaction
- getBaseFee
- getChainId
- getDataFee
- getSenderAddress
- getSenderPublicKey
- getUpfrontCost
- hash
- serialize
- sign
- toCreationAddress
- toJSON
- validate
- verifySignature
⊕ 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
● _from: Buffer
Inherited from Transaction._from
Defined in transaction.ts:37
● data: Buffer
Inherited from Transaction.data
Defined in transaction.ts:30
● 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: Buffer
Inherited from Transaction.gasLimit
Defined in transaction.ts:26
● gasPrice: Buffer
Inherited from Transaction.gasPrice
Defined in transaction.ts:27
● nonce: Buffer
Inherited from Transaction.nonce
Defined in transaction.ts:25
● r: Buffer
Inherited from Transaction.r
Defined in transaction.ts:32
● raw: Buffer
[]
Inherited from Transaction.raw
Defined in transaction.ts:24
● s: Buffer
Inherited from Transaction.s
Defined in transaction.ts:33
● to: Buffer
Inherited from Transaction.to
Defined in transaction.ts:28
● v: Buffer
Inherited from Transaction.v
Defined in transaction.ts:31
● value: Buffer
Inherited from Transaction.value
Defined in transaction.ts:29
▸ 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(): number
Inherited from Transaction.getChainId
Defined in transaction.ts:202
returns chain ID
Returns: number
▸ 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(): Buffer
Inherited from Transaction.getSenderAddress
Defined in transaction.ts:209
returns the sender's address
Returns: Buffer
▸ getSenderPublicKey(): Buffer
Inherited from Transaction.getSenderPublicKey
Defined in transaction.ts:221
returns the public key of the sender
Returns: Buffer
▸ 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(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(): Buffer
Inherited from Transaction.serialize
Defined in transaction.ts:337
Returns the rlp encoding of the transaction
Returns: Buffer
▸ 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(): boolean
Inherited from Transaction.toCreationAddress
Defined in transaction.ts:169
If the tx's to
is to the creation address
Returns: boolean
▸ 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(): 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(): boolean
Inherited from Transaction.verifySignature
Defined in transaction.ts:233
Determines if the signature is valid
Returns: boolean