fix(transaction):modify tx.data.length to 11 when chainType is harmony

staking
neeboo 5 years ago
parent 9cfa811ee4
commit 51b6dd8621
  1. 3
      packages/harmony-account/src/utils.ts
  2. 2
      packages/harmony-core/src/truffleProvider.ts
  3. 2
      packages/harmony-transaction/src/transaction.ts
  4. 8
      packages/harmony-utils/src/chain.ts
  5. 16
      scripts/jest/jest.src.config.js

@ -1,7 +1,8 @@
import { HttpProvider, Messenger } from '@harmony-js/network';
import { ChainType } from '@harmony-js/utils';
import { ChainType, ChainID } from '@harmony-js/utils';
export const defaultMessenger = new Messenger(
new HttpProvider('http://localhost:9500'),
ChainType.Harmony,
ChainID.HmyLocal,
);

@ -42,7 +42,7 @@ export class TruffleProvider extends HDNode {
chainOptions: ChainOptions = {
shardID: 0,
chainType: ChainType.Harmony,
chainId: ChainID.Default,
chainId: ChainID.HmyLocal,
},
transactionOptions: TransactionOptions = {
gasLimit: '10000000',

@ -146,7 +146,7 @@ class Transaction {
getRLPSigned(raw: any[], signature: Signature): string {
// temp setting to be compatible with eth
const rawLength = this.messenger.chainType === ChainType.Harmony ? 10 : 9;
const rawLength = this.messenger.chainType === ChainType.Harmony ? 11 : 9;
const sig = splitSignature(signature);
let v = 27 + (sig.recoveryParam || 0);
if (raw.length === rawLength) {

@ -16,17 +16,21 @@ export const enum ChainID {
EtcTestnet = 62,
Geth = 1337,
Ganache = 0,
HmyMainnet = 1,
HmyTestnet = 2,
HmyLocal = 2,
HmyPangaea = 3,
}
export const defaultConfig = {
Default: {
Chain_ID: ChainID.Default,
Chain_ID: ChainID.HmyLocal,
Chain_Type: ChainType.Harmony,
Chain_URL: 'http://localhost:9500',
Network_ID: 'Local',
},
DefaultWS: {
Chain_ID: ChainID.Default,
Chain_ID: ChainID.HmyLocal,
Chain_Type: ChainType.Harmony,
Chain_URL: 'ws://localhost:9800',
Network_ID: 'LocalWS',

@ -25,10 +25,10 @@ const config = {
testURL: 'http://localhost',
coverageThreshold: {
global: {
branches: 15,
functions: 15,
lines: 15,
statements: 15,
branches: 10,
functions: 10,
lines: 10,
statements: 10,
},
},
rootDir: process.cwd(),
@ -42,15 +42,11 @@ const config = {
],
timers: 'fake',
setupFiles: ['<rootDir>/scripts/jest/jest.setup.js'],
setupTestFrameworkScriptFile:
'<rootDir>/scripts/jest/jest.framework-setup.js',
setupTestFrameworkScriptFile: '<rootDir>/scripts/jest/jest.framework-setup.js',
testEnvironment: process.env.NODE_ENV === 'development' ? 'node' : 'jsdom',
collectCoverage: true,
automock: false,
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
};
module.exports = config;

Loading…
Cancel
Save