Prepare an action for signing

Describe the action you want to take, and get back exactly what needs to be signed — along with the wallet's current action number. Signing the wrong bytes is the most common way an integration goes wrong, so this endpoint removes the guesswork: whatever it hands you is what the server will check against when you send the action. ```js const { nonce, challenge } = await prepare({ action: { mint: { template_id, num: 1 } } }); const assertion = await navigator.credentials.get({ publicKey: { challenge: base64urlToBytes(challenge) }, }); await execute({ action, nonce, auth: { type: 'webauthn', /* … */ } }); ``` Preparing changes nothing and costs nothing. It does not reserve the action number and does not hold anything open, so a prepared action you never send simply evaporates. If the wallet does something else in between, prepare again. Requires the `ebus.actions.create` permission.

POST
/ebus/prepare

Authorization

bearer-auth
AuthorizationBearer <token>

The access token returned after a successful sign-in, sent as Authorization: Bearer <access_token>.

It identifies the person and the organization they are working in, and it lasts about fifteen minutes. When it runs out, use their refresh token at POST /auth/refresh-token instead of asking them to sign in again.

In: header

Request Body

application/json

The action you are about to take.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.dual.network/ebus/prepare" \  -H "Content-Type: application/json" \  -d '{    "action": {      "mint": {        "template_id": "665f1c2d4b1a2c3d4e5f6a99",        "num": 2      }    }  }'
{
  "nonce": 3,
  "challenge": "s5f2X8kQvLbA1mZ0pYtR7cJdEwNhGuIoP3qS6rT9vXk"
}
{
  "code": 3,
  "message": "Key: 'limit' Error:Field validation for 'limit' failed on the 'lte' tag"
}

{
  "code": 16,
  "message": "no auth provided"
}

{
  "code": 13,
  "message": "internal error"
}