Class SymbolFacade

java.lang.Object
org.symbol.sdk.facade.SymbolFacade

public final class SymbolFacade extends Object
SymbolFacade
High-level facade for interacting with the Symbol blockchain: signing, verifying, hashing, cosigning, and creating transactions from untyped Map descriptors or generated SymbolTransactionDescriptors.
  • Field Details

    • BIP32_CURVE_NAME

      public static final String BIP32_CURVE_NAME
      BIP32 curve name for Symbol.
      See Also:
    • network

      public final Network network
      Underlying network.
    • transactionFactory

      public final SymbolTransactionFactory transactionFactory
      Underlying transaction factory.
  • Constructor Details

    • SymbolFacade

      public SymbolFacade(Network network)
      Creates a Symbol facade around an explicit network.
      Parameters:
      network - Symbol network.
    • SymbolFacade

      public SymbolFacade(String networkName)
      Creates a Symbol facade by network name.
      Parameters:
      networkName - Network name (e.g. "mainnet", "testnet").
  • Method Details

    • now

      public NetworkTimestamp now()
      SymbolFacade.now
      Creates a network timestamp representing the current time.
      Returns:
      Network timestamp representing the current time.
    • createPublicAccount

      public SymbolFacade.SymbolPublicAccount createPublicAccount(CryptoTypes.PublicKey publicKey)
      SymbolFacade.createPublicAccount
      Creates a Symbol public account from a public key.
      Parameters:
      publicKey - Account public key.
      Returns:
      Symbol public account.
    • createAccount

      public SymbolFacade.SymbolAccount createAccount(CryptoTypes.PrivateKey privateKey)
      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

      public CryptoTypes.Hash256 hashTransaction(Transaction transaction)
      SymbolFacade.hashTransaction
      Hashes a Symbol transaction.
      Parameters:
      transaction - Transaction object.
      Returns:
      Transaction hash.
    • extractSigningPayload

      public byte[] extractSigningPayload(Transaction transaction)
      SymbolFacade.extractSigningPayload
      Gets the verifiable payload to sign for a Symbol transaction.
      Parameters:
      transaction - Transaction object.
      Returns:
      Bytes to sign — generationHashSeed | transactionDataBuffer.
    • signTransaction

      public CryptoTypes.Signature signTransaction(KeyPair keyPair, Transaction transaction)
      SymbolFacade.signTransaction
      Signs a Symbol transaction.
      Parameters:
      keyPair - Signer key pair.
      transaction - Transaction object.
      Returns:
      Transaction signature.
    • verifyTransaction

      public boolean verifyTransaction(Transaction transaction, CryptoTypes.Signature signature)
      SymbolFacade.verifyTransaction
      Verifies a Symbol transaction signature.
      Parameters:
      transaction - Transaction object.
      signature - Signature to verify.
      Returns:
      true if 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

      public Cosignature cosignTransaction(KeyPair keyPair, Transaction transaction)
      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

      public DetachedCosignature cosignTransactionDetached(KeyPair keyPair, Transaction transaction)
      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

      public static KeyPair bip32NodeToKeyPair(Bip32.Bip32Node bip32Node)
      SymbolFacade.bip32NodeToKeyPair
      Derives a Symbol KeyPair from a BIP32 node.
      Parameters:
      bip32Node - BIP32 node.
      Returns:
      Derived key pair.