edgeX 백서

edgeX

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 22쪽 중 14쪽

terIsPositionTpslList | array\[boolean] | No | Filter by position TP/SL orders. If empty, fetches all orders. | | filterStartCreatedTimeInclusive | string(int64) | No | Filter orders created after this time (inclusive). If 0 or empty, from earliest. | | filterEndCreatedTimeExclusive | string(int64) | No | Filter orders created before this time (exclusive). If 0 or empty, to latest. | > Response Example > 200 Response ```json { "code": "SUCCESS", "data": { "dataList": [ { "id": "564815695875932430", "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "contractId": "10000001", "side": "BUY", "price": "97444.5", "size": "0.001", "clientOrderId": "553364074986685", "type": "LIMIT", "status": "OPEN", "createdTime": "1734662555665", "updatedTime": "1734662555672" } ], "nextPageOffsetData": "" }, "msg": null, "errorParam": null, "requestTime": "1734662566830", "responseTime": "1734662566836", "traceId": "4a97b2e8da4933980f399581dd4a1264" } ``` ### Response Parameters | Name | Type | Description | | -------------------- | ----------------- | ------------------------------------------------------ | | code | string | Status code. "SUCCESS" for success, otherwise failure. | | data | object | Response data | | » dataList | array\[object] | Array of order objects | | » nextPageOffsetData | string | Offset for next page. Empty string if no more data. | | msg | string | Message | | errorParam | object | Error parameters | | requestTime | string(timestamp) | Server request receive time | | responseTime | string(timestamp) | Server response return time | | traceId | string | Call trace ID | ## GET Get Historical Orders (Paginated) GET /api/v2/private/order/getHistoryOrderPage Retrieves historical orders with pagination and filtering. ### Request Parameters | Name | Type | Required | Description | | ------------------------------- | --------------- | -------- | -------------------------------------------------------------------------------- | | accountId | string(int64) | Yes | Account ID | | size | integer | No | Number of items to fetch. Must be > 0 and <= 100. Default: 100 | | offsetData | string | No | Pagination offset. If empty, retrieves the first page. | | filterCoinIdList | array\[string] | No | Filter by collateral coin IDs. If empty, fetches for all coins. | | filterContractIdList | array\[string] | No | Filter by contract IDs. If empty, fetches for all contracts. | | filterTypeList | array\[string] | No | Filter by order types. If empty, fetches all types. | | filterStatusList | array\[string] | No | Filter by order status. If empty, fetches all statuses. | | filterIsLiquidateList | array\[boolean] | No | Filter by liquidation orders. If empty, fetches all orders. | | filterIsDeleverageList | array\[boolean] | No | Filter by deleverage orders. If empty, fetches all orders. | | filterIsPositionTpslList | array\[boolean] | No | Filter by position TP/SL orders. If empty, fetches all orders. | | filterStartCreatedTimeInclusive | string(int64) | No | Filter orders created after this time (inclusive). If 0 or empty, from earliest. | | filterEndCreatedTimeExclusive | string(int64) | No | Filter orders created before this time (exclusive). If 0 or empty, to latest. | | filterOrderIdList | array\[string] | No | Filter by specific order IDs. If empty, fetches all orders. | > Response Example > 200 Response ```json { "code": "SUCCESS", "data": { "dataList": [ { "id": "564815695875932430", "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "contractId": "10000001", "side": "BUY", "price": "97444.5", "size": "0.001", "clientOrderId": "553364074986685", "type": "LIMIT", "status": "FILLED", "cumFillSize": "0.001", "cumFillValue": "97.4445", "cumFillFee": "0.017540", "createdTime": "1734662555665", "updatedTime": "1734662617992" } ], "nextPageOffsetData": "" }, "msg": null, "errorParam": null, "requestTime": "1734662697584", "responseTime": "1734662697601", "traceId": "1cd03694d7da308cb13603f34b0836e6" } ``` ### Response Parameters | Name | Type | Description | | -------------------- | ----------------- | ------------------------------------------------------ | | code | string | Status code. "SUCCESS" for success, otherwise failure. | | data | object | Response data | | » dataList | array\[object] | Array of order objects | | » nextPageOffsetData | string | Offset for next page. Empty string if no more data. | | msg | string | Message | | errorParam | object | Error parameters | | requestTime | string(timestamp) | Server request receive time | | responseTime | string(timestamp) | Server response return time | | traceId | string | Call trace ID | ## GET Get Historical Order Fill Transactions (Paginated) GET /api/v2/private/order/getHistoryOrderFillTransactionPage Retrieves historical order fill transactions with pagination and filtering. ### Request Parameters | Name | Type | Required | Description | | ------------------------------- | --------------- | -------- | -------------------------------------------------------------------------------------- | | accountId | string(int64) | Yes | Account ID | | size | integer | No | Number of items to fetch. Must be > 0 and <= 100. Default: 100 | | offsetData | string | No | Pagination offset. If empty, retrieves the first page. | | filterCoinIdList | array\[string] | No | Filter by collateral coin IDs. If empty, fetches for all coins. | | filterContractIdList | array\[string] | No | Filter by contract IDs. If empty, fetches for all contracts. | | filterOrderIdList | array\[string] | No | Filter by order IDs. If empty, fetches for all orders. | | filterIsLiquidateList | array\[boolean] | No | Filter by liquidation orders. If empty, fetches all orders. | | filterIsDeleverageList | array\[boolean] | No | Filter by deleverage orders. If empty, fetches all orders. | | filterIsPositionTpslList | array\[boolean] | No | Filter by position TP/SL orders. If empty, fetches all orders. | | filterStartCreatedTimeInclusive | string(int64) | No | Filter transactions created after this time (inclusive). If 0 or empty, from earliest. | | filterEndCreatedTimeExclusive | string(int64) | No | Filter transactions created before this time (exclusive). If 0 or empty, to latest. | > Response Example > 200 Response ```json { "code": "SUCCESS", "data": { "dataList": [ { "id": "564815957260763406", "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "contractId": "10000001", "orderId": "564815695875932430", "orderSide": "BUY", "fillSize": "0.001", "fillValue": "97.4445", "fillFee": "0.017540", "fillPrice": "97444.5", "liquidateFee": "0", "realizePnl": "-0.017540", "direction": "MAKER", "matchTime": "1734662617982", "createdTime": "1734662617984", "updatedTime": "1734662617992" } ], "nextPageOffsetData": "" }, "msg": null, "errorParam": null, "requestTime": "1734662681040", "responseTime": "1734662681051", "traceId": "770fcce6222c2d88b65b4ecb36e84c43" } ``` ### Response Parameters | Name | Type | Description | | -------------------- | ----------------- | ------------------------------------------------------ | | code | string | Status code. "SUCCESS" for success, otherwise failure. | | data | object | Response data | | » dataList | array\[object] | Array of order fill transaction objects | | » nextPageOffsetData | string | Offset for next page. Empty string if no more data. | | msg | string | Message | | errorParam | object | Error parameters | | requestTime | string(timestamp) | Server request receive time | | responseTime | string(timestamp) | Server response return time | | traceId | string | Call trace ID | # Asset API ## When to Use This Page Use this page for the asset flows currently exposed by the V2 SDKs: * Chain-to-spot deposit data retrieval * Spot/perpv2 to chain withdraw flow * Asset flow query ## Path Note Although this page belongs to the V2 private API section, the asset endpoints currently used by both the Go SDK and Python SDK are under: `/api/v1/private/unified-asset` The legacy `/api/v2/private/assets/...` endpoints are no longer the SDK path. ## Domain Note Requests on this page use the Asset API production domain: `https://spot.edgex.exchange` Do not combine these unified-asset paths with the default REST production domain `https://edgex-prod-v2.edgex.exchange`. ## Common Notes * These endpoints use the same private REST authentication described in [Authentication](/edgeX-documentation/api-v2/authentication). * Withdraw submission requires both private REST authentication and an EIP-712 user signature. * Deposit data retrieval does not perform signing by itself; it returns chain transaction data for the client to use. * `withdraw` in the SDK is a composed flow built from `getFeeByAssetFlow -> getEIP712Data -> submitAssetFlow`. ## Unified Attempt Object Most unified-asset endpoints use an `attempt` object. ### Withdraw Attempt Example ```json { "userAddress": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "privyAddress": "0x0000000000000000000000000000000000000000", "source": "spot", "sourceAccount": "12345", "tokenAddress": "0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c", "amount": "1000", "fee": "0", "destination": "chain-3343", "destinationAccount": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "clientWithdrawId": "849849126827855872", "expireTime": 1893456000 } ``` ### Deposit Attempt Example ```json { "userAddress": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "privyAddress": "0x0000000000000000000000000000000000000000", "source": "chain-3343", "sourceAccount": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "tokenAddress": "0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c", "amount": "1000", "fee": "0", "destination": "spot", "destinationAccount": "12345" } ``` ### Attempt Fields | Name | Type | Required | Description | | ------------------ | ------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | userAddress | string | Yes | Wallet address of the user. | | privyAddress | string | No | Privy wallet address. SDK default is `0x0000000000000000000000000000000000000000`. | | source | string | Yes | Asset source. For withdraw use `spot` or `perpv2` , and deposit uses `chain-<chainId>`. | | sourceAccount | string | Yes | Source account identifier. For spot/perpv2 withdraw this is usually the EdgeX account ID; for chain deposit this is usually the user wallet address. | | tokenAddress | string | Yes | Token contract address. Native token flows use `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`. | | amount | string | Yes | Raw amount string. | | fee | string | Yes | Fee string. Initial request commonly uses `0`, then withdraw flow updates it from `getFeeByAssetFlow`. | | destination | string | Yes | Destination identifier. Withdraw uses `chain-<chainId>`; deposit uses `spot` or `perpv2`. | | destinationAccount | string | Yes | Destination account identifier. Withdraw usually uses the same wallet address as `userAddress`; deposit usually uses the spot/perpv2 account ID. | | clientWithdrawId | string | Withdraw only | Client-defined withdraw ID used for idempotency. | | expireTime | integer | Withdraw only | Unix timestamp in seconds. | ## POST Get Fee By Asset Flow POST `/api/v1/private/unified-asset/getFeeByAssetFlow` Returns the fee for a unified asset flow attempt. In SDK withdraw flow, this is called before requesting EIP-712 data. > Body Request Example ```json { "attempt": { "userAddress": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "privyAddress": "0x0000000000000000000000000000000000000000", "source": "spot", "sourceAccount": "12345", "tokenAddress": "0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c", "amount": "1000", "fee": "0", "destination": "chain-3343", "destinationAccount": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "clientWithdrawId": "849849126827855872", "expireTime": 1893456000 } } ``` ### Request Parameters | Name | Type | Required | Description | | ------------ | ------ | -------- | --------------------------- | | body | object | Yes | Request body. | | body.attempt | object | Yes | Unified asset flow attempt. | > Response Example ```json { "code": "SUCCESS", "data": { "fee": "10" }, "msg": null, "errorParam": null, "requestTime": "1234567890123", "responseTime": "1234567890124", "traceId": "abc123" } ``` ## POST Get EIP-712 Data POST `/api/v1/private/unified-asset/getEIP712Data` Returns the EIP-712 typed-data payload that must be signed for withdraw submission. > Body Request Example ```json { "attempt": { "userAddress": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "privyAddress": "0x0000000000000000000000000000000000000000", "source": "spot", "sourceAccount": "12345", "tokenAddress": "0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c", "amount": "990", "fee": "10", "destination": "chain-3343", "destinationAccount": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "clientWithdrawId": "849849126827855872", "expireTime": 1893456000 } } ``` ### Request Parameters | Name | Type | Required | Description | | ------------ | ------ | -------- | ------------------------------------------------------ | | body | object | Yes | Request body. | | body.attempt | object | Yes | Unified asset flow attempt after fee has been applied. | > Response Example ```json { "code": "SUCCESS", "data": { "types": { "EIP712Domain": { "fields": [ { "name": "name", "type": "string" }, { "name": "version", "type": "string" }, { "name": "verifyingContract", "type": "address" } ] }, "AssetFlowAttempt": { "fields": [ { "name": "userId", "type": "string" }, { "name": "userAddress", "type": "address" }, { "name": "privyAddress", "type": "address" }, { "name": "source", "type": "string" }, { "name": "sourceAccount", "type": "string" }, { "name": "tokenAddress", "type": "string" }, { "name": "amount", "type": "string" }, { "name": "fee", "type": "string" }, { "name": "destination", "type": "string" }, { "name": "destinationAccount", "type": "string" }, { "name": "clientWithdrawId", "type": "string" }, { "name": "expireTime", "type": "string" } ] } }, "primaryType": "AssetFlowAttempt", "domain": { "name": "edgeX Asset Flow", "version": "1", "verifyingContract": "0x000000000000000000000000000000000000eD9E" }, "messageJson": "{\"userId\":\"12345\",\"userAddress\":\"0xFCAd0B19bB29D4674531d6f115237E16AfCE377c\",\"privyAddress\":\"0x0000000000000000000000000000000000000000\",\"source\":\"spot\",\"sourceAccount\":\"12345\",\"tokenAddress\":\"0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c\",\"amount\":\"990\",\"fee\":\"10\",\"destination\":\"chain-3343\",\"destinationAccount\":\"0xFCAd0B19bB29D4674531d6f115237E16AfCE377c\",\"clientWithdrawId\":\"849849126827855872\",\"expireTime\":\"1893456000\"}" }, "msg": null, "errorParam": null, "requestTime": "1234567890123", "responseTime": "1234567890124", "traceId": "abc123" } ``` ## SDK Withdraw Signing Flow Both the Go SDK and Python SDK implement withdraw in the same order: 1. Build withdraw `attempt`. 2. Call `getFeeByAssetFlow`. 3. Replace `attempt.fee` and `attempt.amount` with the net amount. 4. Call `getEIP712Data`. 5. Sign the returned typed data with the wallet private key. 6. Submit the flow with `submitAssetFlow`. The submitted `userSignature` is `0x`-prefixed in both SDKs. ## POST Get Deposit Data POST `/api/v1/private/unified-asset/getDepositData` Returns deposit transaction data for chain-to-spot asset flows. > Body Request Example ```json { "attempt": { "userAddress": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "privyAddress": "0x0000000000000000000000000000000000000000", "source": "chain-33431", "sourceAccount": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "tokenAddress": "0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c", "amount": "1000", "fee": "0", "destination": "spot", "destinationAccount": "12345" }, "extraData": "" } ``` ### Request Parameters | Name | Type | Required | Description | | -------------- | ------ | -------- | -------------------------------------------- | | body | object | Yes | Request body. | | body.attempt | object | Yes | Unified asset deposit attempt. | | body.extraData | string | No | Extra payload passed through to the backend. | > Response Example ```json { "code": "SUCCESS", "data": { "chainId": 33431, "to": "0x86245522276a9F845a65a591b485cd4AaA51D86c", "data": "0x1234", "value": "0" }, "msg": null, "errorParam": null, "requestTime": "1234567890123", "responseTime": "1234567890124", "traceId": "abc123" } ``` ## POST Submit Asset Flow POST `/api/v1/private/unified-asset/submitAssetFlow` Submits a signed unified asset flow. In the SDK, this is used by the withdraw flow after EIP-712 signing. > Body Request Example ```json { "attempt": { "userAddress": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "privyAddress": "0x0000000000000000000000000000000000000000", "source": "spot", "sourceAccount": "12345", "tokenAddress": "0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c", "amount": "990", "fee": "10", "destination": "chain-3343", "destinationAccount": "0xFCAd0B19bB29D4674531d6f115237E16AfCE377c", "clientWithdrawId": "849849126827855872", "expireTime": 1893456000 }, "userSignature": "0x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", "extraData": "", "privyIdentityToken": "" } ``` ### Request Parameters | Name | Type | Required | Description | | ----------------------- | ------ | -------- | ------------------------------------------------ | | body | object | Yes | Request body. | | body.attempt | object | Yes | Unified asset flow attempt. | | body.userSignature | string | Yes | EIP-712 signature produced from `getEIP712Data`. | | body.extraData | string | No | Extra payload passed through to the backend. | | body.privyIdentityToken | string | No | Privy identity token when Privy flow is used. | > Response Example ```json { "code": "SUCCESS", "data": { "flowId": "1" }, "msg": null, "errorParam": null, "requestTime": "1234567890123", "responseTime": "1234567890124", "traceId": "abc123" } ``` ## GET Query Asset Flows GET `/api/v1/private/unified-asset/queryAssetFlows` Queries unified asset flow records. ### Request Parameters | Name | Type | Required | Description | | ------ | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | params | object | No | Query parameters passed directly to the backend query API. The current Go SDK accepts `map[string]string`; the current Python SDK accepts `Dict[str, Any]`. | > Response Example ```json { "code": "SUCCESS", "data": {}, "msg": null, "errorParam": null, "requestTime": "1234567890123", "responseTime": "1234567890124", "traceId": "abc123" } ``` ## SDK Convenience Methods The SDKs also provide the following convenience methods on top of the raw API endpoints above: * `CreateWithdraw`: wraps `getFeeByAssetFlow -> getEIP712Data -> submitAssetFlow` * `GetSpotDepositData`: builds a chain-to-spot deposit attempt, then calls `getDepositData` # Transfer API ## When to Use This Page Use this page when you need to create transfer-out orders, query transfer-in or transfer-out records, or check how much balance can still be transferred out of an account. ## Minimal Workflow 1. Check transfer-out available amount if your client needs a pre-check. 2. Build the transfer-out payload with the required `l2*` fields. 3. Submit the transfer-out request. 4. Query transfer records by ID to confirm the final state. ## Common Notes * These endpoints use the same private REST authentication rules as the rest of
프로젝트로 돌아가기