Secp256k1Layout.fromEthAddress constructor

Secp256k1Layout.fromEthAddress({
  1. required ETHAddress address,
  2. required List<int> message,
  3. required List<int> signature,
  4. required int recoveryId,
  5. int instructionIndex = 0,
})

Create an secp256k1 layout with an Ethereum address.

Implementation

factory Secp256k1Layout.fromEthAddress(
    {required ETHAddress address,
    required List<int> message,
    required List<int> signature,
    required int recoveryId,
    int instructionIndex = 0}) {
  const int ethAddressOffset = 12;
  const int signatureOffset = ethAddressOffset + ETHAddress.lengthInBytes;
  return Secp256k1Layout(
      ethAddress: address,
      numSignatures: 1,
      signatureOffset: signatureOffset,
      signatureInstructionIndex: instructionIndex,
      ethAddressOffset: ethAddressOffset,
      ethAddressInstructionIndex: instructionIndex,
      messageDataOffset: signatureOffset + signature.length + 1,
      messageDataSize: message.length,
      messageInstructionIndex: instructionIndex,
      message: message,
      signature: signature,
      recoveryId: recoveryId);
}