node_modules/@velas/solana-web3/lib/index.browser.esm.js
/**
   * Confirm the transaction identified by the specified signature.
   */
Confirm the transaction identified by the specified signature.
Confirm the transaction identified by the specified signature .
async confirmTransaction(signature, commitment) {
    let decodedSignature;
    try {
      decodedSignature = bs58.decode(signature);
    } catch (err) {
      throw new Error('signature must be base58 encoded: ' + signature);
    }
    assert$1(decodedSignature.length === 64, 'signature has invalid length');
    const start = Date.now();
    const subscriptionCommitment = commitment || this.commitment;
    let subscriptionId;
    let response = null;
    const confirmPromise = new Promise((resolve, reject) => {
      try {
        subscriptionId = this.onSignature(signature, (result, context) => {
          subscriptionId = undefined;
          response = {
            context,
            value: result
          };
          resolve(null);
        }, subscriptionCommitment);
      } catch (err) {
        reject(err);
      }
    });
    let timeoutMs = 60 * 1000;
    switch (subscriptionCommitment) {
      case 'processed':
      case 'recent':
      case 'single':
      case 'confirmed':
      case 'singleGossip':
        {
          timeoutMs = 30 * 1000;
          break;
        }
    }
    try {
      await promiseTimeout(confirmPromise, timeoutMs);
    } finally {
      if (subscriptionId) {
        this.removeSignatureListener(subscriptionId);
      }
    }
    if (response === null) {
      const duration = (Date.now() - start) / 1000;
      throw new Error("Transaction was not confirmed in ".concat(duration.toFixed(2), " seconds. It is unknown if it succeeded or failed. Check signature ").concat(signature, " using the Solana Explorer or CLI tools."));
    }
    return response;
  }
async confirmTransaction ( signature , commitment ) { let decodedSignature ; try { decodedSignature = bs58 . decode ( signature ) ; } catch ( err ) { throw new Error ( 'signature must be base58 encoded: ' + signature ) ; } assert$1 ( decodedSignature . length === 64 , 'signature has invalid length' ) ; const start = Date . now ( ) ; const subscriptionCommitment = commitment || this . commitment ; let subscriptionId ; let response = null ; const confirmPromise = new Promise ( ( resolve , reject ) => { try { subscriptionId = this . onSignature ( signature , ( result , context ) => { subscriptionId = undefined ; response = { context , value : result } ; resolve ( null ) ; } , subscriptionCommitment ) ; } catch ( err ) { reject ( err ) ; } } ) ; let timeoutMs = 60 * 1000 ; switch ( subscriptionCommitment ) { case 'processed' : case 'recent' : case 'single' : case 'confirmed' : case 'singleGossip' : { timeoutMs = 30 * 1000 ; break ; } } try { await promiseTimeout ( confirmPromise , timeoutMs ) ; } finally { if ( subscriptionId ) { this . removeSignatureListener ( subscriptionId ) ; } } if ( response === null ) { const duration = ( Date . now ( ) - start ) / 1000 ; throw new Error ( "Transaction was not confirmed in " . concat ( duration . toFixed ( 2 ) , " seconds. It is unknown if it succeeded or failed. Check signature " ) . concat ( signature , " using the Solana Explorer or CLI tools." ) ) ; } return response ; }
Confirm the transaction identified by the specified signature.
Confirm the transaction identified by the specified signature .