Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions e2e/infrastructure/TransactionHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {assert, expect} from 'chai';
import * as CryptoJS from 'crypto-js';
import {ChronoUnit} from 'js-joda';
import {keccak_256, sha3_256} from 'js-sha3';
import {convert, nacl_catapult} from 'nem2-library';
import {Crypto} from '../../src/core/crypto';
import { Convert as convert } from '../../src/core/format';
import {AccountHttp} from '../../src/infrastructure/AccountHttp';
import { NamespaceHttp } from '../../src/infrastructure/infrastructure';
import {Listener} from '../../src/infrastructure/Listener';
Expand Down Expand Up @@ -66,7 +67,6 @@ import {Transaction} from '../../src/model/transaction/Transaction';
import {TransactionType} from '../../src/model/transaction/TransactionType';
import {TransferTransaction} from '../../src/model/transaction/TransferTransaction';
import {UInt64} from '../../src/model/UInt64';

describe('TransactionHttp', () => {
let transactionHash;
let transactionId;
Expand Down Expand Up @@ -992,7 +992,7 @@ describe('TransactionHttp', () => {
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Sha3_256,
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
sha3_256.create().update(Crypto.randomBytes(20)).hex(),
account2.address,
NetworkType.MIJIN_TEST,
);
Expand Down Expand Up @@ -1028,7 +1028,7 @@ describe('TransactionHttp', () => {
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Sha3_256,
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
sha3_256.create().update(Crypto.randomBytes(20)).hex(),
account2.address,
NetworkType.MIJIN_TEST,
);
Expand Down Expand Up @@ -1062,7 +1062,7 @@ describe('TransactionHttp', () => {
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Keccak_256,
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
sha3_256.create().update(Crypto.randomBytes(20)).hex(),
account2.address,
NetworkType.MIJIN_TEST,
);
Expand Down Expand Up @@ -1092,7 +1092,7 @@ describe('TransactionHttp', () => {
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Keccak_256,
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
sha3_256.create().update(Crypto.randomBytes(20)).hex(),
account2.address,
NetworkType.MIJIN_TEST,
);
Expand Down Expand Up @@ -1121,7 +1121,7 @@ describe('TransactionHttp', () => {
return listener.close();
});
it('standalone', (done) => {
const secretSeed = String.fromCharCode.apply(null, nacl_catapult.randomBytes(20));
const secretSeed = String.fromCharCode.apply(null, Crypto.randomBytes(20));
const secret = CryptoJS.RIPEMD160(CryptoJS.SHA256(secretSeed).toString(CryptoJS.enc.Hex)).toString(CryptoJS.enc.Hex);
const secretLockTransaction = SecretLockTransaction.create(
Deadline.create(),
Expand Down Expand Up @@ -1153,7 +1153,7 @@ describe('TransactionHttp', () => {
return listener.close();
});
it('aggregate', (done) => {
const secretSeed = String.fromCharCode.apply(null, nacl_catapult.randomBytes(20));
const secretSeed = String.fromCharCode.apply(null, Crypto.randomBytes(20));
const secret = CryptoJS.RIPEMD160(CryptoJS.SHA256(secretSeed).toString(CryptoJS.enc.Hex)).toString(CryptoJS.enc.Hex);
const secretLockTransaction = SecretLockTransaction.create(
Deadline.create(),
Expand Down Expand Up @@ -1194,7 +1194,7 @@ describe('TransactionHttp', () => {
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Hash_256,
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
sha3_256.create().update(Crypto.randomBytes(20)).hex(),
account2.address,
NetworkType.MIJIN_TEST,
);
Expand Down Expand Up @@ -1224,7 +1224,7 @@ describe('TransactionHttp', () => {
NetworkCurrencyMosaic.createAbsolute(10),
UInt64.fromUint(100),
HashType.Op_Hash_256,
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
sha3_256.create().update(Crypto.randomBytes(20)).hex(),
account2.address,
NetworkType.MIJIN_TEST,
);
Expand Down Expand Up @@ -1253,7 +1253,7 @@ describe('TransactionHttp', () => {
return listener.close();
});
it('standalone', (done) => {
const secretSeed = nacl_catapult.randomBytes(20);
const secretSeed = Crypto.randomBytes(20);
const secret = sha3_256.create().update(secretSeed).hex();
const proof = convert.uint8ToHex(secretSeed);

Expand Down Expand Up @@ -1304,7 +1304,7 @@ describe('TransactionHttp', () => {
return listener.close();
});
it('aggregate', (done) => {
const secretSeed = nacl_catapult.randomBytes(20);
const secretSeed = Crypto.randomBytes(20);
const secret = sha3_256.create().update(secretSeed).hex();
const proof = convert.uint8ToHex(secretSeed);
const secretLockTransaction = SecretLockTransaction.create(
Expand Down Expand Up @@ -1352,7 +1352,7 @@ describe('TransactionHttp', () => {
return listener.close();
});
it('standalone', (done) => {
const secretSeed = nacl_catapult.randomBytes(20);
const secretSeed = Crypto.randomBytes(20);
const secret = keccak_256.create().update(secretSeed).hex();
const proof = convert.uint8ToHex(secretSeed);
const secretLockTransaction = SecretLockTransaction.create(
Expand Down Expand Up @@ -1396,7 +1396,7 @@ describe('TransactionHttp', () => {
return listener.close();
});
it('aggregate', (done) => {
const secretSeed = nacl_catapult.randomBytes(20);
const secretSeed = Crypto.randomBytes(20);
const secret = keccak_256.create().update(secretSeed).hex();
const proof = convert.uint8ToHex(secretSeed);
const secretLockTransaction = SecretLockTransaction.create(
Expand Down
2 changes: 2 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ export * from './src/infrastructure/infrastructure';
export * from './src/model/model';
export * from './src/service/service';
export * from './src/core/utils/utility';
export * from './src/core/format';
export * from './src/core/crypto';
Loading