Skip to main content
POST
/
v0
/
generate-intent
Generate an intent for signing
curl --request POST \
  --url https://1click.chaindefuser.com/v0/generate-intent \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "type": "swap_transfer",
  "standard": "nep413",
  "signerId": "user.near",
  "depositAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0"
}
'
import requests

url = "https://1click.chaindefuser.com/v0/generate-intent"

payload = {
"type": "swap_transfer",
"standard": "nep413",
"signerId": "user.near",
"depositAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'swap_transfer',
standard: 'nep413',
signerId: 'user.near',
depositAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0'
})
};

fetch('https://1click.chaindefuser.com/v0/generate-intent', 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://1click.chaindefuser.com/v0/generate-intent",
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([
'type' => 'swap_transfer',
'standard' => 'nep413',
'signerId' => 'user.near',
'depositAddress' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$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://1click.chaindefuser.com/v0/generate-intent"

payload := strings.NewReader("{\n \"type\": \"swap_transfer\",\n \"standard\": \"nep413\",\n \"signerId\": \"user.near\",\n \"depositAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
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://1click.chaindefuser.com/v0/generate-intent")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"swap_transfer\",\n \"standard\": \"nep413\",\n \"signerId\": \"user.near\",\n \"depositAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://1click.chaindefuser.com/v0/generate-intent")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"swap_transfer\",\n \"standard\": \"nep413\",\n \"signerId\": \"user.near\",\n \"depositAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0\"\n}"

response = http.request(request)
puts response.read_body
{
  "intent": {
    "standard": "nep413",
    "payload": {
      "message": "<string>",
      "nonce": "<string>",
      "recipient": "<string>",
      "callbackUrl": "<string>"
    }
  },
  "correlationId": "550e8400-e29b-41d4-a716-446655440000"
}
{
"message": "error message"
}

Authorizations

X-API-Key
string
header
required

API key for partner authentication (recommended)

Body

application/json
type
enum<string>
required

The type of intent action

Available options:
swap_transfer
standard
enum<string>
required

The standard used for signing the intent

Available options:
nep413,
erc191,
raw_ed25519,
webauthn,
ton_connect,
sep53,
tip191
Example:

"nep413"

signerId
string
required

The account ID of the signer

Example:

"user.near"

depositAddress
string
required

The deposit address from the quote response

Example:

"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0"

Response

Successfully generated intent payload

intent
object
required

Narrowed MultiPayload union with only 'standard' and 'payload' properties exposed

correlationId
string
required

Unique identifier for tracing this request

Example:

"550e8400-e29b-41d4-a716-446655440000"