chain.withdraw.v1.WithdrawService
CreateTradingWithdraw
Create or return one durable withdraw from Trading.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/chain.withdraw.v1.WithdrawService/CreateTradingWithdraw' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--data '{
"payload": {
"action": "TO_FUNDING",
"amountE18": {
"hi": "1",
"lo": "1"
},
"assetId": 100,
"deadlineTsSec": "1735689600",
"destinationAddress": "0x3333333333333333333333333333333333333333",
"destinationChainId": "1",
"idempotencyKey": "idem_01J5EXAMPLE0000000000000",
"nonce": {
"hi": "1",
"lo": "1"
}
},
"payloadSignature": "AA=="
}'Responses
{
"intentId": "9155001234567"
}chain.withdraw.v1.CreateTradingWithdrawRequestchain.withdraw.v1.CreateTradingWithdrawResponseDestination for funds leaving Trading.
Unified asset identifier from Polyester asset metadata. amount_e18 is denominated in this asset at canonical 18-decimal scale.
External network id for TO_EXTERNAL_CHAIN. Omit for TO_FUNDING.
Most significant 64 bits.
Least significant 64 bits.
Unix timestamp in seconds after which this signed user authorization is no longer accepted by the API. This is separate from the server-owned execution deadline used later for on-chain submission.
Most significant 64 bits.
Least significant 64 bits.
Destination address. For TO_EXTERNAL_CHAIN this is an address on destination_chain_id and is validated according to that network. For TO_FUNDING, omit it to move funds to the selected account's Funding account or provide another Polyester funding address for a Trading-to-Funding transfer.
Client-chosen idempotency key. Reusing the same key with the same payload returns the existing withdraw; reusing it with different payload fails.
User/API signature over deterministic TradingWithdrawIntentPayload bytes. Must not be empty.
Stable server-owned intent identifier for the accepted withdraw lifecycle. Clients use this id to follow later progress for the same withdraw flow.
| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| account-shard-unavailable | 503 | unavailable | Account Shard Unavailable | The account shard cannot currently accept fund movement. |
| amount-below-minimum | 400 | invalid_argument | Amount Below Minimum | The withdraw amount is below the configured minimum including fees. |
| amount-exceeds-route-precision | 400 | invalid_argument | Amount Exceeds Route Precision | The withdraw amount has more decimal places than the destination network's token supports. |
| amount-exceeds-supply | 400 | invalid_argument | Amount Exceeds Supply | The withdraw amount exceeds the available zipped-asset supply. |
| api-key-binding-invalid | 403 | permission_denied | API Key Binding Invalid | API-key authorization binding verification failed. |
| api-key-binding-public-key-mismatch | 403 | permission_denied | API Key Binding Public Key Mismatch | The API-key authorization binding does not match the configured public key. |
| api-key-binding-scope-mismatch | 403 | permission_denied | API Key Binding Scope Mismatch | The API-key authorization binding does not cover the requested scope. |
| api-key-not-found | 403 | permission_denied | API Key Not Found | The API key could not be resolved. |
| auth-authentication-required | 401 | unauthenticated | Authentication Required | Authentication is required. |
| auth-session-kind-not-allowed | 403 | permission_denied | Interactive Session Required | This operation accepts only an interactive session; API keys are refused. |
| capital-view-unavailable | 503 | unavailable | Capital View Unavailable | The authoritative capital view is not ready. |
| chain-metadata-unavailable | 503 | unavailable | Chain Metadata Unavailable | Required chain or contract metadata is unavailable. |
| conflict | 409 | aborted | Conflict | The request conflicts with existing state. |
| destination-validation-unavailable | 503 | unavailable | Destination Validation Unavailable | Destination validation is temporarily unavailable. |
| external-destination-not-whitelisted | 403 | permission_denied | External Destination Not Whitelisted | The external destination is not whitelisted. |
| failed-precondition | 400 | failed_precondition | Failed Precondition | A required withdraw precondition was not satisfied. |
| fee-unavailable | 503 | unavailable | Fee Unavailable | Required network fee data is unavailable. |
| funds-lock-conflict | 409 | aborted | Funds Lock Conflict | The funds lock conflicts with an existing or finalized reservation. |
| idempotency-conflict | 409 | already_exists | Idempotency Conflict | The idempotency key was reused with different request data. |
| insufficient-funds | 400 | failed_precondition | Insufficient Funds | The source account does not have enough available Trading balance. |
| internal-error | 500 | internal | Internal Error | The withdraw failed because of an unexpected server error. |
| internal-recipient-not-whitelisted | 403 | permission_denied | Internal Recipient Not Whitelisted | The internal funding recipient is not whitelisted. |
| invalid-action | 400 | invalid_argument | Invalid Withdraw Action | The withdraw action is invalid for this endpoint. |
| invalid-amount | 400 | invalid_argument | Invalid Amount | The withdraw amount is invalid. |
| invalid-auto-withdraw-schedule | 400 | invalid_argument | Invalid Auto-Withdraw Schedule | The auto-withdraw schedule is invalid for its cadence. |
| invalid-destination-address | 400 | invalid_argument | Invalid Destination Address | The destination address is invalid. |
| invalid-destination-chain | 400 | invalid_argument | Invalid Destination Chain | The destination chain is invalid. |
| invalid-request | 400 | invalid_argument | Invalid Request | The request payload or one of its fields is invalid. |
| invalid-subaccount-id | 400 | invalid_argument | Invalid Subaccount | The selected subaccount identifier is invalid. |
| not-found | 404 | not_found | Not Found | The requested resource was not found. |
| permission-denied | 403 | permission_denied | Permission Denied | The caller is not permitted to perform this withdraw operation. |
| rate-limit-exceeded | 429 | resource_exhausted | Rate Limit Exceeded | The withdraw admission rate limit was exceeded. |
| service-unavailable | 503 | unavailable | Service Unavailable | A required service is temporarily unavailable. |
| signature-required | 400 | invalid_argument | Signature Required | A payload signature is required. |
| signature-scheme-unsupported | 400 | invalid_argument | Signature Scheme Unsupported | The signature scheme is unsupported. |
| signer-wallet-invalid | 400 | invalid_argument | Invalid Signer Wallet | The signer wallet is invalid. |
| source-smart-account-unavailable | 400 | failed_precondition | Source Smart Account Unavailable | The source smart-account address is unavailable. |
| step-up-unavailable | 503 | unavailable | Step-Up Unavailable | Fresh step-up verification is temporarily unavailable. |
| subaccount-not-found | 404 | not_found | Subaccount Not Found | The selected subaccount does not exist. |
| supply-unavailable | 503 | unavailable | Supply Unavailable | Required zipped-asset supply data is unavailable. |
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication is required. |
| unsupported-asset | 400 | invalid_argument | Unsupported Asset | The requested asset or withdraw route is not supported. |
| unsupported-ledger | 400 | invalid_argument | Unsupported Ledger | The requested ledger is not supported for withdrawals. |
| wallet-binding-invalid | 403 | permission_denied | Wallet Binding Invalid | Wallet authorization binding verification failed. |
| wallet-binding-scope-mismatch | 403 | permission_denied | Wallet Binding Scope Mismatch | The wallet authorization binding does not cover the requested scope. |
| wallet-binding-signer-mismatch | 403 | permission_denied | Wallet Binding Signer Mismatch | The wallet authorization binding does not match the signer. |