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

Method encode_withdraw_message

python/ccxt/hibachi.py:1119–1143  ·  view source on GitHub ↗
(self, amount: float, maxFees: float, address: str)

Source from the content-addressed store, hash-verified

1117 ]
1118
1119 def encode_withdraw_message(self, amount: float, maxFees: float, address: str):
1120 # Converting them to internal representation:
1121 # - Quantity: Internal = External * (10^6)
1122 # - maxFees: Internal = External * (10^6)
1123 # We only have USDT currency time
1124 USDTAssetId = 1
1125 USDTFactor = '1000000'
1126 amountStr = self.number_to_string(amount)
1127 maxFeesStr = self.number_to_string(maxFees)
1128 one = '1'
1129 quantityInternal = Precise.string_div(Precise.string_mul(amountStr, USDTFactor), one, 0)
1130 maxFeesInternal = Precise.string_div(Precise.string_mul(maxFeesStr, USDTFactor), one, 0)
1131 # Encoding
1132 usdtAsset16 = self.int_to_base16(USDTAssetId)
1133 usdtAssetPadded = usdtAsset16.rjust(8, '0')
1134 encodedAssetId = self.base16_to_binary(usdtAssetPadded)
1135 quantity16 = self.int_to_base16(self.parse_to_int(quantityInternal))
1136 quantityPadded = quantity16.rjust(16, '0')
1137 encodedQuantity = self.base16_to_binary(quantityPadded)
1138 maxFees16 = self.int_to_base16(self.parse_to_int(maxFeesInternal))
1139 maxFeesPadded = maxFees16.rjust(16, '0')
1140 encodedMaxFees = self.base16_to_binary(maxFeesPadded)
1141 encodedAddress = self.base16_to_binary(address)
1142 message = self.binary_concat(encodedAssetId, encodedQuantity, encodedMaxFees, encodedAddress)
1143 return message
1144
1145 def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1146 """

Callers 1

withdrawMethod · 0.95

Calls 6

string_divMethod · 0.80
string_mulMethod · 0.80
int_to_base16Method · 0.80
base16_to_binaryMethod · 0.80
parse_to_intMethod · 0.80
binary_concatMethod · 0.80

Tested by

no test coverage detected