Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
asset2 = b'\0' if priceAsset.assetId=='' else b'\1' + base58.b58decode(priceAsset.assetId)
sData = base58.b58decode(self.publicKey) + \
base58.b58decode(pywaves.MATCHER_PUBLICKEY) + \
asset1 + \
asset2 + \
orderType + \
struct.pack(">Q", price) + \
struct.pack(">Q", amount) + \
struct.pack(">Q", timestamp) + \
struct.pack(">Q", expiration) + \
struct.pack(">Q", matcherFee)
signature = crypto.sign(self.privateKey, sData)
otype = "buy" if orderType==b'\0' else "sell"
data = json.dumps({
"senderPublicKey": self.publicKey,
"matcherPublicKey": pywaves.MATCHER_PUBLICKEY,
"assetPair": {
"amountAsset": amountAsset.assetId,
"priceAsset": priceAsset.assetId,
},
"orderType": otype,
"price": price,
"amount": amount,
"timestamp": timestamp,
"expiration": expiration,
"matcherFee": matcherFee,
"signature": signature
})
req = pywaves.wrapper('/matcher/orderbook', data, host=pywaves.MATCHER)
print(req)
id = -1
if 'status' in req:
def __init__(self, orderId, assetPair, address = ''):
self.orderId = orderId
self.assetPair = assetPair
self.address = address
self.matcher = pywaves.MATCHER
self.matcherPublicKey = pywaves.MATCHER_PUBLICKEY
self.status()
def _postOrder(self, amountAsset, priceAsset, orderType, amount, price, maxLifetime=30*86400, matcherFee=pywaves.DEFAULT_MATCHER_FEE, timestamp=0):
if timestamp == 0:
timestamp = int(time.time() * 1000)
expiration = timestamp + maxLifetime * 1000
asset1 = b'\0' if amountAsset.assetId=='' else b'\1' + base58.b58decode(amountAsset.assetId)
asset2 = b'\0' if priceAsset.assetId=='' else b'\1' + base58.b58decode(priceAsset.assetId)
sData = base58.b58decode(self.publicKey) + \
base58.b58decode(pywaves.MATCHER_PUBLICKEY) + \
asset1 + \
asset2 + \
orderType + \
struct.pack(">Q", price) + \
struct.pack(">Q", amount) + \
struct.pack(">Q", timestamp) + \
struct.pack(">Q", expiration) + \
struct.pack(">Q", matcherFee)
signature = crypto.sign(self.privateKey, sData)
otype = "buy" if orderType==b'\0' else "sell"
data = json.dumps({
"senderPublicKey": self.publicKey,
"matcherPublicKey": pywaves.MATCHER_PUBLICKEY,
"assetPair": {
"amountAsset": amountAsset.assetId,
"priceAsset": priceAsset.assetId,