How to use the @arkecosystem/crypto.client.getBuilder function in @arkecosystem/crypto

To help you get started, we’ve selected a few @arkecosystem/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 ArkEcosystem / core / packages / core-tester-cli / src / commands / vote.ts View on Github external
wallets.forEach((wallet, i) => {
            const transaction = client
                .getBuilder()
                .vote()
                .fee(parseFee(this.options.voteFee))
                .votesAsset([`+${delegate}`])
                .network(this.config.network.version)
                .sign(wallet.passphrase)
                .secondSign(this.config.secondPassphrase)
                .build();

            transactions.push(transaction);

            logger.info(`${i} ==> ${transaction.id}, ${wallet.address} (fee: ${satoshiToArk(transaction.data.fee)})`);
        });
github ArkEcosystem / core / packages / core-test-utils / lib / generators / transactions.js View on Github external
client.getConfigManager().setFromPreset('ark', network)

  const transactions = []
  for (let i = 0; i < quantity; i++) {
    const passphrase = testWallet ? testWallet.passphrase : config.passphrase
    const address = testAddress || crypto.getAddress(crypto.getKeys(passphrase).publicKey)

    let builder
    if (type === TRANSACTION_TYPES.TRANSFER) {
      builder = client.getBuilder().transfer()
        .recipientId(address)
        .amount(amount)
        .vendorField(`Test Transaction ${i + 1}`)
    } else if (type === TRANSACTION_TYPES.SECOND_SIGNATURE) {
      builder = client.getBuilder().secondSignature()
        .signatureAsset(passphrase)
    } else if (type === TRANSACTION_TYPES.DELEGATE_REGISTRATION) {
      const username = superheroes.random().toLowerCase().replace(/[^a-z0-9]/g, '_')
      builder = client.getBuilder().delegateRegistration()
        .usernameAsset(username)
    } else if (type === TRANSACTION_TYPES.VOTE) {
      const publicKey = crypto.getKeys(config.passphrase).publicKey
      builder = client.getBuilder().vote()
        .votesAsset([`+${publicKey}`])
    } else {
      continue
    }

    const transaction = builder
      .sign(passphrase)
      .build()
github ArkEcosystem / core / packages / core-tester-cli / lib / commands / second-signature.js View on Github external
wallets.forEach((wallet, i) => {
      wallet.secondPassphrase =
        this.config.secondPassphrase || wallet.passphrase
      const transaction = client
        .getBuilder()
        .secondSignature()
        .fee(Command.parseFee(this.options.signatureFee))
        .signatureAsset(wallet.secondPassphrase)
        .network(this.config.network.version)
        .sign(wallet.passphrase)
        .build()

      wallet.publicKey = transaction.senderPublicKey
      wallet.secondPublicKey = transaction.asset.signature.publicKey
      transactions.push(transaction)

      logger.info(
        `${i} ==> ${transaction.id}, ${
          wallet.address
        } (fee: ${Command.__arktoshiToArk(transaction.fee)})`,
github ArkEcosystem / core / packages / core-test-utils / lib / generators / transactions.js View on Github external
let builder
    if (type === TRANSACTION_TYPES.TRANSFER) {
      builder = client.getBuilder().transfer()
        .recipientId(address)
        .amount(amount)
        .vendorField(`Test Transaction ${i + 1}`)
    } else if (type === TRANSACTION_TYPES.SECOND_SIGNATURE) {
      builder = client.getBuilder().secondSignature()
        .signatureAsset(passphrase)
    } else if (type === TRANSACTION_TYPES.DELEGATE_REGISTRATION) {
      const username = superheroes.random().toLowerCase().replace(/[^a-z0-9]/g, '_')
      builder = client.getBuilder().delegateRegistration()
        .usernameAsset(username)
    } else if (type === TRANSACTION_TYPES.VOTE) {
      const publicKey = crypto.getKeys(config.passphrase).publicKey
      builder = client.getBuilder().vote()
        .votesAsset([`+${publicKey}`])
    } else {
      continue
    }

    const transaction = builder
      .sign(passphrase)
      .build()

    transactions.push(transaction)
  }

  return transactions
}
github ArkEcosystem / core / packages / core-tester-cli / src / commands / second-signature.ts View on Github external
wallets.forEach((wallet, i) => {
            wallet.secondPassphrase = this.config.secondPassphrase || wallet.passphrase;
            const transaction = client
                .getBuilder()
                .secondSignature()
                .fee(parseFee(this.options.signatureFee))
                .signatureAsset(wallet.secondPassphrase)
                .network(this.config.network.version)
                .sign(wallet.passphrase)
                .build();

            wallet.publicKey = transaction.data.senderPublicKey;
            wallet.secondPublicKey = transaction.data.asset.signature.publicKey;
            transactions.push(transaction);

            logger.info(`${i} ==> ${transaction.id}, ${wallet.address} (fee: ${satoshiToArk(transaction.data.fee)})`);
        });
github ArkEcosystem / core / packages / core-tester-cli / lib / commands / vote.js View on Github external
wallets.forEach((wallet, i) => {
      const transaction = client
        .getBuilder()
        .vote()
        .fee(Command.parseFee(this.options.voteFee))
        .votesAsset([`+${delegate}`])
        .network(this.config.network.version)
        .sign(wallet.passphrase)
        .secondSign(this.config.secondPassphrase)
        .build()

      transactions.push(transaction)

      logger.info(
        `${i} ==> ${transaction.id}, ${
          wallet.address
        } (fee: ${Command.__arktoshiToArk(transaction.fee)})`,
      )
github ArkEcosystem / core / packages / core-test-utils / lib / generators / transactions.js View on Github external
for (let i = 0; i < quantity; i++) {
    const passphrase = testWallet ? testWallet.passphrase : config.passphrase
    const address = testAddress || crypto.getAddress(crypto.getKeys(passphrase).publicKey)

    let builder
    if (type === TRANSACTION_TYPES.TRANSFER) {
      builder = client.getBuilder().transfer()
        .recipientId(address)
        .amount(amount)
        .vendorField(`Test Transaction ${i + 1}`)
    } else if (type === TRANSACTION_TYPES.SECOND_SIGNATURE) {
      builder = client.getBuilder().secondSignature()
        .signatureAsset(passphrase)
    } else if (type === TRANSACTION_TYPES.DELEGATE_REGISTRATION) {
      const username = superheroes.random().toLowerCase().replace(/[^a-z0-9]/g, '_')
      builder = client.getBuilder().delegateRegistration()
        .usernameAsset(username)
    } else if (type === TRANSACTION_TYPES.VOTE) {
      const publicKey = crypto.getKeys(config.passphrase).publicKey
      builder = client.getBuilder().vote()
        .votesAsset([`+${publicKey}`])
    } else {
      continue
    }

    const transaction = builder
      .sign(passphrase)
      .build()

    transactions.push(transaction)
  }
github ArkEcosystem / core / packages / core-tester-cli / lib / commands / multi-signature.js View on Github external
wallets.forEach((wallet, i) => {
      const builder = client.getBuilder().multiSignature()

      builder
        .fee(Command.parseFee(this.options.multisigFee))
        .multiSignatureAsset({
          lifetime: this.options.lifetime,
          keysgroup: publicKeys,
          min,
        })
        .network(this.config.network.version)
        .sign(wallet.passphrase)

      if (wallet.secondPassphrase || this.config.secondPassphrase) {
        builder.secondSign(
          wallet.secondPassphrase || this.config.secondPassphrase,
        )
      }
github ArkEcosystem / core / packages / core-deployer / src / builder / genesis-block.ts View on Github external
public __createDelegateTransaction(wallet) {
        const { data } = client
            .getBuilder()
            .delegateRegistration()
            .usernameAsset(wallet.username)
            .sign(wallet.passphrase);

        return this.__formatGenesisTransaction(data, wallet);
    }
github ArkEcosystem / core / packages / core-deployer / src / builder / genesis-block.ts View on Github external
public __createTransferTransaction(senderWallet, receiverWallet, amount) {
        const { data } = client
            .getBuilder()
            .transfer()
            .recipientId(receiverWallet.address)
            .amount(amount)
            .network(this.prefixHash)
            .sign(senderWallet.passphrase);

        return this.__formatGenesisTransaction(data, senderWallet);
    }