Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should be created with HashType: Op_Keccak_256 secret', () => {
const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7';
const recipientAddress = Address.createFromRawAddress('SDBDG4IT43MPCW2W4CBBCSJJT42AYALQN7A4VVWL');
const secretLockTransaction = SecretLockTransaction.create(
Deadline.create(),
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Keccak_256,
keccak_256.create().update(convert.hexToUint8(proof)).hex(),
recipientAddress,
NetworkType.MIJIN_TEST,
);
deepEqual(secretLockTransaction.mosaic.id.id, NetworkCurrencyMosaic.NAMESPACE_ID.id);
expect(secretLockTransaction.mosaic.amount.equals(UInt64.fromUint(10))).to.be.equal(true);
expect(secretLockTransaction.duration.equals(UInt64.fromUint(100))).to.be.equal(true);
expect(secretLockTransaction.hashType).to.be.equal(1);
expect(secretLockTransaction.secret).to.be.equal('241c1d54c18c8422def03aa16b4b243a8ba491374295a1a6965545e6ac1af314');
expect(secretLockTransaction.recipientAddress).to.be.equal(recipientAddress);
});
it('should be created with HashType: Op_Keccak_256 secret', () => {
const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7';
const secretProofTransaction = SecretProofTransaction.create(
Deadline.create(),
HashType.Op_Keccak_256,
keccak_256.create().update(convert.hexToUint8(proof)).hex(),
account.address,
proof,
NetworkType.MIJIN_TEST,
);
expect(secretProofTransaction.hashType).to.be.equal(1);
expect(secretProofTransaction.secret).to.be.equal('241c1d54c18c8422def03aa16b4b243a8ba491374295a1a6965545e6ac1af314' );
expect(secretProofTransaction.proof).to.be.equal(proof);
});
it('HashType.Keccak_256 should be exactly 64 chars length', () => {
expect(HashTypeLengthValidator(HashType.Op_Keccak_256, keccak_256.create().update('abcxyz').hex())).to.be.equal(true);
});
it('aggregate', () => {
const secretSeed = Crypto.randomBytes(20);
const secret = keccak_256.create().update(secretSeed).hex();
const proof = convert.uint8ToHex(secretSeed);
const secretLockTransaction = SecretLockTransaction.create(
Deadline.create(),
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Keccak_256,
secret,
account2.address,
networkType, helper.maxFee,
);
return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => {
const secretProofTransaction = SecretProofTransaction.create(
Deadline.create(),
HashType.Op_Keccak_256,
secret,
account2.address,