signStdTx static method

Future<StdTx> signStdTx({
  1. required Wallet wallet,
  2. required StdTx stdTx,
  3. Client? client,
})

Signs the given stdTx using the info contained inside the given wallet and returns a new StdTx containing the signatures inside it.

Implementation

static Future<StdTx> signStdTx({
  required Wallet wallet,
  required StdTx stdTx,
  http.Client? client,
}) async {
  client ??= http.Client();

  // Get the account data and node info from the network
  final account = await AccountDataRetrieval.getAccountData(
    wallet,
    client: client,
  );
  final nodeInfo = await NodeInfoRetrieval.getNodeInfo(
    wallet,
    client: client,
  );

  // Sign all messages
  final signatures = _getStdSignature(
    wallet,
    account,
    nodeInfo,
    stdTx.messages,
    stdTx.fee,
    stdTx.memo,
  );

  // Assemble the transaction
  return StdTx(
    fee: stdTx.fee,
    memo: stdTx.memo,
    messages: stdTx.messages,
    signatures: [signatures],
  );
}