import { apdu , transport , tx } from '@coolwallet/core' ; import * as txUtil from './utils/transactionUtil' ; import * as types from './config/types' ; type Transport = transport . default ; export async function transferSignature ( signData , denom , script , argument ) { const canonicalSignature = await sign ( signData . transport , signData . appId , signData . appPrivateKey , script , argument , signData . confirmCB , signData . authorizedCB ) ; return txUtil . composeSignedTransacton ( signData . signObj as types . Transfer , denom , canonicalSignature , signData . signPublicKey ) ; } export async function walletConnectSignature ( transport , appId , appPrivateKey , script , argument , confirmCB ? , authorizedCB ? ) { const canonicalSignature = await sign ( transport , appId , appPrivateKey , script , argument , confirmCB , authorizedCB ) ; return canonicalSignature . r + canonicalSignature . s ; } /**
 * Sign Binance Tranaction
 */ async function sign ( transport , appId , appPrivateKey , script , argument , confirmCB ? , authorizedCB ? ) { const preActions = [ ] ; let action ; const sendScript = async ( ) => { await apdu . tx . sendScript ( transport , script ) ; } ; preActions . push ( sendScript ) ; action = async ( ) => { return apdu . tx . executeScript ( transport , appId , appPrivateKey , argument ) ; } ; return await tx . flow . getSingleSignatureFromCoolWallet ( transport , preActions , action , false , confirmCB , authorizedCB , true ) as { r : string ; s : string ; } ; }