Example: Using ethereum eth_sendTransaction
import {PrivyClient} from '@privy-io/node';
const privyClient = new PrivyClient({
appId: 'insert-your-app-id',
appSecret: 'insert-your-app-secret'
});
try {
const caip2 = 'eip155:1'; // Ethereum mainnet
const response = await privyClient
.wallets()
.ethereum()
.sendTransaction('insert-user-wallet-id', {
caip2,
params: {
transaction: {
to: '0xE3070d3e4309afA3bC9a6b057685743CF42da77C',
value: '0x2386f26fc10000',
data: '0x'
}
},
authorization_context: {
// Example: building an authorization context for a 2-of-2 key quorum,
// consisting of a user and authorization key
authorization_private_keys: ['authorization-key'],
user_jwts: ['user-jwt']
}
});
const transactionHash = response.hash;
} catch (error) {
console.error(error);
}