How to use the @zilliqa-js/crypto.isValidChecksumAddress function in @zilliqa-js/crypto

To help you get started, we’ve selected a few @zilliqa-js/crypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zilliqa / nucleus-wallet / functions / src / index.ts View on Github external
headers: {
          'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
        }
      }
    );

    const responseData = result.data;
    if (responseData && !responseData.success) {
      console.log('Invaild recaptcha token!');
      const errorMessage = responseData['error-codes'].join(', ');
      throw new Error(errorMessage);
    }
    console.log('Vaild recaptcha token ✓');

    console.log(`Address: ${address}`);
    if (!isValidChecksumAddress(address)) {
      throw new Error('Invalid Checksum Address!');
    }
    console.log('Vaild address ✓');
  } catch (error) {
    console.error(error);
    res.status(400).json({ errorCode: 400, errorMessage: error.message });
    return;
  }

  try {
    let claimInterval;
    const userRef = firestore
      .collection(`versions`)
      .doc(`${VERSION}`)
      .collection(`users`)
      .doc(`${address}`);
github Zilliqa / Zilliqa-JavaScript-Library / packages / zilliqa-js-contract / src / contract.ts View on Github external
toDs,
        ),
        attempts,
        interval,
        true,
      );

      if (tx.isRejected()) {
        this.status = ContractStatus.Rejected;
        this.address = undefined;
        return [tx, this];
      }

      this.status = ContractStatus.Deployed;
      this.address =
        this.address && isValidChecksumAddress(this.address)
          ? this.address
          : Contracts.getAddressForContract(tx);

      return [tx, this];
    } catch (err) {
      throw err;
    }
  }