Base Account API [DEPRECATED]

The Base Account API powers Patch wallets and controls the EIP-4337 account abstraction smart contract wallets called, Base Accounts.

Base 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. They are centered around the concept of a user_id which is a combination of a provider and username.

user_ids:

Submit a Transaction

To send a transaction through a Base Account, see the Base Tx endpoint on Postman.

Send a transaction through a Base Account on the target chain

POST https://paymagicapi.com/v1/base/tx

Headers

NameTypeDescription

Authorization*

String

Bearer Token

Request Body

NameTypeDescription

data*

String Array

The data to pass in for the the transaction. Could be multiple fields for multiple transactions.

value*

String Array

The amount of native coins to send with the transaction. Could be multiple values for multiple transactions.

to*

String Array

The contract address that the Base Account is calling. Could be multiple address for multiple transactions.

chain*

String

The ERC-3770 standard name for the target chain

userId*

String

The userId of the wallet for the transaction

auth*

String

The corresponding auth token for the given wallet. The token will vary based on whether the userId is for a Twitter, email, or telephone wallet.

var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{access_token}}");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "userId": "email:[email protected]",
  "chain": "matic",
  "to": [
    "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
  ],
  "value": [
    "0x00"
  ],
  "data": [
    "0xa9059cbb000000000000000000000000F2c47a58c1653b2b1E61010a2cE76ec8368C87Ba00000000000000000000000000000000000000000000000000000000000F4240"
  ],
  "auth": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjc5NDYwODQ2LCJzdWIiOiI4YTFlODg2YS0xNmRjLTRlM2ItODg5MS04MWFiMjk3M2U5NjIiLCJlbWFpbCI6Imdlc2FnYTM0NzlAa2F1ZGF0LmNvbSIsInBob25lIjoiIiwiYXBwX21ldGFkYXRhIjp7InByb3ZpZGVyIjoiZW1haWwiLCJwcm92aWRlcnMiOlsiZW1haWwiXX0sInVzZXJfbWV0YWRhdGEiOnt9LCJyb2xlIjoiYXV0aGVudGljYXRlZCIsImFhbCI6ImFhbDEiLCJhbXIiOlt7Im1ldGhvZCI6Im90cCIsInRpbWVzdGFtcCI6MTY3OTQ1NzI0Nn1dLCJzZXNzaW9uX2lkIjoiMGRhMmQ4YmUtY2FiYS00MGRhLWE5ZTctOTliMjNlZmE4ZWExIn0.lfjj6YbJoCRSXRgW9vPg6Un0ck0NiBH6S97_gXUGKUE"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("{{paymagicBaseUrl}}/base/tx", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Sign a Message

Coming Soon

Last updated