Class NemFacade
- NemFacade
High-level facade used to interact with the NEM blockchain: signing, verifying, hashing, and creating transactions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classNEM account — adds the signing key pair toNemFacade.NemPublicAccount.static classNEM public account — known public key plus derived address. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringBIP32 curve name for NEM.final NetworkUnderlying network.final NemTransactionFactoryUnderlying transaction factory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyPairbip32NodeToKeyPair(Bip32.Bip32Node bip32Node) Derives a NEMKeyPairfrom a BIP32 node.int[]bip32Path(int accountId) Creates a network-compatible BIP32 path for the specified account.createAccount(CryptoTypes.PrivateKey privateKey) Creates a NEM account from a private key.createPublicAccount(CryptoTypes.PublicKey publicKey) Creates a NEM public account from a public key.createTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey, long fee, long deadlineSeconds) Creates a transaction from a JSON descriptor document.createTransactionFromTypedDescriptor(NemTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey, long fee, long deadlineSeconds) Creates a transaction from a typed transaction descriptor.byte[]extractSigningPayload(Transaction transaction) Gets the payload to sign for a NEM transaction.hashTransaction(Transaction transaction) Hashes a NEM transaction; the hash is Keccak-256 of the non-verifiable serialization.now()Creates a network timestamp representing the current time.signTransaction(KeyPair keyPair, Transaction transaction) Signs a NEM transaction.booleanverifyTransaction(Transaction transaction, CryptoTypes.Signature signature) Verifies a NEM transaction signature.
-
Field Details
-
BIP32_CURVE_NAME
BIP32 curve name for NEM.- See Also:
-
network
Underlying network. -
transactionFactory
Underlying transaction factory.
-
-
Constructor Details
-
NemFacade
Creates a NEM facade around an explicit network.- Parameters:
network- NEM network.
-
NemFacade
Creates a NEM facade by network name.- Parameters:
networkName- Network name (e.g."mainnet","testnet").
-
-
Method Details
-
now
- NemFacade.now
Creates a network timestamp representing the current time.
- Returns:
Network timestamp representing the current time.
-
createPublicAccount
- NemFacade.createPublicAccount
Creates a NEM public account from a public key.
- Parameters:
publicKey- Account public key.- Returns:
NEM public account.
-
createAccount
- NemFacade.createAccount
Creates a NEM account from a private key.
- Parameters:
privateKey- Account private key.- Returns:
NEM account.
-
createTransactionFromTypedDescriptor
public Transaction createTransactionFromTypedDescriptor(NemTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey, long fee, long deadlineSeconds) - NemFacade.createTransactionFromTypedDescriptor
Creates a transaction from a typed transaction descriptor.
- Parameters:
typedDescriptor- Typed transaction descriptor.signerPublicKey- Signer public key.fee- Transaction fee.deadlineSeconds- Approximate seconds from now for the deadline.- Returns:
Created transaction.
-
createTransactionFromJson
public Transaction createTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey, long fee, long deadlineSeconds) - NemFacade.createTransactionFromJson
Creates a transaction from a JSON descriptor document.
- Parameters:
json- JSON object with the same shape as the untyped descriptor map.signerPublicKey- Signer public key.fee- Transaction fee.deadlineSeconds- Approximate seconds from now for the deadline.- Returns:
Created transaction.
-
hashTransaction
- NemFacade.hashTransaction
Hashes a NEM transaction; the hash is Keccak-256 of the non-verifiable serialization.
- Parameters:
transaction- Transaction object.- Returns:
Transaction hash.
-
extractSigningPayload
- NemFacade.extractSigningPayload
Gets the payload to sign for a NEM transaction.
- Parameters:
transaction- Transaction object.- Returns:
Verifiable data to sign — the non-verifiable serialization of the transaction.
-
signTransaction
- NemFacade.signTransaction
Signs a NEM transaction.
- Parameters:
keyPair- Signer key pair.transaction- Transaction object.- Returns:
Transaction signature.
-
verifyTransaction
- NemFacade.verifyTransaction
Verifies a NEM transaction signature.
- Parameters:
transaction- Transaction object.signature- Signature to verify.- Returns:
trueif the signature is valid for the transaction.
-
bip32Path
public int[] bip32Path(int accountId) - NemFacade.bip32Path
Creates a network-compatible BIP32 path for the specified account.
- Parameters:
accountId- Id of the account for which to generate a BIP32 path.- Returns:
BIP32 path for the specified account.
-
bip32NodeToKeyPair
- Parameters:
bip32Node- BIP32 node.- Returns:
Derived key pair.
-