> For the complete documentation index, see [llms.txt](https://hinkal-team.gitbook.io/hinkal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hinkal-team.gitbook.io/hinkal/hinkal-waas/api-reference/public-to-public.md).

# Public To Public

## Send tokens from public address to public address

> Executes a deposit-and-withdraw: deposits tokens into the Hinkal contract and immediately\
> schedules a withdrawal to the recipient. Returns the deposit \`txHash\` and a \`scheduleId\`\
> you can poll via \`GET /waas/scheduled-transaction/{scheduleId}\` to track withdrawal status.<br>

```json
{"openapi":"3.0.3","info":{"title":"Hinkal WaaS API","version":"1.0.0"},"tags":[{"name":"public-to-public"}],"servers":[{"url":"https://api.hinkal.io","description":"Production"}],"security":[{"XStamp":[]}],"components":{"securitySchemes":{"XStamp":{"type":"apiKey","in":"header","name":"X-Stamp","description":"Base64URL-encoded JSON: `{ \"publicKey\": \"<hex ed25519 pubkey>\", \"signature\": \"<hex ed25519 sig>\" }`.\nThe signature covers `JSON.stringify([binding, Object.entries(params)])`, where `binding`\nis `\"<METHOD> <routePath>\"` (the server's route pattern, e.g. `\"POST /waas/create-wallet\"`)\nand `params` is the request body (POST) or query params (GET). This binds the stamp to\nits own route so it cannot be replayed against a different endpoint. The one parameterized\nroute, `GET /waas/scheduled-transaction/{scheduleId}`, binds to the literal\n`\"GET /waas/scheduled-transaction/:scheduleId\"`, not the concrete ID. See the Signing\nRequests guide for runnable examples.\n"}},"schemas":{"TransactionRequest":{"type":"object","properties":{"organizationId":{"type":"string"},"userId":{"type":"string"},"fromAddress":{"type":"string"},"to":{"type":"string","description":"Recipient address"},"token":{"type":"string","description":"Token contract address (ERC20 / SPL / TRC20)"},"amount":{"type":"string","description":"Amount to transfer"},"chainId":{"type":"string"},"nonce":{"type":"string"}},"required":["organizationId","userId","fromAddress","to","token","amount","chainId","nonce"]},"SuccessResponse":{"type":"object","properties":{"status":{"type":"string","enum":["success"]}},"required":["status"]},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"message":{"type":"string"}},"required":["status","message"]}},"responses":{"PublicToPublicResponse":{"description":"Deposit transaction submitted and withdrawal scheduled","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessResponse"},{"type":"object","properties":{"data":{"type":"object","required":["txHash","scheduleId"],"properties":{"txHash":{"type":"string","description":"Hash of the on-chain deposit transaction"},"scheduleId":{"type":"string","description":"ID to poll withdrawal status via GET /waas/scheduled-transaction/{scheduleId}"}}}}}]}}}},"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Invalid or missing X-Stamp","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/waas/public-to-public":{"post":{"operationId":"publicToPublic","summary":"Send tokens from public address to public address","description":"Executes a deposit-and-withdraw: deposits tokens into the Hinkal contract and immediately\nschedules a withdrawal to the recipient. Returns the deposit `txHash` and a `scheduleId`\nyou can poll via `GET /waas/scheduled-transaction/{scheduleId}` to track withdrawal status.\n","tags":["public-to-public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/PublicToPublicResponse"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```

## Poll the status of a scheduled withdrawal

> Use the \`scheduleId\` returned by \`POST /waas/public-to-public\` to check whether the\
> withdrawal has been sent on-chain. Poll until \`status\` is \`completed\` or \`failed\`.\
> \
> This route is parameterized, so the \`X-Stamp\` binding is the literal string\
> \`"GET /waas/scheduled-transaction/:scheduleId"\` — with the \`:scheduleId\` placeholder\
> unresolved, not the actual \`scheduleId\` value from the URL.<br>

```json
{"openapi":"3.0.3","info":{"title":"Hinkal WaaS API","version":"1.0.0"},"tags":[{"name":"public-to-public"}],"servers":[{"url":"https://api.hinkal.io","description":"Production"}],"security":[{"XStamp":[]}],"components":{"securitySchemes":{"XStamp":{"type":"apiKey","in":"header","name":"X-Stamp","description":"Base64URL-encoded JSON: `{ \"publicKey\": \"<hex ed25519 pubkey>\", \"signature\": \"<hex ed25519 sig>\" }`.\nThe signature covers `JSON.stringify([binding, Object.entries(params)])`, where `binding`\nis `\"<METHOD> <routePath>\"` (the server's route pattern, e.g. `\"POST /waas/create-wallet\"`)\nand `params` is the request body (POST) or query params (GET). This binds the stamp to\nits own route so it cannot be replayed against a different endpoint. The one parameterized\nroute, `GET /waas/scheduled-transaction/{scheduleId}`, binds to the literal\n`\"GET /waas/scheduled-transaction/:scheduleId\"`, not the concrete ID. See the Signing\nRequests guide for runnable examples.\n"}},"responses":{"ScheduledTransactionStatusResponse":{"description":"Scheduled transaction status","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessResponse"},{"type":"object","properties":{"data":{"type":"object","required":["scheduleId","transactions"],"properties":{"scheduleId":{"type":"string"},"transactions":{"type":"array","items":{"type":"object","required":["status","scheduledTime"],"properties":{"status":{"type":"string","enum":["pending","processing","waiting_for_relayer","sent_on_chain","completed","failed"]},"scheduledTime":{"type":"string","format":"date-time"},"txHash":{"type":"string","nullable":true,"description":"On-chain hash once the withdrawal is sent"}}}}}}}}]}}}},"Unauthorized":{"description":"Invalid or missing X-Stamp","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"SuccessResponse":{"type":"object","properties":{"status":{"type":"string","enum":["success"]}},"required":["status"]},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"message":{"type":"string"}},"required":["status","message"]}}},"paths":{"/waas/scheduled-transaction/{scheduleId}":{"get":{"operationId":"getScheduledTransaction","summary":"Poll the status of a scheduled withdrawal","description":"Use the `scheduleId` returned by `POST /waas/public-to-public` to check whether the\nwithdrawal has been sent on-chain. Poll until `status` is `completed` or `failed`.\n\nThis route is parameterized, so the `X-Stamp` binding is the literal string\n`\"GET /waas/scheduled-transaction/:scheduleId\"` — with the `:scheduleId` placeholder\nunresolved, not the actual `scheduleId` value from the URL.\n","tags":["public-to-public"],"parameters":[{"name":"scheduleId","in":"path","required":true,"schema":{"type":"string"},"description":"The scheduleId returned by POST /waas/public-to-public"}],"responses":{"200":{"$ref":"#/components/responses/ScheduledTransactionStatusResponse"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```
