Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sdk/python] NEM - automatic population for fields levy_size and message_envelope_size #292

Closed
cryptoBeliever opened this issue Jul 4, 2022 · 1 comment · Fixed by #531
Assignees
Labels
sdk-python Related to the Python SDK. Status: WIP This issue or PR is a work in progress.

Comments

@cryptoBeliever
Copy link
Contributor

cryptoBeliever commented Jul 4, 2022

Current Behaviour

SDK user has to specify fields manually:

  • levy_size
  • message_envelope_size

Expected Behaviour

Fields levy_size and message_envelope_size can be calculated based on other values in the transaction. We don't need to force users to calculate and specify it manually.

The corresponding issue for Javascript SDK: #293

@cryptoBeliever
Copy link
Contributor Author

cryptoBeliever commented Apr 6, 2023

I've tested Python SDK on the current dev branch, and SDK users don't need any more fill:

  • message_envelope_size when sensing transfer transaction
  • levy_size when sending mosaic definition transaction

I've not noticed any issues 👍

Example tx construction for transfer transaction:

transfer = facade.transaction_factory.create({
	'type': 'transfer_transaction_v2',
	'signer_public_key': alicePubkey,
	'recipient_address': bobAddress,
	'timestamp': networkTime.timestamp,
	'deadline': deadline,
	'fee': 100000,
	'amount': 1000000,
	'message': {
		'message_type': 'plain',
		'message': 'Hello Bob! Here is 1 XEM!'
	}
})

Example ex construction for mosaic creation with levy:

transfer = facade.transaction_factory.create({
	'type': 'mosaic_definition_transaction_v1',
	'signer_public_key': alicePubkey,
	'timestamp': networkTime.timestamp,
	'deadline': deadline,
	'rental_fee': 10000000,
	'fee': 200000,
	'rental_fee_sink': 'TBMOSAICOD4F54EE5CDMR23CCBGOAM2XSJBR5OLC',
	'mosaic_definition': {
		'owner_public_key': alicePubkey,
		'id': {'namespace_id': {'name': b'supernamespace'}, 'name': b'awesome_mosaic1'},
		'description': b'Just testing',
		'properties': [
			{'property_': {'name': b'divisibility', 'value': b'0'}},
			{'property_': {'name': b'initialSupply', 'value': b'1000'}},
			{'property_': {'name': b'supplyMutable', 'value': b'true'}},
			{'property_': {'name': b'transferable', 'value': b'true'}}
		],
		'levy': {
			'transfer_fee_type': 'absolute',
			'recipient_address': aliceAddress,
			'mosaic_id': {
				'namespace_id': {'name': b'nem'},
				'name': b'xem',
			},
			'fee': 0x00000000037706A6
		}
	},
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdk-python Related to the Python SDK. Status: WIP This issue or PR is a work in progress.
Projects
None yet
3 participants