MCPcopy Create free account
hub / github.com/ccxt/ccxt / parseTransfer

Method parseTransfer

ts/src/woo.ts:2948–3006  ·  view source on GitHub ↗
(transfer: Dict, currency: Currency = undefined)

Source from the content-addressed store, hash-verified

2946 }
2947
2948 parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {
2949 //
2950 // fetchTransfers
2951 // {
2952 // "id": 46704,
2953 // "token": "USDT",
2954 // "amount": 30000.00000000,
2955 // "status": "COMPLETED",
2956 // "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
2957 // "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
2958 // "from_user": "LeverageLow",
2959 // "to_user": "dev",
2960 // "created_time": "1709022325.427",
2961 // "updated_time": "1709022325.542"
2962 // }
2963 // {
2964 // "id": 225,
2965 // "token": "USDT",
2966 // "amount": "1000000",
2967 // "status": "COMPLETED",
2968 // "from": {
2969 // "applicationId": "046b5c5c-5b44-4d27-9593-ddc32c0a08ae",
2970 // "accountName": "Main"
2971 // },
2972 // "to": {
2973 // "applicationId": "082ae5ae-e26a-4fb1-be5b-03e5b4867663",
2974 // "accountName": "sub001"
2975 // },
2976 // "createdTime": "1642660941.534",
2977 // "updatedTime": "1642660941.950"
2978 // }
2979 //
2980 // transfer
2981 // {
2982 // "success": true,
2983 // "id": 200
2984 // }
2985 //
2986 const code = this.safeCurrencyCode (this.safeString (transfer, 'token'), currency);
2987 const timestamp = this.safeTimestamp2 (transfer, 'createdTime', 'timestamp');
2988 const success = this.safeBool (transfer, 'success');
2989 let status: Str = undefined;
2990 if (success !== undefined) {
2991 status = success ? 'ok' : 'failed';
2992 }
2993 const fromAccount = this.safeDict (transfer, 'from', {});
2994 const toAccount = this.safeDict (transfer, 'to', {});
2995 return {
2996 'id': this.safeString (transfer, 'id'),
2997 'timestamp': timestamp,
2998 'datetime': this.iso8601 (timestamp),
2999 'currency': code,
3000 'amount': this.safeNumber (transfer, 'amount'),
3001 'fromAccount': this.safeString (fromAccount, 'applicationId'),
3002 'toAccount': this.safeString (toAccount, 'applicationId'),
3003 'status': this.parseTransferStatus (this.safeString (transfer, 'status', status)),
3004 'info': transfer,
3005 };

Callers 1

transferMethod · 0.95

Calls 8

parseTransferStatusMethod · 0.95
safeCurrencyCodeMethod · 0.45
safeStringMethod · 0.45
safeTimestamp2Method · 0.45
safeBoolMethod · 0.45
safeDictMethod · 0.45
iso8601Method · 0.45
safeNumberMethod · 0.45

Tested by

no test coverage detected