@harmony-js/transaction
Advanced tools
Comparing version 0.0.37 to 0.0.38
@@ -18,2 +18,3 @@ /// <reference types="bn.js" /> | ||
private shardID; | ||
private toShardID; | ||
private gasLimit; | ||
@@ -36,2 +37,3 @@ private gasPrice; | ||
shardID: string; | ||
toShardID: string; | ||
gas: string; | ||
@@ -38,0 +40,0 @@ gasPrice: string; |
@@ -26,2 +26,3 @@ "use strict"; | ||
this.shardID = params ? params.shardID : 0; | ||
this.toShardID = params ? params.toShardID : 0; | ||
// this.to= params ? params.to:'0x'; | ||
@@ -112,2 +113,3 @@ this.to = params ? this.normalizeAddress(params.to) : '0x'; | ||
shardID: this.txParams.shardID ? utils_1.numberToHex(this.shardID) : '0x', | ||
toShardID: this.txParams.toShardID ? utils_1.numberToHex(this.toShardID) : '0x', | ||
gas: this.txParams.gasLimit ? utils_1.numberToHex(this.txParams.gasLimit) : '0x', | ||
@@ -134,3 +136,3 @@ gasPrice: this.txParams.gasPrice | ||
shardID: this.shardID || 0, | ||
// to: this.to || '0x', | ||
toShardID: this.toShardID || 0, | ||
to: this.normalizeAddress(this.to) || '0x', | ||
@@ -155,2 +157,3 @@ value: this.value || new crypto_1.BN(0), | ||
this.shardID = params ? params.shardID : 0; | ||
this.toShardID = params ? params.toShardID : 0; | ||
// this.to = params ? params.to : '0x'; | ||
@@ -157,0 +160,0 @@ this.to = params ? this.normalizeAddress(params.to) : '0x'; |
@@ -11,2 +11,3 @@ /// <reference types="bn.js" /> | ||
shardID: number | string; | ||
toShardID: number | string; | ||
data: string; | ||
@@ -13,0 +14,0 @@ value: BN; |
@@ -13,2 +13,3 @@ "use strict"; | ||
{ name: 'shardID', length: 16, fix: false }, | ||
{ name: 'toShardID', length: 16, fix: false }, | ||
{ name: 'to', length: 20, fix: true }, | ||
@@ -50,3 +51,3 @@ { name: 'value', length: 32, fix: false, transform: 'hex' }, | ||
var transaction = crypto_1.decode(rawTransaction); | ||
if (transaction.length !== 10 && transaction.length !== 7) { | ||
if (transaction.length !== 11 && transaction.length !== 8) { | ||
throw new Error('invalid rawTransaction'); | ||
@@ -63,5 +64,6 @@ } | ||
shardID: new crypto_1.BN(utils_1.strip0x(exports.handleNumber(transaction[3]))).toNumber(), | ||
to: exports.handleAddress(transaction[4]), | ||
value: new crypto_1.BN(utils_1.strip0x(exports.handleNumber(transaction[5]))), | ||
data: transaction[6], | ||
toShardID: new crypto_1.BN(utils_1.strip0x(exports.handleNumber(transaction[4]))).toNumber(), | ||
to: exports.handleAddress(transaction[5]), | ||
value: new crypto_1.BN(utils_1.strip0x(exports.handleNumber(transaction[6]))), | ||
data: transaction[7], | ||
chainId: 0, | ||
@@ -76,3 +78,3 @@ signature: { | ||
// Legacy unsigned transaction | ||
if (transaction.length === 7) { | ||
if (transaction.length === 8) { | ||
tx.unsignedTxnHash = rawTransaction; | ||
@@ -82,3 +84,3 @@ return tx; | ||
try { | ||
tx.signature.v = new crypto_1.BN(utils_1.strip0x(exports.handleNumber(transaction[7]))).toNumber(); | ||
tx.signature.v = new crypto_1.BN(utils_1.strip0x(exports.handleNumber(transaction[8]))).toNumber(); | ||
} | ||
@@ -88,4 +90,4 @@ catch (error) { | ||
} | ||
tx.signature.r = crypto_1.hexZeroPad(transaction[8], 32); | ||
tx.signature.s = crypto_1.hexZeroPad(transaction[9], 32); | ||
tx.signature.r = crypto_1.hexZeroPad(transaction[9], 32); | ||
tx.signature.s = crypto_1.hexZeroPad(transaction[10], 32); | ||
if (new crypto_1.BN(utils_1.strip0x(exports.handleNumber(tx.signature.r))).isZero() && | ||
@@ -104,3 +106,3 @@ new crypto_1.BN(utils_1.strip0x(exports.handleNumber(tx.signature.s))).isZero()) { | ||
var recoveryParam = tx.signature.v - 27; | ||
var raw = transaction.slice(0, 7); | ||
var raw = transaction.slice(0, 8); | ||
if (tx.chainId !== 0) { | ||
@@ -141,2 +143,3 @@ raw.push(crypto_1.hexlify(tx.chainId)); | ||
shardID: 0, | ||
toShardID: 0, | ||
to: exports.handleAddress(transaction[3]), | ||
@@ -143,0 +146,0 @@ value: new crypto_1.BN(utils_1.strip0x(exports.handleNumber(transaction[4]))), |
{ | ||
"name": "@harmony-js/transaction", | ||
"version": "0.0.37", | ||
"version": "0.0.38", | ||
"description": "transaction package for harmony", | ||
@@ -21,8 +21,8 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@harmony-js/core": "0.0.37", | ||
"@harmony-js/crypto": "0.0.37", | ||
"@harmony-js/network": "0.0.37", | ||
"@harmony-js/utils": "0.0.37" | ||
"@harmony-js/core": "0.0.38", | ||
"@harmony-js/crypto": "0.0.38", | ||
"@harmony-js/network": "0.0.38", | ||
"@harmony-js/utils": "0.0.38" | ||
}, | ||
"gitHead": "7b9d69186d577819a322605296f13ffdcbbde078" | ||
"gitHead": "756dd6e965294c1a2ff4d9d69637173483012b65" | ||
} |
@@ -46,2 +46,3 @@ import { | ||
private shardID: number | string; | ||
private toShardID: number | string; | ||
private gasLimit: BN; | ||
@@ -73,2 +74,3 @@ private gasPrice: BN; | ||
this.shardID = params ? params.shardID : 0; | ||
this.toShardID = params ? params.toShardID : 0; | ||
@@ -178,2 +180,3 @@ // this.to= params ? params.to:'0x'; | ||
shardID: this.txParams.shardID ? numberToHex(this.shardID) : '0x', | ||
toShardID: this.txParams.toShardID ? numberToHex(this.toShardID) : '0x', | ||
gas: this.txParams.gasLimit ? numberToHex(this.txParams.gasLimit) : '0x', | ||
@@ -197,3 +200,3 @@ gasPrice: this.txParams.gasPrice | ||
shardID: this.shardID || 0, | ||
// to: this.to || '0x', | ||
toShardID: this.toShardID || 0, | ||
to: this.normalizeAddress(this.to) || '0x', | ||
@@ -215,2 +218,3 @@ value: this.value || new BN(0), | ||
this.shardID = params ? params.shardID : 0; | ||
this.toShardID = params ? params.toShardID : 0; | ||
// this.to = params ? params.to : '0x'; | ||
@@ -217,0 +221,0 @@ this.to = params ? this.normalizeAddress(params.to) : '0x'; |
@@ -10,2 +10,3 @@ import { BN, Signature } from '@harmony-js/crypto'; | ||
shardID: number | string; | ||
toShardID: number | string; | ||
data: string; | ||
@@ -12,0 +13,0 @@ value: BN; |
@@ -28,2 +28,3 @@ import { | ||
{ name: 'shardID', length: 16, fix: false }, | ||
{ name: 'toShardID', length: 16, fix: false }, | ||
{ name: 'to', length: 20, fix: true }, | ||
@@ -65,3 +66,3 @@ { name: 'value', length: 32, fix: false, transform: 'hex' }, | ||
const transaction = decode(rawTransaction); | ||
if (transaction.length !== 10 && transaction.length !== 7) { | ||
if (transaction.length !== 11 && transaction.length !== 8) { | ||
throw new Error('invalid rawTransaction'); | ||
@@ -79,5 +80,6 @@ } | ||
shardID: new BN(strip0x(handleNumber(transaction[3]))).toNumber(), | ||
to: handleAddress(transaction[4]), | ||
value: new BN(strip0x(handleNumber(transaction[5]))), | ||
data: transaction[6], | ||
toShardID: new BN(strip0x(handleNumber(transaction[4]))).toNumber(), | ||
to: handleAddress(transaction[5]), | ||
value: new BN(strip0x(handleNumber(transaction[6]))), | ||
data: transaction[7], | ||
chainId: 0, | ||
@@ -93,3 +95,3 @@ signature: { | ||
// Legacy unsigned transaction | ||
if (transaction.length === 7) { | ||
if (transaction.length === 8) { | ||
tx.unsignedTxnHash = rawTransaction; | ||
@@ -100,3 +102,3 @@ return tx; | ||
try { | ||
tx.signature.v = new BN(strip0x(handleNumber(transaction[7]))).toNumber(); | ||
tx.signature.v = new BN(strip0x(handleNumber(transaction[8]))).toNumber(); | ||
} catch (error) { | ||
@@ -106,4 +108,4 @@ throw error; | ||
tx.signature.r = hexZeroPad(transaction[8], 32); | ||
tx.signature.s = hexZeroPad(transaction[9], 32); | ||
tx.signature.r = hexZeroPad(transaction[9], 32); | ||
tx.signature.s = hexZeroPad(transaction[10], 32); | ||
@@ -127,3 +129,3 @@ if ( | ||
const raw = transaction.slice(0, 7); | ||
const raw = transaction.slice(0, 8); | ||
@@ -169,2 +171,3 @@ if (tx.chainId !== 0) { | ||
shardID: 0, | ||
toShardID: 0, | ||
to: handleAddress(transaction[3]), | ||
@@ -171,0 +174,0 @@ value: new BN(strip0x(handleNumber(transaction[4]))), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
452827
5042
+ Added@harmony-js/account@0.0.38(transitive)
+ Added@harmony-js/contract@0.0.38(transitive)
+ Added@harmony-js/core@0.0.38(transitive)
+ Added@harmony-js/crypto@0.0.38(transitive)
+ Added@harmony-js/network@0.0.38(transitive)
+ Added@harmony-js/utils@0.0.38(transitive)
- Removed@harmony-js/account@0.0.37(transitive)
- Removed@harmony-js/contract@0.0.37(transitive)
- Removed@harmony-js/core@0.0.37(transitive)
- Removed@harmony-js/crypto@0.0.37(transitive)
- Removed@harmony-js/network@0.0.37(transitive)
- Removed@harmony-js/utils@0.0.37(transitive)
Updated@harmony-js/core@0.0.38
Updated@harmony-js/crypto@0.0.38
Updated@harmony-js/network@0.0.38
Updated@harmony-js/utils@0.0.38