From 269cc5d7e9d79fdf509be0e5b899897f2e4ad6e2 Mon Sep 17 00:00:00 2001 From: aodyc Date: Sat, 18 Oct 2025 16:04:03 +0800 Subject: [PATCH 01/11] add new documents: 1. aster-api-key 2. aster-deposit-withdraw 3. aster-broker-deposit-withdraw --- README.md | 4 + aster-broker-api-key-registration.md | 45 +++- aster-broker-deposit-withdrawal.md | 276 +++++++++++++++++++++++ aster-deposit-withdrawal.md | 326 +++++++++++++++++++++++++++ 4 files changed, 650 insertions(+), 1 deletion(-) create mode 100644 aster-broker-deposit-withdrawal.md create mode 100644 aster-deposit-withdrawal.md diff --git a/README.md b/README.md index 856f478..df5f16a 100644 --- a/README.md +++ b/README.md @@ -42,5 +42,9 @@ [Aster-Broker API Key 注册](./aster-broker-api-key-registration.md) +# Aster 充值提现 +[Aster Deposit and Withdrawal](./aster-deposit-withdrawal.md) +# Aster-Broker 充值提现 +[Aster-Broker Deposit and Withdrawal](./aster-broker-deposit-withdrawal.md) diff --git a/aster-broker-api-key-registration.md b/aster-broker-api-key-registration.md index ca0b3e3..946cee4 100644 --- a/aster-broker-api-key-registration.md +++ b/aster-broker-api-key-registration.md @@ -38,7 +38,50 @@ You are signing into Aster DEX 501182 0xa4ee6b068060caeac447216b592a918b085642056248e6ff50ba22b50e8884875ead28f06cbcefcbb93d03997f807fd242354d878756f4690f791ae8dbfcde841c ``` -# 3. create api-key +# 3. login + +### request: +```shell +curl 'https://www.apollox.finance/bapi/futures/v1/public/future/web3/loginReturnAccount' \ + + -H 'content-type: application/json' \ + --data-raw '{ + "signature":"0xafb84ca3bd36131970636a298677be2e1de4ed81b11101e417272d23f0b7f9af174efdf954ae7a63e844c83d16a4ad391e801c6766a422e647832b5c0c8aa1591c", + "sourceAddr":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "chainId":56, + "sourceCode": "broker", + "agentCode": "ce6maa" + }' +``` + +### params: + +|param | type | required | description | +|------|------|----------|----------------------------------------| +| signature | string | yes | signature from previous step | +| sourceAddr | string | yes | the address used to sign the message | +| chainId | int | yes | blockchain network id, e.g. 56 for BSC | +| sourceCode | string | no | broker's name | +| agentCode | string | no | broker's referral code | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": { + "uid": 12345678, + "fuid": 12345678, + "accountId": 12345678 + }, + "success": true +} +``` + + +# 4. create api-key ### request: diff --git a/aster-broker-deposit-withdrawal.md b/aster-broker-deposit-withdrawal.md new file mode 100644 index 0000000..be0aead --- /dev/null +++ b/aster-broker-deposit-withdrawal.md @@ -0,0 +1,276 @@ +# # 1. get all deposit assets + +### request: + +```shell +curl 'https://www.asterdex.com/bapi/futures/v1/public/future/apx/deposit/assets?chainIds=56&networks=EVM' +``` + +### params: +|param | type | required | description | +|-----------|--------|----------|------------------------------------------------------------------------| +| chainIds | string | true | Chain ID, multiple IDs separated by commas | +| networks | string | false | Network type, e.g., EVM, SOLANA, multiple networks separated by commas | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": [ + { + "name": "ASTER", + "displayName": "ASTER", + "contractAddress": "0x000ae314e2a2172a039b26378814c252734f556a", + "decimals": 18, + "network": "EVM", + "chainId": 56, + "depositType": "normal", + "rank": 10, + "isNative": false, + "admin": null, + "bank": null, + "tokenVaultAuthority": null, + "tokenVault": null, + "tokenMint": null, + "associatedTokenProgram": null, + "tokenProgram": null, + "systemProgram": null, + "ixSysvar": null, + "priceFeed": null, + "priceFeedProgram": null, + "solVault": null + } + ], + "success": true +} +``` + +# 2. get all withdraw assets + +### request: + +```shell +curl 'https://www.asterdex.com/bapi/futures/v1/public/future/apx/withdraw/assets?chainIds=56&networks=EVM' +``` + +### params: +|param | type | required | description | +|-----------|--------|----------|------------------------------------------------------------------------| +| chainIds | string | true | Chain ID, multiple IDs separated by commas | +| networks | string | false | Network type, e.g., EVM, SOLANA, multiple networks separated by commas | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": [ + { + "name": "ASTER", + "displayName": "ASTER", + "contractAddress": "0x000ae314e2a2172a039b26378814c252734f556a", + "decimals": 18, + "network": "EVM", + "chainId": 56, + "withdrawType": "autoWithdraw", + "rank": 10, + "isNative": false, + "isProfit": true, + "admin": null, + "bank": null, + "tokenVaultAuthority": null, + "tokenVault": null, + "tokenMint": null, + "associatedTokenProgram": null, + "tokenProgram": null, + "systemProgram": null, + "ixSysvar": null, + "priceFeed": null, + "priceFeedProgram": null, + "solVault": null + } + ], + "success": true +} +``` + +# 3. estimate withdraw fee + +### request: + +```shell +curl 'https://www.asterdex.com/bapi/futures/v1/public/future/apx/estimate-withdraw-fee?chainId=56&network=EVM¤cy=ASTER' +``` + +### params: + +|param | type | required | description | +|------------|--------|----------|------------------------------| +| chainId | int | true | Chain ID | +| network | string | true | Network type, e.g., EVM, SOL | +| currency | string | true | Currency name, e.g., ASTER | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": { + "gasPrice": null, + "gasLimit": 200000, + "nativePrice": null, + "tokenPrice": 1.12357820, + "gasCost": 0.0891, + "gasUsdValue": 0.1 + }, + "success": true +} +``` + +- gasCost: Estimated withdrawal fee in token units + +# 4. withdraw signature + +* when you withdraw, you should supply a EIP712 signature. You can get the signature by signing the following message with your wallet. + +### EIP712 Domain + +```json +{ + "name": "APX", + "version": "1", + "chainId": 56, + "verifyingContract": "0xcEF2dD45Da08b37fB1c2f441d33c2eBb424866A4" +} +``` + +|field| desc | +|---|-------------------------------| +|name| fix string 'Aster' | +|version| fix string '1' | +|chainId| the chainId of withdraw chain | +|verifyingContract| contract address, see below | + +### EIP712 Types + +```json +{ + "Action": [ + {"name": "type", "type": "string"}, + {"name": "destination", "type": "address"}, + {"name": "destination Chain", "type": "string"}, + {"name": "token", "type": "string"}, + {"name": "amount", "type": "string"}, + {"name": "fee", "type": "string"}, + {"name": "nonce", "type": "uint256"} + ] +} +``` + +|field | desc | +|---------------|-------------------------------------------------------------------------------------------------------| +|type | fix string 'Withdraw' | +|destination | the receipt address, should be user's register address | +|destination Chain | the chain name of receipt address, you can see the defination of chainName below | +|token| the name of the currency user withdraw, e.g. ASTER, you can get the name from withdraw/asset API | +|amount | the amount user withdraw in token unit, eg. '1.23' | +|fee| the fee user will pay in token unit, eg. '0.01' (you can get the fee from withdraw/estimate-withdraw-fee API) | +|nonce| a unique number, use the current timestamp in milliseconds and multiply '1000' | + +### chainName definition + +|chainId| chainName | contractAddress | +|---|-----------|-----------------| +|56| BSC | 0xcEF2dD45Da08b37fB1c2f441d33c2eBb424866A4 | +|42161| Arbitrum | 0xBAd4ccc91EF0dfFfbCAb1402C519601fbAf244EF | +|1| ETH | 0xb40EEd68d7d6B3b6d6f4E93DE6239B7C53EFc786 | +|8453|Base| 0x11db0BEb34766277a1d7CAc7590b3Cf4BBf5E4eB | +|324|zkSync| 0xD6f4e33063C881cE9a98e07E13673B92a637D908 | +|169|Manta| 0xBAd4ccc91EF0dfFfbCAb1402C519601fbAf244EF | + +# 5. withdraw + +### request: + +```shell +curl -X POST "https://www.asterdex.com/bapi/futures/v1/private/future/apx/user-withdraw" -H "accept: */*" -H "x-gray-env: normal" -H "x-trace-id: fa2a5961b4a346e083f2bb0bffe39e2f" -H "Content-Type: application/json" \ +-d "{ \"accountType\": \"spot\", \"amount\": \"10.2\", \"chainId\": 97, \"currency\": \"USDT\", \"fee\": \"0.01\", \"nonce\": \"1761029928213000\", \"receiver\": \"0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7\", \"userSignature\": \"0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c\"}" +``` + +### params: +|param | type | required | description | +|--------------|--------|----------|-----------------------------------------------------------| +| accountType | string | true | Account type, e.g., spot, perp | +| amount | string | true | Withdraw amount in token unit | +| chainId | int | true | Chain ID | +| currency | string | true | Currency name, e.g., ASTER | +| fee | string | true | Withdraw fee in token unit | +| nonce | string | true | Unique number, should be the save in signature | +| receiver | string | true | Withdraw receipt address, should be the save in signature | +| userSignature | string | true | EIP712 signature | + +### response: + +```json +{ + "code": "200", + "message": "success", + "messageDetail": null, + "data": { + "withdrawId": "1234567", + "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" + }, + "success": true +} +``` + +|field | desc | +|-----------|--------------------------------------| +|withdrawId | the withdraw request id, a unique id | +|hash | the digest of user's signature | + +# 6. withdraw by API [futures] + +### request: + +```shell +curl 'https://fapi.asterdex.com/fapi/apx/user-withdraw?asset=USDT&amount=10.2&chainId=56&fee=0.01&nonce=1761029928213000&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&userSignature=0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c' +``` + +### params: +| param | type | required | description | +|---------------|--------|----------|-----------------------------------------------------------| +| amount | string | true | Withdraw amount in token unit | +| chainId | int | true | Chain ID | +| asset | string | true | Currency name, e.g., ASTER | +| fee | string | true | Withdraw fee in token unit | +| nonce | string | true | Unique number, should be the save in signature | +| receiver | string | true | Withdraw receipt address, should be the save in signature | +| userSignature | string | true | EIP712 signature | + +### response: + +```json +{ + "code": "200", + "message": "success", + "messageDetail": null, + "data": { + "withdrawId": "1234567", + "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" + }, + "success": true +} +``` + +|field | desc | +|-----------|--------------------------------------| +|withdrawId | the withdraw request id, a unique id | +|hash | the digest of user's signature | diff --git a/aster-deposit-withdrawal.md b/aster-deposit-withdrawal.md new file mode 100644 index 0000000..5e458ce --- /dev/null +++ b/aster-deposit-withdrawal.md @@ -0,0 +1,326 @@ +# 1. get all deposit assets + +### request: + +```shell +curl 'https://www.asterdex.com/bapi/futures/v1/public/future/aster/deposit/assets?chainIds=56&networks=EVM&accountType=spot' +``` + +### params: +|param | type | required | description | +|-----------|--------|----------|------------------------------------------------------------------------| +| chainIds | string | true | Chain ID, multiple IDs separated by commas | +| networks | string | false | Network type, e.g., EVM, SOLANA, multiple networks separated by commas | +| accountType | string | true | Account type, e.g., spot, perp | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": [ + { + "name": "ASTER", + "displayName": "ASTER", + "contractAddress": "0x000ae314e2a2172a039b26378814c252734f556a", + "decimals": 18, + "network": "EVM", + "chainId": 56, + "depositType": "normal", + "rank": 10, + "isNative": false, + "admin": null, + "bank": null, + "tokenVaultAuthority": null, + "tokenVault": null, + "tokenMint": null, + "associatedTokenProgram": null, + "tokenProgram": null, + "systemProgram": null, + "ixSysvar": null, + "priceFeed": null, + "priceFeedProgram": null, + "solVault": null + } + ], + "success": true +} +``` + +# 2. get all withdraw assets + +### request: + +```shell +curl 'https://www.asterdex.com/bapi/futures/v1/public/future/aster/withdraw/assets?chainIds=56&networks=EVM&accountType=spot' +``` + +### params: +|param | type | required | description | +|-----------|--------|----------|------------------------------------------------------------------------| +| chainIds | string | true | Chain ID, multiple IDs separated by commas | +| networks | string | false | Network type, e.g., EVM, SOLANA, multiple networks separated by commas | +| accountType | string | true | Account type, e.g., spot, perp | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": [ + { + "name": "ASTER", + "displayName": "ASTER", + "contractAddress": "0x000ae314e2a2172a039b26378814c252734f556a", + "decimals": 18, + "network": "EVM", + "chainId": 56, + "withdrawType": "autoWithdraw", + "rank": 10, + "isNative": false, + "isProfit": true, + "admin": null, + "bank": null, + "tokenVaultAuthority": null, + "tokenVault": null, + "tokenMint": null, + "associatedTokenProgram": null, + "tokenProgram": null, + "systemProgram": null, + "ixSysvar": null, + "priceFeed": null, + "priceFeedProgram": null, + "solVault": null + } + ], + "success": true +} +``` + +# 3. estimate withdraw fee + +### request: + +```shell +curl 'https://www.asterdex.com/bapi/futures/v1/public/future/aster/estimate-withdraw-fee?chainId=56&network=EVM¤cy=ASTER&accountType=spot' +``` + +### params: + +|param | type | required | description | +|------------|--------|----------|------------------------------| +| chainId | int | true | Chain ID | +| network | string | true | Network type, e.g., EVM, SOL | +| currency | string | true | Currency name, e.g., ASTER | +| accountType | string | true | Account type, e.g., spot, perp | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": { + "gasPrice": null, + "gasLimit": 200000, + "nativePrice": null, + "tokenPrice": 1.12357820, + "gasCost": 0.0891, + "gasUsdValue": 0.1 + }, + "success": true +} +``` + +- gasCost: Estimated withdrawal fee in token units + +# 4. withdraw signature + +* when you withdraw, you should supply a EIP712 signature. You can get the signature by signing the following message with your wallet. + +### EIP712 Domain + +```json +{ + "name": "Aster", + "version": "1", + "chainId": 56, + "verifyingContract": "0x0000000000000000000000000000000000000000" +} +``` + +|field|desc| +|---|---| +|name|fix string 'Aster'| +|version|fix string '1'| +|chainId|the chainId of withdraw chain| +|verifyingContract|fix address: zero address| + +### EIP712 Types + +```json +{ + "Action": [ + {"name": "type", "type": "string"}, + {"name": "destination", "type": "address"}, + {"name": "destination Chain", "type": "string"}, + {"name": "token", "type": "string"}, + {"name": "amount", "type": "string"}, + {"name": "fee", "type": "string"}, + {"name": "nonce", "type": "uint256"}, + {"name": "aster chain", "type": "string"} + ] +} +``` + +|field | desc | +|---------------|-------------------------------------------------------------------------------------------------------| +|type | fix string 'Withdraw' | +|destination | the receipt address, should be user's register address | +|destination Chain | the chain name of receipt address, you can see the defination of chainName below | +|token| the name of the currency user withdraw, e.g. ASTER, you can get the name from withdraw/asset API | +|amount | the amount user withdraw in token unit, eg. '1.23' | +|fee| the fee user will pay in token unit, eg. '0.01' (you can get the fee from withdraw/estimate-withdraw-fee API) | +|nonce| a unique number, use the current timestamp in milliseconds and multiply '1000' | +|aster chain| fix string 'Mainnet' | + +### chainName definition + +|chainId| chainName | +|---|-----------| +|56| BSC | +|42161| Arbitrum | +|1| ETH | + +# 5. withdraw + +### request: + +```shell +curl -X POST "https://www.asterdex.com/bapi/futures/v1/private/future/aster/user-withdraw" -H "accept: */*" -H "x-gray-env: normal" -H "x-trace-id: fa2a5961b4a346e083f2bb0bffe39e2f" -H "Content-Type: application/json" \ +-d "{ \"accountType\": \"spot\", \"amount\": \"10.2\", \"chainId\": 97, \"currency\": \"USDT\", \"fee\": \"0.01\", \"nonce\": \"1761029928213000\", \"receiver\": \"0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7\", \"userSignature\": \"0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c\"}" +``` + +### params: +|param | type | required | description | +|--------------|--------|----------|-----------------------------------------------------------| +| accountType | string | true | Account type, e.g., spot, perp | +| amount | string | true | Withdraw amount in token unit | +| chainId | int | true | Chain ID | +| currency | string | true | Currency name, e.g., ASTER | +| fee | string | true | Withdraw fee in token unit | +| nonce | string | true | Unique number, should be the save in signature | +| receiver | string | true | Withdraw receipt address, should be the save in signature | +| userSignature | string | true | EIP712 signature | + +### response: + +```json +{ + "code": "200", + "message": "success", + "messageDetail": null, + "data": { + "withdrawId": "1234567", + "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" + }, + "success": true +} +``` + +|field | desc | +|-----------|--------------------------------------| +|withdrawId | the withdraw request id, a unique id | +|hash | the digest of user's signature | + +# 6. withdraw by API [futures] + +### request: + +```shell +curl 'https://fapi.asterdex.com/fapi/aster/user-withdraw?asset=USDT&amount=10.2&chainId=56&fee=0.01&nonce=1761029928213000&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&userSignature=0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c' +``` + +### params: +| param | type | required | description | +|---------------|--------|----------|-----------------------------------------------------------| +| amount | string | true | Withdraw amount in token unit | +| chainId | int | true | Chain ID | +| asset | string | true | Currency name, e.g., ASTER | +| fee | string | true | Withdraw fee in token unit | +| nonce | string | true | Unique number, should be the save in signature | +| receiver | string | true | Withdraw receipt address, should be the save in signature | +| userSignature | string | true | EIP712 signature | + +### response: + +```json +{ + "code": "200", + "message": "success", + "messageDetail": null, + "data": { + "withdrawId": "1234567", + "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" + }, + "success": true +} +``` + +|field | desc | +|-----------|--------------------------------------| +|withdrawId | the withdraw request id, a unique id | +|hash | the digest of user's signature | + +# 7. withdraw by API [spot] + +### request: + +```shell +curl -XPOST 'https://sapi.asterdex.com/api/v1/aster/user-withdraw' \ +-d '{ \ + "asset": "USDT" + "amount": "10.2", + "chainId": "56" + "fee": "0.01", + "nonce": "1761029928213000" + "receiver": "0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7", + "userSignature": "0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c" \ +}' +``` + +### params: +| param | type | required | description | +|---------------|--------|----------|-----------------------------------------------------------| +| amount | string | true | Withdraw amount in token unit | +| chainId | int | true | Chain ID | +| asset | string | true | Currency name, e.g., ASTER | +| fee | string | true | Withdraw fee in token unit | +| nonce | string | true | Unique number, should be the save in signature | +| receiver | string | true | Withdraw receipt address, should be the save in signature | +| userSignature | string | true | EIP712 signature | + +### response: + +```json +{ + "code": "200", + "message": "success", + "messageDetail": null, + "data": { + "withdrawId": "1234567", + "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" + }, + "success": true +} +``` + +|field | desc | +|-----------|--------------------------------------| +|withdrawId | the withdraw request id, a unique id | +|hash | the digest of user's signature | \ No newline at end of file From a5a39ba116feefae9ef341f7377fb6c827e9dc2d Mon Sep 17 00:00:00 2001 From: aodyc Date: Thu, 23 Oct 2025 23:06:26 +0800 Subject: [PATCH 02/11] fix docs --- aster-broker-api-key-registration.md | 25 +++++++++++++------------ aster-broker-deposit-withdrawal.md | 4 +++- aster-deposit-withdrawal.md | 17 ++++++----------- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/aster-broker-api-key-registration.md b/aster-broker-api-key-registration.md index 946cee4..bb6c8c4 100644 --- a/aster-broker-api-key-registration.md +++ b/aster-broker-api-key-registration.md @@ -42,27 +42,25 @@ You are signing into Aster DEX 501182 ### request: ```shell -curl 'https://www.apollox.finance/bapi/futures/v1/public/future/web3/loginReturnAccount' \ +curl -XPOST 'https://www.apollox.finance/bapi/futures/v1/public/future/web3/register-from-3party' \ -H 'content-type: application/json' \ --data-raw '{ "signature":"0xafb84ca3bd36131970636a298677be2e1de4ed81b11101e417272d23f0b7f9af174efdf954ae7a63e844c83d16a4ad391e801c6766a422e647832b5c0c8aa1591c", "sourceAddr":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "chainId":56, - "sourceCode": "broker", - "agentCode": "ce6maa" + "sourceAgent": "broker" }' ``` ### params: -|param | type | required | description | -|------|------|----------|----------------------------------------| -| signature | string | yes | signature from previous step | -| sourceAddr | string | yes | the address used to sign the message | -| chainId | int | yes | blockchain network id, e.g. 56 for BSC | -| sourceCode | string | no | broker's name | -| agentCode | string | no | broker's referral code | +| param | type | required | description | +|-------------|------|----------|----------------------------------------| +| signature | string | yes | signature from previous step | +| sourceAddr | string | yes | the address used to sign the message | +| chainId | int | yes | blockchain network id, e.g. 56 for BSC | +| sourceAgent | string | no | broker's name | ### response: @@ -72,9 +70,12 @@ curl 'https://www.apollox.finance/bapi/futures/v1/public/future/web3/loginReturn "message": null, "messageDetail": null, "data": { + "apiKey": "D5M8792356G7H8J9K0L1N2B3V4C5X6Z7", + "apiSecret": "XXXXXXXX", + "keyId": 1234567, "uid": 12345678, - "fuid": 12345678, - "accountId": 12345678 + "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "apiName": "SafePal-Authorized" }, "success": true } diff --git a/aster-broker-deposit-withdrawal.md b/aster-broker-deposit-withdrawal.md index be0aead..5987812 100644 --- a/aster-broker-deposit-withdrawal.md +++ b/aster-broker-deposit-withdrawal.md @@ -241,7 +241,9 @@ curl -X POST "https://www.asterdex.com/bapi/futures/v1/private/future/apx/user-w ### request: ```shell -curl 'https://fapi.asterdex.com/fapi/apx/user-withdraw?asset=USDT&amount=10.2&chainId=56&fee=0.01&nonce=1761029928213000&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&userSignature=0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c' +curl --location --request POST 'https://fapi.asterdex.com/fapi/apx/user-withdraw?chainId=56&asset=USDT&amount=31&fee=0.3&receiver=0xcEF2dD45Da08b37fB1c2f441d33c2eBb424866A4&nonce=1761210000000000&userSignature=0xde4ca529eef20db136eed1daf1d072083431d5279e6d6e219600cf57161c5e6d1232af3c8a8ef37ba8b5963f439ef9cc2b475fe18dcc3732dda9fb93c94a3abd1c&recvWindow=60000×tamp=1761230958410&signature=f5fd60da19be213d58914dd6f46bc400ada617fb916998dfc01dd346bfdad512' \ +--header 'Content-Type: application/json' \ +--header 'X-MBX-APIKEY: Your API KEY' ``` ### params: diff --git a/aster-deposit-withdrawal.md b/aster-deposit-withdrawal.md index 5e458ce..62d455e 100644 --- a/aster-deposit-withdrawal.md +++ b/aster-deposit-withdrawal.md @@ -243,7 +243,9 @@ curl -X POST "https://www.asterdex.com/bapi/futures/v1/private/future/aster/user ### request: ```shell -curl 'https://fapi.asterdex.com/fapi/aster/user-withdraw?asset=USDT&amount=10.2&chainId=56&fee=0.01&nonce=1761029928213000&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&receiver=0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7&userSignature=0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c' +curl --location --request POST 'https://fapi.asterdex.com/fapi/apx/user-withdraw?chainId=56&asset=USDT&amount=31&fee=0.3&receiver=0x000ae314e2a2172a039b26378814c252734f556a&nonce=1761210000000000&userSignature=0xde4ca529eef20db136eed1daf1d072083431d5279e6d6e219600cf57161c5e6d1232af3c8a8ef37ba8b5963f439ef9cc2b475fe18dcc3732dda9fb93c94a3abd1c&recvWindow=60000×tamp=1761230958410&signature=f5fd60da19be213d58914dd6f46bc400ada610fb916998dfc01dd346bfdad512' \ +--header 'Content-Type: application/json' \ +--header 'X-MBX-APIKEY: Your API KEY' ``` ### params: @@ -282,16 +284,9 @@ curl 'https://fapi.asterdex.com/fapi/aster/user-withdraw?asset=USDT&amount=10.2& ### request: ```shell -curl -XPOST 'https://sapi.asterdex.com/api/v1/aster/user-withdraw' \ --d '{ \ - "asset": "USDT" - "amount": "10.2", - "chainId": "56" - "fee": "0.01", - "nonce": "1761029928213000" - "receiver": "0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7", - "userSignature": "0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c" \ -}' +curl --location --request POST 'https://sapi.asterdex.com/api/v1/aster/user-withdraw?chainId=56&asset=ASTER&amount=1&fee=0.095&receiver=0x000ae314e2a2172a039b26378814c252734f556a&nonce=1761222960000000&userSignature=0x39051cc68de0fefb8e823259d3f7014fc787a8008b65d2a89d70defc48c3f91b35a4a819718c22ffcaeb143c8e1735621a0768d7c69e45ad8fbcf9bd315988423b&recvWindow=60000×tamp=1761230958410&signature=f5fd60da19be213d58914dd6f46bc400ada610fb916998dfc01dd346bfdad51' \ +--header 'Content-Type: application/json' \ +--header 'X-MBX-APIKEY: Your API KEY' ``` ### params: From 21417bce447f53c13daf90074283696593ea1c4b Mon Sep 17 00:00:00 2001 From: aodyc Date: Mon, 27 Oct 2025 16:43:46 +0800 Subject: [PATCH 03/11] fix path --- aster-deposit-withdrawal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aster-deposit-withdrawal.md b/aster-deposit-withdrawal.md index 62d455e..e69ef7c 100644 --- a/aster-deposit-withdrawal.md +++ b/aster-deposit-withdrawal.md @@ -243,7 +243,7 @@ curl -X POST "https://www.asterdex.com/bapi/futures/v1/private/future/aster/user ### request: ```shell -curl --location --request POST 'https://fapi.asterdex.com/fapi/apx/user-withdraw?chainId=56&asset=USDT&amount=31&fee=0.3&receiver=0x000ae314e2a2172a039b26378814c252734f556a&nonce=1761210000000000&userSignature=0xde4ca529eef20db136eed1daf1d072083431d5279e6d6e219600cf57161c5e6d1232af3c8a8ef37ba8b5963f439ef9cc2b475fe18dcc3732dda9fb93c94a3abd1c&recvWindow=60000×tamp=1761230958410&signature=f5fd60da19be213d58914dd6f46bc400ada610fb916998dfc01dd346bfdad512' \ +curl --location --request POST 'https://fapi.asterdex.com/fapi/aster/user-withdraw?chainId=56&asset=USDT&amount=31&fee=0.3&receiver=0x000ae314e2a2172a039b26378814c252734f556a&nonce=1761210000000000&userSignature=0xde4ca529eef20db136eed1daf1d072083431d5279e6d6e219600cf57161c5e6d1232af3c8a8ef37ba8b5963f439ef9cc2b475fe18dcc3732dda9fb93c94a3abd1c&recvWindow=60000×tamp=1761230958410&signature=f5fd60da19be213d58914dd6f46bc400ada610fb916998dfc01dd346bfdad512' \ --header 'Content-Type: application/json' \ --header 'X-MBX-APIKEY: Your API KEY' ``` From 05c1637a1f291745fd005d2c012d7d294497a0ec Mon Sep 17 00:00:00 2001 From: aodyc Date: Mon, 27 Oct 2025 21:08:42 +0800 Subject: [PATCH 04/11] remove useless --- README.md | 7 - aster-broker-api-key-registration.md | 136 ------------- aster-broker-deposit-withdrawal.md | 278 --------------------------- 3 files changed, 421 deletions(-) delete mode 100644 aster-broker-api-key-registration.md delete mode 100644 aster-broker-deposit-withdrawal.md diff --git a/README.md b/README.md index df5f16a..bfb4638 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,6 @@ [Aster 现货资产归集脚本示例](./consolidation.js) -# Aster-Broker API Key 注册 - -[Aster-Broker API Key 注册](./aster-broker-api-key-registration.md) - # Aster 充值提现 [Aster Deposit and Withdrawal](./aster-deposit-withdrawal.md) -# Aster-Broker 充值提现 - -[Aster-Broker Deposit and Withdrawal](./aster-broker-deposit-withdrawal.md) diff --git a/aster-broker-api-key-registration.md b/aster-broker-api-key-registration.md deleted file mode 100644 index bb6c8c4..0000000 --- a/aster-broker-api-key-registration.md +++ /dev/null @@ -1,136 +0,0 @@ -# 1. get nonce - -### request: - -```shell -curl --location 'https://www.asterdex.com/bapi/futures/v1/public/future/web3/get-nonce' \ ---header 'Content-Type: application/json' \ ---data '{ -"sourceAddr" : "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", -"type": "CREATE_API_KEY" -} -``` - -### response: -```json -{ - "code": "000000", - "message": null, - "messageDetail": null, - "data": { - "nonce": "501182" - }, - "success": true -} -``` - -# 2. sign message - -### message: - -```text -You are signing into Aster DEX 501182 -``` - -### result: - -```text -0xa4ee6b068060caeac447216b592a918b085642056248e6ff50ba22b50e8884875ead28f06cbcefcbb93d03997f807fd242354d878756f4690f791ae8dbfcde841c -``` - -# 3. login - -### request: -```shell -curl -XPOST 'https://www.apollox.finance/bapi/futures/v1/public/future/web3/register-from-3party' \ - - -H 'content-type: application/json' \ - --data-raw '{ - "signature":"0xafb84ca3bd36131970636a298677be2e1de4ed81b11101e417272d23f0b7f9af174efdf954ae7a63e844c83d16a4ad391e801c6766a422e647832b5c0c8aa1591c", - "sourceAddr":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", - "chainId":56, - "sourceAgent": "broker" - }' -``` - -### params: - -| param | type | required | description | -|-------------|------|----------|----------------------------------------| -| signature | string | yes | signature from previous step | -| sourceAddr | string | yes | the address used to sign the message | -| chainId | int | yes | blockchain network id, e.g. 56 for BSC | -| sourceAgent | string | no | broker's name | - -### response: - -```json -{ - "code": "000000", - "message": null, - "messageDetail": null, - "data": { - "apiKey": "D5M8792356G7H8J9K0L1N2B3V4C5X6Z7", - "apiSecret": "XXXXXXXX", - "keyId": 1234567, - "uid": 12345678, - "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", - "apiName": "SafePal-Authorized" - }, - "success": true -} -``` - - -# 4. create api-key - -### request: - -```shell -curl --location 'https://www.asterdex.com/bapi/futures/v1/public/future/web3/broker-create-api-key' \ ---header 'accept: */*' \ ---header 'Content-Type: application/json' \ ---data '{ -"desc": "test description", -"ip": "", -"network": "56", -"signature": "0xa4ee6b068060caeac447216b592a918b085642056248e6ff50ba22b50e8884875ead28f06cbcefcbb93d03997f807fd242354d878756f4690f791ae8dbfcde841c", -"sourceAddr": "0xE90F9596e3Bfd49e9f4c2E0eA48830DC47e6997b", -"type": "CREATE_API_KEY", -"sourceCode": "broker" -}' -``` - -### params: - -|param | type | required | description | -|------|------|----------|-------------------------------------------| -| desc | string | yes | api-key's description, should unique | -| ip | string | no | whitelist ip addresses, separated by ',' | -| network | string | yes | blockchain network, e.g. '56' for BSC | -| signature | string | yes | signature from previous step | -| sourceAddr | string | yes | the address used to sign the message | -| type | string | yes | fixed value "CREATE_API_KEY" | -| sourceCode | string | no | "ae" for aster and other value for broker | - -### response: - -```json -{ - "code": "000000", - "message": null, - "messageDetail": null, - "data": { - "apiKey": "4a2e11b243b1ad75981edf359ae02e873bf88b699196170d998d8266f5eb9f32", - "apiSecret": "72911505f67b24a8efe8f246d06c324b787d2f3f7cb8b5b80ef1698ee1486e25", - "keyId": 0, - "apiName": null - }, - "success": true -} -``` - -### note: - -1. Please keep a record of the returned apiKey and apiSecret. If you lose them, you cannot retrieve them and can only create them again. -2. api-key can't be deleted by user now. \ No newline at end of file diff --git a/aster-broker-deposit-withdrawal.md b/aster-broker-deposit-withdrawal.md deleted file mode 100644 index 5987812..0000000 --- a/aster-broker-deposit-withdrawal.md +++ /dev/null @@ -1,278 +0,0 @@ -# # 1. get all deposit assets - -### request: - -```shell -curl 'https://www.asterdex.com/bapi/futures/v1/public/future/apx/deposit/assets?chainIds=56&networks=EVM' -``` - -### params: -|param | type | required | description | -|-----------|--------|----------|------------------------------------------------------------------------| -| chainIds | string | true | Chain ID, multiple IDs separated by commas | -| networks | string | false | Network type, e.g., EVM, SOLANA, multiple networks separated by commas | - -### response: - -```json -{ - "code": "000000", - "message": null, - "messageDetail": null, - "data": [ - { - "name": "ASTER", - "displayName": "ASTER", - "contractAddress": "0x000ae314e2a2172a039b26378814c252734f556a", - "decimals": 18, - "network": "EVM", - "chainId": 56, - "depositType": "normal", - "rank": 10, - "isNative": false, - "admin": null, - "bank": null, - "tokenVaultAuthority": null, - "tokenVault": null, - "tokenMint": null, - "associatedTokenProgram": null, - "tokenProgram": null, - "systemProgram": null, - "ixSysvar": null, - "priceFeed": null, - "priceFeedProgram": null, - "solVault": null - } - ], - "success": true -} -``` - -# 2. get all withdraw assets - -### request: - -```shell -curl 'https://www.asterdex.com/bapi/futures/v1/public/future/apx/withdraw/assets?chainIds=56&networks=EVM' -``` - -### params: -|param | type | required | description | -|-----------|--------|----------|------------------------------------------------------------------------| -| chainIds | string | true | Chain ID, multiple IDs separated by commas | -| networks | string | false | Network type, e.g., EVM, SOLANA, multiple networks separated by commas | - -### response: - -```json -{ - "code": "000000", - "message": null, - "messageDetail": null, - "data": [ - { - "name": "ASTER", - "displayName": "ASTER", - "contractAddress": "0x000ae314e2a2172a039b26378814c252734f556a", - "decimals": 18, - "network": "EVM", - "chainId": 56, - "withdrawType": "autoWithdraw", - "rank": 10, - "isNative": false, - "isProfit": true, - "admin": null, - "bank": null, - "tokenVaultAuthority": null, - "tokenVault": null, - "tokenMint": null, - "associatedTokenProgram": null, - "tokenProgram": null, - "systemProgram": null, - "ixSysvar": null, - "priceFeed": null, - "priceFeedProgram": null, - "solVault": null - } - ], - "success": true -} -``` - -# 3. estimate withdraw fee - -### request: - -```shell -curl 'https://www.asterdex.com/bapi/futures/v1/public/future/apx/estimate-withdraw-fee?chainId=56&network=EVM¤cy=ASTER' -``` - -### params: - -|param | type | required | description | -|------------|--------|----------|------------------------------| -| chainId | int | true | Chain ID | -| network | string | true | Network type, e.g., EVM, SOL | -| currency | string | true | Currency name, e.g., ASTER | - -### response: - -```json -{ - "code": "000000", - "message": null, - "messageDetail": null, - "data": { - "gasPrice": null, - "gasLimit": 200000, - "nativePrice": null, - "tokenPrice": 1.12357820, - "gasCost": 0.0891, - "gasUsdValue": 0.1 - }, - "success": true -} -``` - -- gasCost: Estimated withdrawal fee in token units - -# 4. withdraw signature - -* when you withdraw, you should supply a EIP712 signature. You can get the signature by signing the following message with your wallet. - -### EIP712 Domain - -```json -{ - "name": "APX", - "version": "1", - "chainId": 56, - "verifyingContract": "0xcEF2dD45Da08b37fB1c2f441d33c2eBb424866A4" -} -``` - -|field| desc | -|---|-------------------------------| -|name| fix string 'Aster' | -|version| fix string '1' | -|chainId| the chainId of withdraw chain | -|verifyingContract| contract address, see below | - -### EIP712 Types - -```json -{ - "Action": [ - {"name": "type", "type": "string"}, - {"name": "destination", "type": "address"}, - {"name": "destination Chain", "type": "string"}, - {"name": "token", "type": "string"}, - {"name": "amount", "type": "string"}, - {"name": "fee", "type": "string"}, - {"name": "nonce", "type": "uint256"} - ] -} -``` - -|field | desc | -|---------------|-------------------------------------------------------------------------------------------------------| -|type | fix string 'Withdraw' | -|destination | the receipt address, should be user's register address | -|destination Chain | the chain name of receipt address, you can see the defination of chainName below | -|token| the name of the currency user withdraw, e.g. ASTER, you can get the name from withdraw/asset API | -|amount | the amount user withdraw in token unit, eg. '1.23' | -|fee| the fee user will pay in token unit, eg. '0.01' (you can get the fee from withdraw/estimate-withdraw-fee API) | -|nonce| a unique number, use the current timestamp in milliseconds and multiply '1000' | - -### chainName definition - -|chainId| chainName | contractAddress | -|---|-----------|-----------------| -|56| BSC | 0xcEF2dD45Da08b37fB1c2f441d33c2eBb424866A4 | -|42161| Arbitrum | 0xBAd4ccc91EF0dfFfbCAb1402C519601fbAf244EF | -|1| ETH | 0xb40EEd68d7d6B3b6d6f4E93DE6239B7C53EFc786 | -|8453|Base| 0x11db0BEb34766277a1d7CAc7590b3Cf4BBf5E4eB | -|324|zkSync| 0xD6f4e33063C881cE9a98e07E13673B92a637D908 | -|169|Manta| 0xBAd4ccc91EF0dfFfbCAb1402C519601fbAf244EF | - -# 5. withdraw - -### request: - -```shell -curl -X POST "https://www.asterdex.com/bapi/futures/v1/private/future/apx/user-withdraw" -H "accept: */*" -H "x-gray-env: normal" -H "x-trace-id: fa2a5961b4a346e083f2bb0bffe39e2f" -H "Content-Type: application/json" \ --d "{ \"accountType\": \"spot\", \"amount\": \"10.2\", \"chainId\": 97, \"currency\": \"USDT\", \"fee\": \"0.01\", \"nonce\": \"1761029928213000\", \"receiver\": \"0x4C5EdB66CC7626a1C92d5178c3E5c45409BcE6D7\", \"userSignature\": \"0xc0299efe235ec194d070163b1f92ebf5d01bd820c1c08fa9730929c7a36172a9001b99203b2f9997aa7d41b7658348704e0515f4c40e76f1892f7a5b0af31daa1c\"}" -``` - -### params: -|param | type | required | description | -|--------------|--------|----------|-----------------------------------------------------------| -| accountType | string | true | Account type, e.g., spot, perp | -| amount | string | true | Withdraw amount in token unit | -| chainId | int | true | Chain ID | -| currency | string | true | Currency name, e.g., ASTER | -| fee | string | true | Withdraw fee in token unit | -| nonce | string | true | Unique number, should be the save in signature | -| receiver | string | true | Withdraw receipt address, should be the save in signature | -| userSignature | string | true | EIP712 signature | - -### response: - -```json -{ - "code": "200", - "message": "success", - "messageDetail": null, - "data": { - "withdrawId": "1234567", - "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" - }, - "success": true -} -``` - -|field | desc | -|-----------|--------------------------------------| -|withdrawId | the withdraw request id, a unique id | -|hash | the digest of user's signature | - -# 6. withdraw by API [futures] - -### request: - -```shell -curl --location --request POST 'https://fapi.asterdex.com/fapi/apx/user-withdraw?chainId=56&asset=USDT&amount=31&fee=0.3&receiver=0xcEF2dD45Da08b37fB1c2f441d33c2eBb424866A4&nonce=1761210000000000&userSignature=0xde4ca529eef20db136eed1daf1d072083431d5279e6d6e219600cf57161c5e6d1232af3c8a8ef37ba8b5963f439ef9cc2b475fe18dcc3732dda9fb93c94a3abd1c&recvWindow=60000×tamp=1761230958410&signature=f5fd60da19be213d58914dd6f46bc400ada617fb916998dfc01dd346bfdad512' \ ---header 'Content-Type: application/json' \ ---header 'X-MBX-APIKEY: Your API KEY' -``` - -### params: -| param | type | required | description | -|---------------|--------|----------|-----------------------------------------------------------| -| amount | string | true | Withdraw amount in token unit | -| chainId | int | true | Chain ID | -| asset | string | true | Currency name, e.g., ASTER | -| fee | string | true | Withdraw fee in token unit | -| nonce | string | true | Unique number, should be the save in signature | -| receiver | string | true | Withdraw receipt address, should be the save in signature | -| userSignature | string | true | EIP712 signature | - -### response: - -```json -{ - "code": "200", - "message": "success", - "messageDetail": null, - "data": { - "withdrawId": "1234567", - "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" - }, - "success": true -} -``` - -|field | desc | -|-----------|--------------------------------------| -|withdrawId | the withdraw request id, a unique id | -|hash | the digest of user's signature | From b95cd871b741d98b5116f6e736e4aec64bd9417a Mon Sep 17 00:00:00 2001 From: aodyc Date: Tue, 28 Oct 2025 21:27:41 +0800 Subject: [PATCH 05/11] add api-key docs --- README.md | 4 ++ aster-api-key-registration.md | 92 +++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 aster-api-key-registration.md diff --git a/README.md b/README.md index bfb4638..b6b0d3f 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ [Aster Finance Spot Asset Consolidation](./consolidation.js) +# Aster Api Key + +[Aster Api Key](./aster-api-key-registration.md) + # Aster 现货资产归集脚本示例 [Aster 现货资产归集脚本示例](./consolidation.js) diff --git a/aster-api-key-registration.md b/aster-api-key-registration.md new file mode 100644 index 0000000..ca0b3e3 --- /dev/null +++ b/aster-api-key-registration.md @@ -0,0 +1,92 @@ +# 1. get nonce + +### request: + +```shell +curl --location 'https://www.asterdex.com/bapi/futures/v1/public/future/web3/get-nonce' \ +--header 'Content-Type: application/json' \ +--data '{ +"sourceAddr" : "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", +"type": "CREATE_API_KEY" +} +``` + +### response: +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": { + "nonce": "501182" + }, + "success": true +} +``` + +# 2. sign message + +### message: + +```text +You are signing into Aster DEX 501182 +``` + +### result: + +```text +0xa4ee6b068060caeac447216b592a918b085642056248e6ff50ba22b50e8884875ead28f06cbcefcbb93d03997f807fd242354d878756f4690f791ae8dbfcde841c +``` + +# 3. create api-key + +### request: + +```shell +curl --location 'https://www.asterdex.com/bapi/futures/v1/public/future/web3/broker-create-api-key' \ +--header 'accept: */*' \ +--header 'Content-Type: application/json' \ +--data '{ +"desc": "test description", +"ip": "", +"network": "56", +"signature": "0xa4ee6b068060caeac447216b592a918b085642056248e6ff50ba22b50e8884875ead28f06cbcefcbb93d03997f807fd242354d878756f4690f791ae8dbfcde841c", +"sourceAddr": "0xE90F9596e3Bfd49e9f4c2E0eA48830DC47e6997b", +"type": "CREATE_API_KEY", +"sourceCode": "broker" +}' +``` + +### params: + +|param | type | required | description | +|------|------|----------|-------------------------------------------| +| desc | string | yes | api-key's description, should unique | +| ip | string | no | whitelist ip addresses, separated by ',' | +| network | string | yes | blockchain network, e.g. '56' for BSC | +| signature | string | yes | signature from previous step | +| sourceAddr | string | yes | the address used to sign the message | +| type | string | yes | fixed value "CREATE_API_KEY" | +| sourceCode | string | no | "ae" for aster and other value for broker | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": { + "apiKey": "4a2e11b243b1ad75981edf359ae02e873bf88b699196170d998d8266f5eb9f32", + "apiSecret": "72911505f67b24a8efe8f246d06c324b787d2f3f7cb8b5b80ef1698ee1486e25", + "keyId": 0, + "apiName": null + }, + "success": true +} +``` + +### note: + +1. Please keep a record of the returned apiKey and apiSecret. If you lose them, you cannot retrieve them and can only create them again. +2. api-key can't be deleted by user now. \ No newline at end of file From d5b1a2af002ac4b1e4c709f054e6befd54e7760f Mon Sep 17 00:00:00 2001 From: aodyc Date: Wed, 29 Oct 2025 10:06:41 +0800 Subject: [PATCH 06/11] add login docks --- aster-api-key-registration.md | 43 +++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/aster-api-key-registration.md b/aster-api-key-registration.md index ca0b3e3..c01adb6 100644 --- a/aster-api-key-registration.md +++ b/aster-api-key-registration.md @@ -29,7 +29,7 @@ curl --location 'https://www.asterdex.com/bapi/futures/v1/public/future/web3/get ### message: ```text -You are signing into Aster DEX 501182 +You are signing into Astherus 501182 ``` ### result: @@ -38,7 +38,46 @@ You are signing into Aster DEX 501182 0xa4ee6b068060caeac447216b592a918b085642056248e6ff50ba22b50e8884875ead28f06cbcefcbb93d03997f807fd242354d878756f4690f791ae8dbfcde841c ``` -# 3. create api-key +# 3. login + +### request: +```shell +curl -XPOST 'https://www.asterdex.com/bapi/futures/v1/public/future/web3/ae/login' \ + + -H 'content-type: application/json' \ + --data-raw '{ + "signature":"0xafb84ca3bd36131970636a298677be2e1de4ed81b11101e417272d23f0b7f9af174efdf954ae7a63e844c83d16a4ad391e801c6766a422e647832b5c0c8aa1591c", + "sourceAddr":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "chainId":56, + "agentCode": "56789" + }' +``` + +### params: + +| param | type | required | description | +|-------------|------|----------|----------------------------------------| +| signature | string | yes | signature from previous step | +| sourceAddr | string | yes | the address used to sign the message | +| chainId | int | yes | blockchain network id, e.g. 56 for BSC | +| agentCode | string | no | referral code | + +### response: + +```json +{ + "code": "000000", + "message": null, + "messageDetail": null, + "data": { + "token": "D5M8792356G7H8J9K0L1N2B3V4C5X6Z7D5621", + "uid": 12345678 + }, + "success": true +} +``` + +# 4. create api-key ### request: From 552b0552a7e0668d63fa9a8a0fc62c787d764b77 Mon Sep 17 00:00:00 2001 From: "ivan.z-apx" Date: Thu, 30 Oct 2025 10:54:03 +0800 Subject: [PATCH 07/11] add api create apikey demo --- demo/create-apikey-for-others.js | 131 +++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 demo/create-apikey-for-others.js diff --git a/demo/create-apikey-for-others.js b/demo/create-apikey-for-others.js new file mode 100644 index 0000000..6f836dc --- /dev/null +++ b/demo/create-apikey-for-others.js @@ -0,0 +1,131 @@ +const ethers = require('ethers'); +const crypto = require('crypto'); +const axios = require('axios'); + + +//需要生成apikey的账户信息 +const new_address_config = [ + { + private_key: "*", + address: '*', + }, + { + private_key: "*", + address: '*', + } +] + +//主账户的地址 apikey api_secret +const api_key = '*' +const api_secret = '*' + + +//下面的参数无需修改 +const host = 'https://sapi.asterdex.com' + +var new_address_apikey = '' +var new_address_apiSecret = '' +var use_new_apikey = false + +const spot_get_nonce = { 'url': '/api/v1/getNonce', 'method': 'POST', 'params': { 'userOperationType': 'CREATE_API_KEY' } } +const spot_create_apikey = { 'url': '/api/v1/createApiKey', 'method': 'POST', 'params': { 'userOperationType': 'CREATE_API_KEY' } } + +async function getUrl(my_dict) { + content = '' + for (let key in my_dict) { + content = content + key + '=' + my_dict[key] + '&' + } + content += 'recvWindow=5000×tamp=' + Date.now() + + return content + +} + +async function sign_v1(secretKey, message) { + const hmac = crypto.createHmac('sha256', secretKey) + .update(message) + .digest('hex'); + return hmac +} + +async function sendRequest(url, method) { + headers = {} + key = api_key + if (use_new_apikey == true) { + key = new_address_apikey + } + if (method == 'POST') { + headers = { + 'Content-Type': 'application/x-www-form-urlencoded', + 'X-MBX-APIKEY': key, + 'User-Agent': 'Node.js HTTP Client' + } + } + try { + const response = await axios({ + method: method, + url: url, + headers: headers + + }); + + return response.data; + } catch (error) { + console.error('Error:', error.response?.data || error.message); + } + + return '' +} + +async function send_v1(path, method, my_dict) { + content = await getUrl(my_dict) + secret = api_secret + if (use_new_apikey == true) { + secret = new_address_apiSecret + } + signature = await sign_v1(secret, content) + path = path + '?' + content + '&signature=' + signature + return await sendRequest(host + path, method) +} + + +async function send(config, addParams) { + path = config['url'] + method = config['method'] + my_dict = { ...config['params'], ...addParams } + return await send_v1(path, method, my_dict) +} + +async function sign(private_key, message) { + wallet = new ethers.Wallet(private_key); + const signature = await wallet.signMessage(message); + return signature +} + +async function main() { + i = 0 + for (const config of new_address_config) { + console.log('开始为账户创建apikey:', config.address); + //获取创建apikey的nonce + let nonce = await send(spot_get_nonce, {'address': config.address}) + + //给新地址创建api_key api_secret + message = 'You are signing into Astherus ${nonce}'.replace('${nonce}', nonce) + userSignature = await sign(config.private_key,message) + + //创建apikey时的描述信息 注意同一账户的desc不能重复 + var key_desc = Date.now() +'_' + i + i = i + 1 + let new_api = await send(spot_create_apikey, { 'userSignature': userSignature,'address': config.address,'desc': key_desc }) + new_address_apikey = new_api['apiKey'] + new_address_apiSecret = new_api['apiSecret'] + + console.log('new address: ',config.address) + console.log('new_address_apikey:', new_address_apikey) + console.log('new_address_apiSecret:', new_address_apiSecret) + } +} + + +main() + From e0633c1368056495bc42df8cf8f883026fd915b5 Mon Sep 17 00:00:00 2001 From: "ivan.z-apx" Date: Thu, 30 Oct 2025 19:55:09 +0800 Subject: [PATCH 08/11] api key create front and ae logi --- demo/create-apikey-front.js | 87 +++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 demo/create-apikey-front.js diff --git a/demo/create-apikey-front.js b/demo/create-apikey-front.js new file mode 100644 index 0000000..4cd980c --- /dev/null +++ b/demo/create-apikey-front.js @@ -0,0 +1,87 @@ +const ethers = require('ethers'); +const crypto = require('crypto'); +const axios = require('axios'); + +const { Wallet } = require('ethers'); + +//下面的参数无需修改 +const host = 'https://www.asterdex.com/bapi/futures/v1' +const get_nonce = { 'url': '/public/future/web3/get-nonce', 'method': 'POST', 'params': { } } +const create_apikey = { 'url': '/public/future/web3/broker-create-api-key', 'method': 'POST', 'params': { 'network': '56','type':'CREATE_API_KEY','sourceCode':'ae','ip':'' } } +const ae_login = { 'url': '/public/future/web3/ae/login', 'method': 'POST', 'params': { 'chainId': '56' } } + +async function sendRequest(url, method,body) { + headers = {} + url = host+url + console.log(url) + console.log(body) + if (method == 'POST') { + headers = { + 'Content-Type': 'application/json', + 'clientType':'web' + } + } + try { + const response = await axios({ + method: method, + data: body, + url: url, + headers: headers + + }); + + return response.data; + } catch (error) { + console.error('Error:', error.response?.data || error.message); + } + + return '' +} + + +async function send(config, addParams) { + path = config['url'] + method = config['method'] + my_dict = { ...config['params'], ...addParams } + return await sendRequest(path, method, my_dict) +} + +async function sign(private_key, message) { + wallet = new ethers.Wallet(private_key); + const signature = await wallet.signMessage(message); + return signature +} + +async function main() { + const wallet = Wallet.createRandom(); + + console.log("Address:", wallet.address); + console.log("Private Key:", wallet.privateKey); + + let nonce_res = await send(get_nonce, {'type':'CREATE_API_KEY','sourceAddr':wallet.address}) + let nonce = nonce_res['data']['nonce'] + console.log(nonce) + //给新地址创建api_key api_secret + message = 'You are signing into Astherus ${nonce}'.replace('${nonce}', nonce) + user_signature = await sign( wallet.privateKey,message) + console.log(user_signature) + let create_api_key_res = await send(create_apikey, {'signature':user_signature,'desc':'12','sourceAddr':wallet.address}) + console.log(create_api_key_res) + + + let login_nonce_res = await send(get_nonce, {'type':'LOGIN','sourceAddr':wallet.address}) + nonce = login_nonce_res['data']['nonce'] + console.log(nonce) + //地址登陆 header必传 'clientType':'web' + message = 'You are signing into Astherus ${nonce}'.replace('${nonce}', nonce) + user_signature = await sign( wallet.privateKey,message) + console.log(user_signature) + let ae_login_res = await send(ae_login, {'signature':user_signature,'sourceAddr':wallet.address}) + console.log(ae_login_res) + +} + +main() + + + From d86c3454a3a8b56ba082f13a243960d60c857c0b Mon Sep 17 00:00:00 2001 From: "ivan.z-apx" Date: Fri, 31 Oct 2025 09:31:59 +0800 Subject: [PATCH 09/11] login first --- demo/create-apikey-front.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/demo/create-apikey-front.js b/demo/create-apikey-front.js index 4cd980c..487b11d 100644 --- a/demo/create-apikey-front.js +++ b/demo/create-apikey-front.js @@ -13,8 +13,6 @@ const ae_login = { 'url': '/public/future/web3/ae/login', 'method': 'POST', 'par async function sendRequest(url, method,body) { headers = {} url = host+url - console.log(url) - console.log(body) if (method == 'POST') { headers = { 'Content-Type': 'application/json', @@ -58,26 +56,25 @@ async function main() { console.log("Address:", wallet.address); console.log("Private Key:", wallet.privateKey); - let nonce_res = await send(get_nonce, {'type':'CREATE_API_KEY','sourceAddr':wallet.address}) - let nonce = nonce_res['data']['nonce'] + let login_nonce_res = await send(get_nonce, {'type':'LOGIN','sourceAddr':wallet.address}) + let nonce = login_nonce_res['data']['nonce'] console.log(nonce) - //给新地址创建api_key api_secret - message = 'You are signing into Astherus ${nonce}'.replace('${nonce}', nonce) - user_signature = await sign( wallet.privateKey,message) + //地址登陆 header必传 'clientType':'web' + let message = 'You are signing into Astherus ${nonce}'.replace('${nonce}', nonce) + let user_signature = await sign( wallet.privateKey,message) console.log(user_signature) - let create_api_key_res = await send(create_apikey, {'signature':user_signature,'desc':'12','sourceAddr':wallet.address}) - console.log(create_api_key_res) - + let ae_login_res = await send(ae_login, {'signature':user_signature,'sourceAddr':wallet.address,'agentCode':'69Ae1D'}) + console.log(ae_login_res) - let login_nonce_res = await send(get_nonce, {'type':'LOGIN','sourceAddr':wallet.address}) - nonce = login_nonce_res['data']['nonce'] + let apikey_nonce_res = await send(get_nonce, {'type':'CREATE_API_KEY','sourceAddr':wallet.address}) + nonce = apikey_nonce_res['data']['nonce'] console.log(nonce) - //地址登陆 header必传 'clientType':'web' + //给新地址创建api_key api_secret message = 'You are signing into Astherus ${nonce}'.replace('${nonce}', nonce) user_signature = await sign( wallet.privateKey,message) console.log(user_signature) - let ae_login_res = await send(ae_login, {'signature':user_signature,'sourceAddr':wallet.address}) - console.log(ae_login_res) + let create_api_key_res = await send(create_apikey, {'signature':user_signature,'desc':'12','sourceAddr':wallet.address}) + console.log(create_api_key_res) } From 5a208b60e93bb44b7ac58f9ce3f815575a179095 Mon Sep 17 00:00:00 2001 From: "ivan.z-apx" Date: Fri, 31 Oct 2025 09:34:22 +0800 Subject: [PATCH 10/11] v1->v3 --- aster-finance-futures-api-v3.md | 90 ++++++++++++++++----------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/aster-finance-futures-api-v3.md b/aster-finance-futures-api-v3.md index 98ef163..d1e49c1 100644 --- a/aster-finance-futures-api-v3.md +++ b/aster-finance-futures-api-v3.md @@ -857,7 +857,7 @@ Since `MARKET` orders have no price, the mark price is used. {} ``` -``GET /fapi/v1/ping`` +``GET /fapi/v3/ping`` Test connectivity to the Rest API. @@ -877,7 +877,7 @@ NONE } ``` -``GET /fapi/v1/time`` +``GET /fapi/v3/time`` Test connectivity to the Rest API and get the current server time. @@ -908,7 +908,7 @@ NONE "rateLimitType": "ORDERS" } ], - "serverTime": 1565613908500, // Ignore please. If you want to check current server time, please check via "GET /fapi/v1/time" + "serverTime": 1565613908500, // Ignore please. If you want to check current server time, please check via "GET /fapi/v3/time" "assets": [ // assets information { "asset": "BUSD", @@ -1008,7 +1008,7 @@ NONE } ``` -``GET /fapi/v1/exchangeInfo`` +``GET /fapi/v3/exchangeInfo`` Current exchange trading rules and symbol information @@ -1042,7 +1042,7 @@ NONE } ``` -``GET /fapi/v1/depth`` +``GET /fapi/v3/depth`` **Weight:** @@ -1079,7 +1079,7 @@ Adjusted based on the limit: ] ``` -``GET /fapi/v1/trades`` +``GET /fapi/v3/trades`` Get recent market trades @@ -1112,7 +1112,7 @@ Get recent market trades ] ``` -``GET /fapi/v1/historicalTrades`` +``GET /fapi/v3/historicalTrades`` Get older market historical trades. @@ -1147,7 +1147,7 @@ Get older market historical trades. ] ``` -``GET /fapi/v1/aggTrades`` +``GET /fapi/v3/aggTrades`` Get compressed, aggregate market trades. Market trades that fill at the time, from the same order, with the same price will have the quantity aggregated. @@ -1191,7 +1191,7 @@ Get compressed, aggregate market trades. Market trades that fill at the time, fr ] ``` -``GET /fapi/v1/klines`` +``GET /fapi/v3/klines`` Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time. @@ -1241,7 +1241,7 @@ Klines are uniquely identified by their open time. ] ``` -``GET /fapi/v1/indexPriceKlines`` +``GET /fapi/v3/indexPriceKlines`` Kline/candlestick bars for the index price of a pair. @@ -1292,7 +1292,7 @@ Klines are uniquely identified by their open time. ] ``` -``GET /fapi/v1/markPriceKlines`` +``GET /fapi/v3/markPriceKlines`` Kline/candlestick bars for the mark price of a symbol. @@ -1354,7 +1354,7 @@ Klines are uniquely identified by their open time. ] ``` -``GET /fapi/v1/premiumIndex`` +``GET /fapi/v3/premiumIndex`` Mark Price and Funding Rate @@ -1386,7 +1386,7 @@ Mark Price and Funding Rate ] ``` -``GET /fapi/v1/fundingRate`` +``GET /fapi/v3/fundingRate`` **Weight:** 1 @@ -1456,7 +1456,7 @@ Mark Price and Funding Rate ] ``` -``GET /fapi/v1/ticker/24hr`` +``GET /fapi/v3/ticker/24hr`` 24 hour rolling window price change statistics. **Careful** when accessing this with no symbol. @@ -1497,7 +1497,7 @@ Mark Price and Funding Rate ] ``` -``GET /fapi/v1/ticker/price`` +``GET /fapi/v3/ticker/price`` Latest price for a symbol or symbols. @@ -1543,7 +1543,7 @@ Latest price for a symbol or symbols. ] ``` -``GET /fapi/v1/ticker/bookTicker`` +``GET /fapi/v3/ticker/bookTicker`` Best price/qty on the order book for a symbol or symbols. @@ -2181,7 +2181,7 @@ Bids and asks, pushed every 250 milliseconds, 500 milliseconds, 100 milliseconds 1. Open a stream to **wss://fstream.asterdex.com/stream?streams=btcusdt@depth**. 2. Buffer the events you receive from the stream. For same price, latest received update covers the previous one. -3. Get a depth snapshot from **https://fapi.asterdex.com/fapi/v1/depth?symbol=BTCUSDT&limit=1000** . +3. Get a depth snapshot from **https://fapi.asterdex.com/fapi/v3/depth?symbol=BTCUSDT&limit=1000** . 4. Drop any event where `u` is < `lastUpdateId` in the snapshot. 5. The first processed event should have `U` <= `lastUpdateId` **AND** `u` >= `lastUpdateId` 6. While listening to the stream, each new event's `pu` should be equal to the previous event's `u`, otherwise initialize the process from step 3. @@ -2206,7 +2206,7 @@ Considering the possible data latency from RESTful endpoints during an extremely } ``` -``POST /fapi/v1/positionSide/dual (HMAC SHA256)`` +``POST /fapi/v3/positionSide/dual (HMAC SHA256)`` Change user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol*** @@ -2231,7 +2231,7 @@ Change user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol*** } ``` -``GET /fapi/v1/positionSide/dual (HMAC SHA256)`` +``GET /fapi/v3/positionSide/dual (HMAC SHA256)`` Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol*** @@ -2256,7 +2256,7 @@ Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol*** } ``` -``POST /fapi/v1/multiAssetsMargin (HMAC SHA256)`` +``POST /fapi/v3/multiAssetsMargin (HMAC SHA256)`` Change user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on ***Every symbol*** @@ -2281,7 +2281,7 @@ Change user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on ***E } ``` -``GET /fapi/v1/multiAssetsMargin (HMAC SHA256)`` +``GET /fapi/v3/multiAssetsMargin (HMAC SHA256)`` Get user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on ***Every symbol*** @@ -2327,7 +2327,7 @@ Get user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on ***Ever } ``` -``POST /fapi/v1/order (HMAC SHA256)`` +``POST /fapi/v3/order (HMAC SHA256)`` Send in a new order. @@ -2374,7 +2374,7 @@ Additional mandatory parameters based on `type`: * If parameter`priceProtect`is sent as true: * when price reaches the `stopPrice` ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol - * "triggerProtect" of a symbol can be got from `GET /fapi/v1/exchangeInfo` + * "triggerProtect" of a symbol can be got from `GET /fapi/v3/exchangeInfo` * `STOP`, `STOP_MARKET`: * BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= `stopPrice` @@ -2440,7 +2440,7 @@ Additional mandatory parameters based on `type`: ] ``` -``POST /fapi/v1/batchOrders (HMAC SHA256)`` +``POST /fapi/v3/batchOrders (HMAC SHA256)`` **Weight:** 5 @@ -2545,7 +2545,7 @@ Notes: } ``` -``GET /fapi/v1/order (HMAC SHA256)`` +``GET /fapi/v3/order (HMAC SHA256)`` Check an order's status. @@ -2602,7 +2602,7 @@ Notes: } ``` -``DELETE /fapi/v1/order (HMAC SHA256)`` +``DELETE /fapi/v3/order (HMAC SHA256)`` Cancel an active order. @@ -2632,7 +2632,7 @@ Either `orderId` or `origClientOrderId` must be sent. } ``` -``DELETE /fapi/v1/allOpenOrders (HMAC SHA256)`` +``DELETE /fapi/v3/allOpenOrders (HMAC SHA256)`` **Weight:** 1 @@ -2682,7 +2682,7 @@ Either `orderId` or `origClientOrderId` must be sent. ] ``` -``DELETE /fapi/v1/batchOrders (HMAC SHA256)`` +``DELETE /fapi/v3/batchOrders (HMAC SHA256)`` **Weight:** 1 @@ -2712,7 +2712,7 @@ Either `orderIdList` or `origClientOrderIdList ` must be sent. Cancel all open orders of the specified symbol at the end of the specified countdown. -``POST /fapi/v1/countdownCancelAll (HMAC SHA256)`` +``POST /fapi/v3/countdownCancelAll (HMAC SHA256)`` **Weight:** 10 @@ -2765,7 +2765,7 @@ Cancel all open orders of the specified symbol at the end of the specified count } ``` -``GET /fapi/v1/openOrder (HMAC SHA256)`` +``GET /fapi/v3/openOrder (HMAC SHA256)`` **Weight:** 1 @@ -2816,7 +2816,7 @@ Cancel all open orders of the specified symbol at the end of the specified count ] ``` -``GET /fapi/v1/openOrders (HMAC SHA256)`` +``GET /fapi/v3/openOrders (HMAC SHA256)`` Get all open orders on a symbol. **Careful** when accessing this with no symbol. @@ -2867,7 +2867,7 @@ Get all open orders on a symbol. **Careful** when accessing this with no symbol. ] ``` -``GET /fapi/v1/allOrders (HMAC SHA256)`` +``GET /fapi/v3/allOrders (HMAC SHA256)`` Get all account orders; active, canceled, or filled. @@ -3032,7 +3032,7 @@ Get current account information. } ``` -``POST /fapi/v1/leverage (HMAC SHA256)`` +``POST /fapi/v3/leverage (HMAC SHA256)`` Change user's initial leverage of specific symbol market. @@ -3059,7 +3059,7 @@ Change user's initial leverage of specific symbol market. } ``` -``POST /fapi/v1/marginType (HMAC SHA256)`` +``POST /fapi/v3/marginType (HMAC SHA256)`` **Weight:** 1 @@ -3086,7 +3086,7 @@ Change user's initial leverage of specific symbol market. } ``` -``POST /fapi/v1/positionMargin (HMAC SHA256)`` +``POST /fapi/v3/positionMargin (HMAC SHA256)`` **Weight:** 1 @@ -3129,7 +3129,7 @@ Change user's initial leverage of specific symbol market. ] ``` -``GET /fapi/v1/positionMargin/history (HMAC SHA256)`` +``GET /fapi/v3/positionMargin/history (HMAC SHA256)`` **Weight:** 1 @@ -3252,7 +3252,7 @@ Please use with user data stream `ACCOUNT_UPDATE` to meet your timeliness and ac ] ``` -``GET /fapi/v1/userTrades (HMAC SHA256)`` +``GET /fapi/v3/userTrades (HMAC SHA256)`` Get trades for a specific account and symbol. @@ -3304,7 +3304,7 @@ Get trades for a specific account and symbol. ] ``` -``GET /fapi/v1/income (HMAC SHA256)`` +``GET /fapi/v3/income (HMAC SHA256)`` **Weight:** 30 @@ -3366,7 +3366,7 @@ Get trades for a specific account and symbol. } ``` -``GET /fapi/v1/leverageBracket`` +``GET /fapi/v3/leverageBracket`` **Weight:** 1 @@ -3407,7 +3407,7 @@ Get trades for a specific account and symbol. ] ``` -``GET /fapi/v1/adlQuantile`` +``GET /fapi/v3/adlQuantile`` **Weight:** 5 @@ -3480,7 +3480,7 @@ Get trades for a specific account and symbol. ] ``` -``GET /fapi/v1/forceOrders`` +``GET /fapi/v3/forceOrders`` **Weight:** 20 with symbol, 50 without symbol @@ -3511,7 +3511,7 @@ Get trades for a specific account and symbol. } ``` -``GET /fapi/v1/commissionRate (HMAC SHA256)`` +``GET /fapi/v3/commissionRate (HMAC SHA256)`` **Weight:** 20 @@ -3546,7 +3546,7 @@ Get trades for a specific account and symbol. } ``` -``POST /fapi/v1/listenKey`` +``POST /fapi/v3/listenKey`` Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes. @@ -3565,7 +3565,7 @@ None {} ``` -``PUT /fapi/v1/listenKey`` +``PUT /fapi/v3/listenKey`` Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes. @@ -3584,7 +3584,7 @@ None {} ``` -``DELETE /fapi/v1/listenKey`` +``DELETE /fapi/v3/listenKey`` Close out a user data stream. From 5bd7cc6cd6bb50b2a5b294b1a2ed261e99ab59d8 Mon Sep 17 00:00:00 2001 From: aodyc Date: Fri, 7 Nov 2025 17:37:41 +0800 Subject: [PATCH 11/11] add solana withdraw api --- aster-deposit-withdrawal.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/aster-deposit-withdrawal.md b/aster-deposit-withdrawal.md index e69ef7c..e104b60 100644 --- a/aster-deposit-withdrawal.md +++ b/aster-deposit-withdrawal.md @@ -318,4 +318,39 @@ curl --location --request POST 'https://sapi.asterdex.com/api/v1/aster/user-with |field | desc | |-----------|--------------------------------------| |withdrawId | the withdraw request id, a unique id | -|hash | the digest of user's signature | \ No newline at end of file +|hash | the digest of user's signature | + +# 8. withdraw by API [futures] + +### request: + +```shell +curl --location --request POST 'https://fapi.asterdex.com/fapi/aster/user-solana-withdraw?chainId=101&asset=USDT&amount=3&fee=0.6&receiver=4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf&recvWindow=60000×tamp=1762440135477&signature=a773a7e83c2fe4581eb2dc0500000faa3138173ba6262316c0d83b3498dea319' \ +--header 'Content-Type: application/json' \ +--header 'X-MBX-APIKEY: Your API KEY' +``` + +### params: +| param | type | required | description | +|---------------|--------|----------|-----------------------------------------------------------| +| amount | string | true | Withdraw amount in token unit | +| chainId | int | true | fix value 101 | +| asset | string | true | Currency name, e.g., USDT | +| fee | string | true | Withdraw fee in token unit | +| receiver | string | true | Withdraw receipt address, should be the save in signature | + +### response: + +```json +{ + "code": "200", + "message": "success", + "messageDetail": null, + "data": { + "withdrawId": "1234567", + "hash": "0x9a40f0119b670fb6b155744b51981f91c4c4c8a20c333441a63853fe7d055c90" + }, + "success": true +} +``` +- hash is not the transaction hash, just a unique value \ No newline at end of file