Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
nem: Add nem_transaction_create_importance_transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
saleemrashid authored and prusnak committed Oct 8, 2017
1 parent 9c91985 commit 56114cc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
31 changes: 31 additions & 0 deletions nem.c
Expand Up @@ -584,3 +584,34 @@ bool nem_transaction_write_minimum_cosignatories(nem_transaction_ctx *ctx,

return true;
}

bool nem_transaction_create_importance_transfer(nem_transaction_ctx *ctx,
uint8_t network,
uint32_t timestamp,
const ed25519_public_key signer,
uint64_t fee,
uint32_t deadline,
uint32_t mode,
const ed25519_public_key remote) {

if (!signer) {
signer = ctx->public_key;
}

bool ret = nem_transaction_write_common(ctx,
NEM_TRANSACTION_TYPE_IMPORTANCE_TRANSFER,
network << 24 | 1,
timestamp,
signer,
fee,
deadline);
if (!ret) return false;

#define NEM_SERIALIZE \
serialize_u32(mode) \
serialize_write(remote, sizeof(ed25519_public_key))

#include "nem_serialize.h"

return true;
}
10 changes: 10 additions & 0 deletions nem.h
Expand Up @@ -42,6 +42,7 @@
#define NEM_ADDRESS_SIZE_RAW 25

#define NEM_TRANSACTION_TYPE_TRANSFER 0x0101
#define NEM_TRANSACTION_TYPE_IMPORTANCE_TRANSFER 0x0801
#define NEM_TRANSACTION_TYPE_AGGREGATE_MODIFICATION 0x1001
#define NEM_TRANSACTION_TYPE_MULTISIG_SIGNATURE 0x1002
#define NEM_TRANSACTION_TYPE_MULTISIG 0x1004
Expand Down Expand Up @@ -176,4 +177,13 @@ bool nem_transaction_write_cosignatory_modification(nem_transaction_ctx *ctx,
bool nem_transaction_write_minimum_cosignatories(nem_transaction_ctx *ctx,
int32_t relative_change);

bool nem_transaction_create_importance_transfer(nem_transaction_ctx *ctx,
uint8_t network,
uint32_t timestamp,
const ed25519_public_key signer,
uint64_t fee,
uint32_t deadline,
uint32_t mode,
const ed25519_public_key remote);

#endif

0 comments on commit 56114cc

Please sign in to comment.