Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)})`);
});
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()
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)})`,
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
}
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)})`);
});
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)})`,
)
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)
}
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,
)
}
public __createDelegateTransaction(wallet) {
const { data } = client
.getBuilder()
.delegateRegistration()
.usernameAsset(wallet.username)
.sign(wallet.passphrase);
return this.__formatGenesisTransaction(data, wallet);
}
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);
}