How to use the @keepkey/device-protocol/lib/types_pb.OutputScriptType.PAYTOADDRESS function in @keepkey/device-protocol

To help you get started, we’ve selected a few @keepkey/device-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shapeshift / hdwallet / packages / hdwallet-keepkey / src / utils.ts View on Github external
export function translateOutputScriptType (scriptType: BTCOutputScriptType): any {
  switch (scriptType) {
  case BTCOutputScriptType.PayToAddress:
    return OutputScriptType.PAYTOADDRESS
  case BTCOutputScriptType.PayToMultisig:
    return OutputScriptType.PAYTOMULTISIG
  case BTCOutputScriptType.PayToP2SHWitness:
    return OutputScriptType.PAYTOP2SHWITNESS
  case BTCOutputScriptType.PayToWitness:
    return OutputScriptType.PAYTOWITNESS
  }
  throw new Error('unhandled OutputSriptType enum: ' + scriptType)
}
github shapeshift / hdwallet / packages / hdwallet-keepkey / src / bitcoin.ts View on Github external
outExchangeType.setWithdrawalScriptType(translateInputScriptType(
        output.exchangeType.withdrawalScriptType || BTCInputScriptType.SpendAddress))
      outExchangeType.setReturnAddressNList(output.exchangeType.returnAddressNList)
      outExchangeType.setReturnScriptType(translateInputScriptType(
        output.exchangeType.returnScriptType || BTCInputScriptType.SpendAddress))
      newOutput.setAmount(val)
      newOutput.setAddress(signedExchange.toObject().responsev2.depositAddress.address)
      newOutput.setScriptType(OutputScriptType.PAYTOADDRESS)
      newOutput.setAddressType(OutputAddressType.EXCHANGE)
      newOutput.setExchangeType(outExchangeType)
    } else if (output.isChange) {
      newOutput.setScriptType(translateOutputScriptType(output.scriptType))
      newOutput.setAddressNList(output.addressNList)
      newOutput.setAddressType(OutputAddressType.CHANGE)
    } else {
      newOutput.setScriptType(OutputScriptType.PAYTOADDRESS)
      newOutput.setAddress(output.address)
      newOutput.setAddressType(OutputAddressType.SPEND)
    }
    unsignedTx.addOutputs(newOutput, k)
  })