@privy-io/js-sdk-core
Version:
Vanilla JS client for the Privy Auth API
2 lines (1 loc) • 641 B
JavaScript
import{bytesToHex as e,isHexEncoded as r,utf8ToBytes as i}from"../../utils/encodings.mjs";function t(t){return{from:t.from,to:t.to??void 0,nonce:n(t.nonce),chain_id:n(t.chainId),data:function(t){if(void 0!==t)return"string"==typeof t?r(t)?t:e(i(t)):e(Buffer.from(Uint8Array.from(t)))}(t.data),value:n(t.value),type:t.type,gas_limit:n(t.gasLimit),gas_price:n(t.gasPrice),max_fee_per_gas:n(t.maxFeePerGas),max_priority_fee_per_gas:n(t.maxPriorityFeePerGas)}}function n(t){if("number"==typeof t||"bigint"==typeof t){return`0x${BigInt(t).toString(16)}`}if("string"==typeof t)return r(t)?t:e(i(t))}export{t as toWalletApiUnsignedEthTransaction};