UNPKG

@privy-io/js-sdk-core

Version:

Vanilla JS client for the Privy Auth API

2 lines (1 loc) 729 B
import{isCrossAppWalletSmart as s}from"./utils/isCrossAppWalletSmart.mjs";import{sendCrossAppRequest as t}from"./utils/sendCrossAppRequest.mjs";import{throwIfNotLoggedIn as r}from"./utils/throwIfNotLoggedIn.mjs";import"../../../Error.mjs";import"./utils/getCrossAppAccountByWalletAddress.mjs";import"./utils/getProviderAccessTokenOrRelink.mjs";import"../linkWithCrossAppAuth.mjs";const e=({client:e,openAuthSession:o})=>{let i=t({client:e,openAuthSession:o});return async({user:t,transaction:e,address:o,redirectUrl:n})=>{r(t);let m=s(t,o),{result:l}=await i({user:t,request:{method:m?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[e]},address:o,redirectUrl:n});return{transactionHash:l}}};export{e as sendTransaction};