Class SymbolFacade
- SymbolFacade
High-level facade for interacting with the Symbol blockchain: signing, verifying, hashing, cosigning, and creating transactions from untyped
Mapdescriptors or generatedSymbolTransactionDescriptors.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSymbol account — adds the private key pair toSymbolFacade.SymbolPublicAccount.static classSymbol public account — known public key + derived address. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringBIP32 curve name for Symbol.final NetworkUnderlying network.final SymbolTransactionFactoryUnderlying transaction factory. -
Constructor Summary
ConstructorsConstructorDescriptionSymbolFacade(String networkName) Creates a Symbol facade by network name.SymbolFacade(Network network) Creates a Symbol facade around an explicit network. -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyPairbip32NodeToKeyPair(Bip32.Bip32Node bip32Node) Derives a SymbolKeyPairfrom a BIP32 node.int[]bip32Path(int accountId) Creates a network-compatible BIP32 path for the specified account.cosignTransaction(KeyPair keyPair, Transaction transaction) Cosigns a Symbol transaction, producing a cosignature suitable for attaching to an aggregate.cosignTransactionDetached(KeyPair keyPair, Transaction transaction) Cosigns a Symbol transaction, producing a detached cosignature suitable for network propagation.static CosignaturecosignTransactionHash(KeyPair keyPair, CryptoTypes.Hash256 transactionHash) Cosigns a Symbol transaction hash, producing a cosignature suitable for attaching to an aggregate.static DetachedCosignaturecosignTransactionHashDetached(KeyPair keyPair, CryptoTypes.Hash256 transactionHash) Cosigns a Symbol transaction hash, producing a detached cosignature suitable for network propagation.createAccount(CryptoTypes.PrivateKey privateKey) Creates a Symbol account from a private key.createEmbeddedTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey) Creates an embedded transaction from a JSON descriptor document.createEmbeddedTransactionFromTypedDescriptor(SymbolTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey) Creates an embedded transaction from a typed transaction descriptor.createPublicAccount(CryptoTypes.PublicKey publicKey) Creates a Symbol public account from a public key.createTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds) Creates a transaction from a JSON descriptor document, reserving no cosignature space.createTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds, int cosignatureCount) Creates a transaction from a JSON descriptor document.createTransactionFromTypedDescriptor(SymbolTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds) Creates a transaction from a typed transaction descriptor, reserving no cosignature space.createTransactionFromTypedDescriptor(SymbolTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds, int cosignatureCount) Creates a transaction from a typed transaction descriptor; fee / deadline / cosignature handling is shared withcreateTransactionFromDescriptor(Map, CryptoTypes.PublicKey, long, long, int).byte[]extractSigningPayload(Transaction transaction) Gets the verifiable payload to sign for a Symbol transaction.static CryptoTypes.Hash256hashEmbeddedTransactions(List<? extends EmbeddedTransaction> embeddedTransactions) Hashes embedded transactions of an aggregate transaction.hashTransaction(Transaction transaction) Hashes a Symbol transaction.now()Creates a network timestamp representing the current time.signTransaction(KeyPair keyPair, Transaction transaction) Signs a Symbol transaction.booleanverifyTransaction(Transaction transaction, CryptoTypes.Signature signature) Verifies a Symbol transaction signature.
-
Field Details
-
BIP32_CURVE_NAME
BIP32 curve name for Symbol.- See Also:
-
network
Underlying network. -
transactionFactory
Underlying transaction factory.
-
-
Constructor Details
-
SymbolFacade
Creates a Symbol facade around an explicit network.- Parameters:
network- Symbol network.
-
SymbolFacade
Creates a Symbol facade by network name.- Parameters:
networkName- Network name (e.g."mainnet","testnet").
-
-
Method Details
-
now
- SymbolFacade.now
Creates a network timestamp representing the current time.
- Returns:
Network timestamp representing the current time.
-
createPublicAccount
- SymbolFacade.createPublicAccount
Creates a Symbol public account from a public key.
- Parameters:
publicKey- Account public key.- Returns:
Symbol public account.
-
createAccount
- SymbolFacade.createAccount
Creates a Symbol account from a private key.
- Parameters:
privateKey- Account private key.- Returns:
Symbol account.
-
createTransactionFromTypedDescriptor
public Transaction createTransactionFromTypedDescriptor(SymbolTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds) - SymbolFacade.createTransactionFromTypedDescriptor
Creates a transaction from a typed transaction descriptor, reserving no cosignature space.
- Parameters:
typedDescriptor- Typed transaction descriptor.signerPublicKey- Signer public key.feeMultiplier- Fee multiplier.deadlineSeconds- Approximate seconds from now for the deadline.- Returns:
Created transaction with fee filled in.
-
createTransactionFromTypedDescriptor
public Transaction createTransactionFromTypedDescriptor(SymbolTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds, int cosignatureCount) - SymbolFacade.createTransactionFromTypedDescriptor
Creates a transaction from a typed transaction descriptor; fee / deadline / cosignature handling is shared with
createTransactionFromDescriptor(Map, CryptoTypes.PublicKey, long, long, int).
- Parameters:
typedDescriptor- Typed transaction descriptor.signerPublicKey- Signer public key.feeMultiplier- Fee multiplier.deadlineSeconds- Approximate seconds from now for the deadline.cosignatureCount- Number of cosignature spaces to reserve when computing the fee.- Returns:
Created transaction with fee filled in.
-
createEmbeddedTransactionFromTypedDescriptor
public EmbeddedTransaction createEmbeddedTransactionFromTypedDescriptor(SymbolTransactionDescriptor typedDescriptor, CryptoTypes.PublicKey signerPublicKey) - SymbolFacade.createEmbeddedTransactionFromTypedDescriptor
Creates an embedded transaction from a typed transaction descriptor.
- Parameters:
typedDescriptor- Typed transaction descriptor.signerPublicKey- Signer public key.- Returns:
Created embedded transaction.
-
createTransactionFromJson
public Transaction createTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds) - SymbolFacade.createTransactionFromJson
Creates a transaction from a JSON descriptor document, reserving no cosignature space.
- Parameters:
json- JSON object with the same shape as the untyped descriptor map.signerPublicKey- Signer public key.feeMultiplier- Fee multiplier.deadlineSeconds- Approximate seconds from now for the deadline.- Returns:
Created transaction with fee filled in.
-
createTransactionFromJson
public Transaction createTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey, long feeMultiplier, long deadlineSeconds, int cosignatureCount) - SymbolFacade.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.feeMultiplier- Fee multiplier.deadlineSeconds- Approximate seconds from now for the deadline.cosignatureCount- Number of cosignature spaces to reserve when computing the fee.- Returns:
Created transaction with fee filled in.
-
createEmbeddedTransactionFromJson
public EmbeddedTransaction createEmbeddedTransactionFromJson(String json, CryptoTypes.PublicKey signerPublicKey) - SymbolFacade.createEmbeddedTransactionFromJson
Creates an embedded transaction from a JSON descriptor document.
- Parameters:
json- JSON object with the same shape as the untyped descriptor map.signerPublicKey- Signer public key.- Returns:
Created embedded transaction.
-
hashTransaction
- SymbolFacade.hashTransaction
Hashes a Symbol transaction.
- Parameters:
transaction- Transaction object.- Returns:
Transaction hash.
-
extractSigningPayload
- SymbolFacade.extractSigningPayload
Gets the verifiable payload to sign for a Symbol transaction.
- Parameters:
transaction- Transaction object.- Returns:
Bytes to sign —
generationHashSeed | transactionDataBuffer.
-
signTransaction
- SymbolFacade.signTransaction
Signs a Symbol transaction.
- Parameters:
keyPair- Signer key pair.transaction- Transaction object.- Returns:
Transaction signature.
-
verifyTransaction
- SymbolFacade.verifyTransaction
Verifies a Symbol transaction signature.
- Parameters:
transaction- Transaction object.signature- Signature to verify.- Returns:
trueif the signature is valid for the transaction.
-
cosignTransactionHash
public static Cosignature cosignTransactionHash(KeyPair keyPair, CryptoTypes.Hash256 transactionHash) - SymbolFacade.cosignTransactionHash
Cosigns a Symbol transaction hash, producing a cosignature suitable for attaching to an aggregate.
- Parameters:
keyPair- Key pair of the cosignatory.transactionHash- Transaction hash.- Returns:
Signed cosignature.
-
cosignTransactionHashDetached
public static DetachedCosignature cosignTransactionHashDetached(KeyPair keyPair, CryptoTypes.Hash256 transactionHash) - SymbolFacade.cosignTransactionHashDetached
Cosigns a Symbol transaction hash, producing a detached cosignature suitable for network propagation.
- Parameters:
keyPair- Key pair of the cosignatory.transactionHash- Transaction hash.- Returns:
Signed detached cosignature.
-
cosignTransaction
- SymbolFacade.cosignTransaction
Cosigns a Symbol transaction, producing a cosignature suitable for attaching to an aggregate.
- Parameters:
keyPair- Key pair of the cosignatory.transaction- Transaction object.- Returns:
Signed cosignature.
-
cosignTransactionDetached
- SymbolFacade.cosignTransactionDetached
Cosigns a Symbol transaction, producing a detached cosignature suitable for network propagation.
- Parameters:
keyPair- Key pair of the cosignatory.transaction- Transaction object.- Returns:
Signed detached cosignature.
-
hashEmbeddedTransactions
public static CryptoTypes.Hash256 hashEmbeddedTransactions(List<? extends EmbeddedTransaction> embeddedTransactions) - SymbolFacade.hashEmbeddedTransactions
Hashes embedded transactions of an aggregate transaction.
- Parameters:
embeddedTransactions- Embedded transactions to hash.- Returns:
Aggregate transactions hash.
-
bip32Path
public int[] bip32Path(int accountId) - SymbolFacade.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
- SymbolFacade.bip32NodeToKeyPair
Derives a Symbol
KeyPairfrom a BIP32 node.
- Parameters:
bip32Node- BIP32 node.- Returns:
Derived key pair.
-