All files / src/connect/tx stx-transfer.ts

66.66% Statements 4/6
0% Branches 0/2
0% Functions 0/1
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 162x 2x 2x   2x                      
import { StxTransferTxOptions, StxTransferTxPayload, TransactionTypes } from './types';
import { signTransactionPayload } from './sign';
import { safeGetPublicKey } from '../common/utils';
 
export async function makeStxTransferToken({ privateKey, ...options }: StxTransferTxOptions) {
  const payload: StxTransferTxPayload = {
    ...options,
    amount:
      typeof options.amount === 'bigint' ? Number(options.amount).toString(10) : options.amount,
    publicKey: safeGetPublicKey(privateKey),
    txType: TransactionTypes.STXTransfer,
  };
 
  return signTransactionPayload(payload, privateKey);
}