curl --request POST \
--url https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"typedData": {
"domain": {
"name": "Permit2",
"chainId": 1,
"verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{
"name": "spender",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
],
"TokenPermissions": [
{
"name": "token",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
]
},
"primaryType": "PermitTransferFrom",
"message": {
"permitted": {
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000"
},
"spender": "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
"nonce": "123456",
"deadline": "1717123200"
}
},
"walletSecretId": "e051beeb-7163-4527-a5b6-35e301529ff2"
}
'import requests
url = "https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data"
payload = {
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"typedData": {
"domain": {
"name": "Permit2",
"chainId": 1,
"verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{
"name": "spender",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
],
"TokenPermissions": [
{
"name": "token",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
]
},
"primaryType": "PermitTransferFrom",
"message": {
"permitted": {
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000"
},
"spender": "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
"nonce": "123456",
"deadline": "1717123200"
}
},
"walletSecretId": "e051beeb-7163-4527-a5b6-35e301529ff2"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
typedData: {
domain: {
name: 'Permit2',
chainId: 1,
verifyingContract: '0x000000000022D473030F116dDEE9F6B43aC78BA3'
},
types: {
EIP712Domain: [
{name: 'name', type: 'string'},
{name: 'chainId', type: 'uint256'},
{name: 'verifyingContract', type: 'address'}
],
PermitTransferFrom: [
{name: 'permitted', type: 'TokenPermissions'},
{name: 'spender', type: 'address'},
{name: 'nonce', type: 'uint256'},
{name: 'deadline', type: 'uint256'}
],
TokenPermissions: [{name: 'token', type: 'address'}, {name: 'amount', type: 'uint256'}]
},
primaryType: 'PermitTransferFrom',
message: {
permitted: {token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', amount: '1000000'},
spender: '0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf',
nonce: '123456',
deadline: '1717123200'
}
},
walletSecretId: 'e051beeb-7163-4527-a5b6-35e301529ff2'
})
};
fetch('https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'typedData' => [
'domain' => [
'name' => 'Permit2',
'chainId' => 1,
'verifyingContract' => '0x000000000022D473030F116dDEE9F6B43aC78BA3'
],
'types' => [
'EIP712Domain' => [
[
'name' => 'name',
'type' => 'string'
],
[
'name' => 'chainId',
'type' => 'uint256'
],
[
'name' => 'verifyingContract',
'type' => 'address'
]
],
'PermitTransferFrom' => [
[
'name' => 'permitted',
'type' => 'TokenPermissions'
],
[
'name' => 'spender',
'type' => 'address'
],
[
'name' => 'nonce',
'type' => 'uint256'
],
[
'name' => 'deadline',
'type' => 'uint256'
]
],
'TokenPermissions' => [
[
'name' => 'token',
'type' => 'address'
],
[
'name' => 'amount',
'type' => 'uint256'
]
]
],
'primaryType' => 'PermitTransferFrom',
'message' => [
'permitted' => [
'token' => '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
'amount' => '1000000'
],
'spender' => '0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf',
'nonce' => '123456',
'deadline' => '1717123200'
]
],
'walletSecretId' => 'e051beeb-7163-4527-a5b6-35e301529ff2'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data"
payload := strings.NewReader("{\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"typedData\": {\n \"domain\": {\n \"name\": \"Permit2\",\n \"chainId\": 1,\n \"verifyingContract\": \"0x000000000022D473030F116dDEE9F6B43aC78BA3\"\n },\n \"types\": {\n \"EIP712Domain\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"chainId\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"verifyingContract\",\n \"type\": \"address\"\n }\n ],\n \"PermitTransferFrom\": [\n {\n \"name\": \"permitted\",\n \"type\": \"TokenPermissions\"\n },\n {\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"name\": \"nonce\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\"\n }\n ],\n \"TokenPermissions\": [\n {\n \"name\": \"token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ]\n },\n \"primaryType\": \"PermitTransferFrom\",\n \"message\": {\n \"permitted\": {\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"amount\": \"1000000\"\n },\n \"spender\": \"0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf\",\n \"nonce\": \"123456\",\n \"deadline\": \"1717123200\"\n }\n },\n \"walletSecretId\": \"e051beeb-7163-4527-a5b6-35e301529ff2\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"typedData\": {\n \"domain\": {\n \"name\": \"Permit2\",\n \"chainId\": 1,\n \"verifyingContract\": \"0x000000000022D473030F116dDEE9F6B43aC78BA3\"\n },\n \"types\": {\n \"EIP712Domain\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"chainId\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"verifyingContract\",\n \"type\": \"address\"\n }\n ],\n \"PermitTransferFrom\": [\n {\n \"name\": \"permitted\",\n \"type\": \"TokenPermissions\"\n },\n {\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"name\": \"nonce\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\"\n }\n ],\n \"TokenPermissions\": [\n {\n \"name\": \"token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ]\n },\n \"primaryType\": \"PermitTransferFrom\",\n \"message\": {\n \"permitted\": {\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"amount\": \"1000000\"\n },\n \"spender\": \"0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf\",\n \"nonce\": \"123456\",\n \"deadline\": \"1717123200\"\n }\n },\n \"walletSecretId\": \"e051beeb-7163-4527-a5b6-35e301529ff2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"typedData\": {\n \"domain\": {\n \"name\": \"Permit2\",\n \"chainId\": 1,\n \"verifyingContract\": \"0x000000000022D473030F116dDEE9F6B43aC78BA3\"\n },\n \"types\": {\n \"EIP712Domain\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"chainId\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"verifyingContract\",\n \"type\": \"address\"\n }\n ],\n \"PermitTransferFrom\": [\n {\n \"name\": \"permitted\",\n \"type\": \"TokenPermissions\"\n },\n {\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"name\": \"nonce\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\"\n }\n ],\n \"TokenPermissions\": [\n {\n \"name\": \"token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ]\n },\n \"primaryType\": \"PermitTransferFrom\",\n \"message\": {\n \"permitted\": {\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"amount\": \"1000000\"\n },\n \"spender\": \"0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf\",\n \"nonce\": \"123456\",\n \"deadline\": \"1717123200\"\n }\n },\n \"walletSecretId\": \"e051beeb-7163-4527-a5b6-35e301529ff2\"\n}"
response = http.request(request)
puts response.read_body{
"signature": "0x1b0c9cf8cd4554c6c6d9e7311e88f1be075d7f25b418a044f4bf2c0a42a93e212ad0a8b54de9e0b5f7e3812de3f2c6cc79aa8c3e1c02e7ad14b4a8f42012c2c01b"
}Sign EIP-712 typed data via end user EVM account
Signs EIP-712 typed data with the given end user EVM account.
curl --request POST \
--url https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"typedData": {
"domain": {
"name": "Permit2",
"chainId": 1,
"verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{
"name": "spender",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
],
"TokenPermissions": [
{
"name": "token",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
]
},
"primaryType": "PermitTransferFrom",
"message": {
"permitted": {
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000"
},
"spender": "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
"nonce": "123456",
"deadline": "1717123200"
}
},
"walletSecretId": "e051beeb-7163-4527-a5b6-35e301529ff2"
}
'import requests
url = "https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data"
payload = {
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"typedData": {
"domain": {
"name": "Permit2",
"chainId": 1,
"verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{
"name": "spender",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
],
"TokenPermissions": [
{
"name": "token",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
]
},
"primaryType": "PermitTransferFrom",
"message": {
"permitted": {
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000"
},
"spender": "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
"nonce": "123456",
"deadline": "1717123200"
}
},
"walletSecretId": "e051beeb-7163-4527-a5b6-35e301529ff2"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
typedData: {
domain: {
name: 'Permit2',
chainId: 1,
verifyingContract: '0x000000000022D473030F116dDEE9F6B43aC78BA3'
},
types: {
EIP712Domain: [
{name: 'name', type: 'string'},
{name: 'chainId', type: 'uint256'},
{name: 'verifyingContract', type: 'address'}
],
PermitTransferFrom: [
{name: 'permitted', type: 'TokenPermissions'},
{name: 'spender', type: 'address'},
{name: 'nonce', type: 'uint256'},
{name: 'deadline', type: 'uint256'}
],
TokenPermissions: [{name: 'token', type: 'address'}, {name: 'amount', type: 'uint256'}]
},
primaryType: 'PermitTransferFrom',
message: {
permitted: {token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', amount: '1000000'},
spender: '0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf',
nonce: '123456',
deadline: '1717123200'
}
},
walletSecretId: 'e051beeb-7163-4527-a5b6-35e301529ff2'
})
};
fetch('https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'typedData' => [
'domain' => [
'name' => 'Permit2',
'chainId' => 1,
'verifyingContract' => '0x000000000022D473030F116dDEE9F6B43aC78BA3'
],
'types' => [
'EIP712Domain' => [
[
'name' => 'name',
'type' => 'string'
],
[
'name' => 'chainId',
'type' => 'uint256'
],
[
'name' => 'verifyingContract',
'type' => 'address'
]
],
'PermitTransferFrom' => [
[
'name' => 'permitted',
'type' => 'TokenPermissions'
],
[
'name' => 'spender',
'type' => 'address'
],
[
'name' => 'nonce',
'type' => 'uint256'
],
[
'name' => 'deadline',
'type' => 'uint256'
]
],
'TokenPermissions' => [
[
'name' => 'token',
'type' => 'address'
],
[
'name' => 'amount',
'type' => 'uint256'
]
]
],
'primaryType' => 'PermitTransferFrom',
'message' => [
'permitted' => [
'token' => '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
'amount' => '1000000'
],
'spender' => '0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf',
'nonce' => '123456',
'deadline' => '1717123200'
]
],
'walletSecretId' => 'e051beeb-7163-4527-a5b6-35e301529ff2'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data"
payload := strings.NewReader("{\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"typedData\": {\n \"domain\": {\n \"name\": \"Permit2\",\n \"chainId\": 1,\n \"verifyingContract\": \"0x000000000022D473030F116dDEE9F6B43aC78BA3\"\n },\n \"types\": {\n \"EIP712Domain\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"chainId\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"verifyingContract\",\n \"type\": \"address\"\n }\n ],\n \"PermitTransferFrom\": [\n {\n \"name\": \"permitted\",\n \"type\": \"TokenPermissions\"\n },\n {\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"name\": \"nonce\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\"\n }\n ],\n \"TokenPermissions\": [\n {\n \"name\": \"token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ]\n },\n \"primaryType\": \"PermitTransferFrom\",\n \"message\": {\n \"permitted\": {\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"amount\": \"1000000\"\n },\n \"spender\": \"0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf\",\n \"nonce\": \"123456\",\n \"deadline\": \"1717123200\"\n }\n },\n \"walletSecretId\": \"e051beeb-7163-4527-a5b6-35e301529ff2\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"typedData\": {\n \"domain\": {\n \"name\": \"Permit2\",\n \"chainId\": 1,\n \"verifyingContract\": \"0x000000000022D473030F116dDEE9F6B43aC78BA3\"\n },\n \"types\": {\n \"EIP712Domain\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"chainId\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"verifyingContract\",\n \"type\": \"address\"\n }\n ],\n \"PermitTransferFrom\": [\n {\n \"name\": \"permitted\",\n \"type\": \"TokenPermissions\"\n },\n {\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"name\": \"nonce\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\"\n }\n ],\n \"TokenPermissions\": [\n {\n \"name\": \"token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ]\n },\n \"primaryType\": \"PermitTransferFrom\",\n \"message\": {\n \"permitted\": {\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"amount\": \"1000000\"\n },\n \"spender\": \"0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf\",\n \"nonce\": \"123456\",\n \"deadline\": \"1717123200\"\n }\n },\n \"walletSecretId\": \"e051beeb-7163-4527-a5b6-35e301529ff2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cdp.coinbase.com/platform/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"typedData\": {\n \"domain\": {\n \"name\": \"Permit2\",\n \"chainId\": 1,\n \"verifyingContract\": \"0x000000000022D473030F116dDEE9F6B43aC78BA3\"\n },\n \"types\": {\n \"EIP712Domain\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"chainId\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"verifyingContract\",\n \"type\": \"address\"\n }\n ],\n \"PermitTransferFrom\": [\n {\n \"name\": \"permitted\",\n \"type\": \"TokenPermissions\"\n },\n {\n \"name\": \"spender\",\n \"type\": \"address\"\n },\n {\n \"name\": \"nonce\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\"\n }\n ],\n \"TokenPermissions\": [\n {\n \"name\": \"token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ]\n },\n \"primaryType\": \"PermitTransferFrom\",\n \"message\": {\n \"permitted\": {\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"amount\": \"1000000\"\n },\n \"spender\": \"0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf\",\n \"nonce\": \"123456\",\n \"deadline\": \"1717123200\"\n }\n },\n \"walletSecretId\": \"e051beeb-7163-4527-a5b6-35e301529ff2\"\n}"
response = http.request(request)
puts response.read_body{
"signature": "0x1b0c9cf8cd4554c6c6d9e7311e88f1be075d7f25b418a044f4bf2c0a42a93e212ad0a8b54de9e0b5f7e3812de3f2c6cc79aa8c3e1c02e7ad14b4a8f42012c2c01b"
}Authorizations
A JWT signed using the developer's own JWT private key (in the case of JWT authentication), or an end user JWT signed by CDP, encoded in base64. This is used for End User Account APIs.
Headers
A JWT signed using your Wallet Secret, encoded in base64. Refer to the Generate Wallet Token section of our Authentication docs for more details on how to generate your Wallet Token.
An optional string request header for making requests safely retryable. When included, duplicate requests with the same key will return identical responses. Refer to our Idempotency docs for more information on using idempotency keys.
1 - 128A JWT signed using your Wallet Secret, encoded in base64. Refer to the Generate Wallet Token section of our Authentication docs for more details on how to generate your Wallet Token.
Path Parameters
The ID of the end user.
^[a-zA-Z0-9-]{1,100}$"e051beeb-7163-4527-a5b6-35e301529ff2"
Query Parameters
The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"8e03978e-40d5-43e8-bc93-6894a57f9324"
Body
The 0x-prefixed address of the EVM account belonging to the end user.
^0x[0-9a-fA-F]{40}$"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
The message to sign using EIP-712.
Show child attributes
Show child attributes
{
"domain": {
"name": "Permit2",
"chainId": 1,
"verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{ "name": "spender", "type": "address" },
{ "name": "nonce", "type": "uint256" },
{ "name": "deadline", "type": "uint256" }
],
"TokenPermissions": [
{ "name": "token", "type": "address" },
{ "name": "amount", "type": "uint256" }
]
},
"primaryType": "PermitTransferFrom",
"message": {
"permitted": {
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000"
},
"spender": "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
"nonce": "123456",
"deadline": "1717123200"
}
}
Required when not using delegated signing. The ID of the Temporary Wallet Secret that was used to sign the X-Wallet-Auth Header.
^[a-zA-Z0-9-]{1,100}$"e051beeb-7163-4527-a5b6-35e301529ff2"
Response
Successfully signed typed data.
The signature of the typed data, as a 0x-prefixed hex string.
"0x1b0c9cf8cd4554c6c6d9e7311e88f1be075d7f25b418a044f4bf2c0a42a93e212ad0a8b54de9e0b5f7e3812de3f2c6cc79aa8c3e1c02e7ad14b4a8f42012c2c01b"
Was this page helpful?