node_modules/@velas/solana-web3/lib/index.browser.esm.js
/**
   * Create an secp256k1 instruction with an Ethereum address. The address
   * must be a hex string or a buffer that is 20 bytes long.
   */
Create an secp256k1 instruction with an Ethereum address. The address
must be a hex string or a buffer that is 20 bytes long.
Create an secp256k1 instruction with an Ethereum address . The address must be a hex string or a buffer that is 20 bytes long .
static createInstructionWithEthAddress(params) {
    const {
      ethAddress: rawAddress,
      message,
      signature,
      recoveryId
    } = params;
    let ethAddress;
    if (typeof rawAddress === 'string') {
      if (rawAddress.startsWith('0x')) {
        ethAddress = buffer.Buffer.from(rawAddress.substr(2), 'hex');
      } else {
        ethAddress = buffer.Buffer.from(rawAddress, 'hex');
      }
    } else {
      ethAddress = rawAddress;
    }
    assert$1(ethAddress.length === ETHEREUM_ADDRESS_BYTES, "Address must be ".concat(ETHEREUM_ADDRESS_BYTES, " bytes but received ").concat(ethAddress.length, " bytes"));
    const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE;
    const ethAddressOffset = dataStart;
    const signatureOffset = dataStart + ethAddress.length;
    const messageDataOffset = signatureOffset + signature.length + 1;
    const numSignatures = 1;
    const instructionData = buffer.Buffer.alloc(SECP256K1_INSTRUCTION_LAYOUT.span + message.length);
    SECP256K1_INSTRUCTION_LAYOUT.encode({
      numSignatures,
      signatureOffset,
      signatureInstructionIndex: 0,
      ethAddressOffset,
      ethAddressInstructionIndex: 0,
      messageDataOffset,
      messageDataSize: message.length,
      messageInstructionIndex: 0,
      signature: toBuffer(signature),
      ethAddress: toBuffer(ethAddress),
      recoveryId
    }, instructionData);
    instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);
    return new TransactionInstruction({
      keys: [],
      programId: Secp256k1Program.programId,
      data: instructionData
    });
  }
static createInstructionWithEthAddress ( params ) { const { ethAddress : rawAddress , message , signature , recoveryId } = params ; let ethAddress ; if ( typeof rawAddress === 'string' ) { if ( rawAddress . startsWith ( '0x' ) ) { ethAddress = buffer . Buffer . from ( rawAddress . substr ( 2 ) , 'hex' ) ; } else { ethAddress = buffer . Buffer . from ( rawAddress , 'hex' ) ; } } else { ethAddress = rawAddress ; } assert$1 ( ethAddress . length === ETHEREUM_ADDRESS_BYTES , "Address must be " . concat ( ETHEREUM_ADDRESS_BYTES , " bytes but received " ) . concat ( ethAddress . length , " bytes" ) ) ; const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE ; const ethAddressOffset = dataStart ; const signatureOffset = dataStart + ethAddress . length ; const messageDataOffset = signatureOffset + signature . length + 1 ; const numSignatures = 1 ; const instructionData = buffer . Buffer . alloc ( SECP256K1_INSTRUCTION_LAYOUT . span + message . length ) ; SECP256K1_INSTRUCTION_LAYOUT . encode ( { numSignatures , signatureOffset , signatureInstructionIndex : 0 , ethAddressOffset , ethAddressInstructionIndex : 0 , messageDataOffset , messageDataSize : message . length , messageInstructionIndex : 0 , signature : toBuffer ( signature ) , ethAddress : toBuffer ( ethAddress ) , recoveryId } , instructionData ) ; instructionData . fill ( toBuffer ( message ) , SECP256K1_INSTRUCTION_LAYOUT . span ) ; return new TransactionInstruction ( { keys : [ ] , programId : Secp256k1Program . programId , data : instructionData } ) ; }
Create an secp256k1 instruction with an Ethereum address.
Create an secp256k1 instruction with an Ethereum address .