Kernel Account API

The Kernel Account API powers Patch wallets and controls the EIP-4337 account abstraction smart contract wallets called, Kernel Accounts.
Kernel Accounts are a simple smart contract wallet with the same address on all EVM chains and connected to a user's email, social account, phone, or an app provider. The Kernel Account API can be used to submit a transaction or sign a message through a target wallet.

Submit a Transaction

To send a transaction through a Kernel Account, see the Kernel Tx endpoint in Postman.
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{access_token}}");
var raw = JSON.stringify({
"userId": "test:elonmusk",
"chain": "matic",
"to": [
"0x74427681c620DE258Aa53a382d6a4C865738A06C"
],
"value": [
"10000000000000"
],
"data": [
"0x"
],
"delegatecall": 0, // Optional parameter. Set to 1 for a delegatecall().
"auth": ""
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://paymagicapi.com/v1/kernel/tx", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Sign a Message

Sign any arbitrary message using an EIP-1271 signature from your Patch wallet. Commonly used to sign into an application, submit a trade, or list an NFT on a marketplace.
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://paymagicapi.com/v1/kernel/sign',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{access_token}}'
},
body: JSON.stringify({
"userId": "test:elonmusk",
"hash": "0xec3608877ecbf8084c29896b7eab2a368b2b3c8d003288584d145613dfa4706c"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});