createToken method
Creates a transferable offline token by transfering from the specified ledger account.
Implementation
Future<(TransactionResponse, OfflineToken)> createToken({
required String accountId,
required Int64 value,
required String operator,
String? address,
String? contextId,
}) async {
final createToken = CreateToken()
..accountId = hex.decode(accountId)
..value = value
..address =
address != null ? base64.decode(address) : await signer.publicKey();
final client = getServiceClient(operator);
final request = TransactionRequestPayload()
..data = (TransactionData()..createToken = createToken);
final envelope = await requestEnvelope(
request: request,
contextId: contextId != null ? hex.decode(contextId) : null,
);
final response = await client.tx.createTransaction(envelope);
return (response, response.token);
}