revamped crypto, network, transaction

pull/21/head
Wen Zhang 5 years ago committed by Ganesha Upadhyaya
parent 95474d74fe
commit 3411de5cf8
  1. 27
      docs/README.md
  2. 9
      packages/harmony-contract/src/abi/abiCoder.ts
  3. 94
      packages/harmony-crypto/src/address.ts
  4. 62
      packages/harmony-crypto/src/errors.ts
  5. 1
      packages/harmony-crypto/src/keyTool.ts
  6. 8
      packages/harmony-crypto/src/keystore.ts
  7. 8
      packages/harmony-crypto/src/random.ts
  8. 49
      packages/harmony-network/src/messenger/messenger.ts
  9. 26
      packages/harmony-network/src/rpcMethod/rpc.ts
  10. 4
      packages/harmony-network/src/subscriptions/NewHeadersSub.ts
  11. 4
      packages/harmony-network/src/subscriptions/NewPendingTransactionsSub.ts
  12. 1
      packages/harmony-network/src/subscriptions/SyncingSub.ts
  13. 8
      packages/harmony-staking/src/stakingTransaction.ts
  14. 47
      packages/harmony-transaction/src/factory.ts
  15. 1
      packages/harmony-transaction/src/shardingTransaction.ts
  16. 110
      packages/harmony-transaction/src/transaction.ts
  17. 84
      packages/harmony-transaction/src/types.ts

@ -32,32 +32,13 @@ $ npm install --global typedoc
### Generate HTML
```
cd docs
typedoc --out ./account ../packages/harmony-account/ --ignoreCompilerErrors
typedoc --out ./contract ../packages/harmony-contract/ --ignoreCompilerErrors
typedoc --out ./core ../packages/harmony-core/ --ignoreCompilerErrors
typedoc --out ./crypto ../packages/harmony-crypto/ --ignoreCompilerErrors
typedoc --out ./network ../packages/harmony-network/ --ignoreCompilerErrors
typedoc --out ./staking ../packages/harmony-staking/ --ignoreCompilerErrors
typedoc --out ./transaction ../packages/harmony-transaction/ --ignoreCompilerErrors
typedoc --out ./utils ../packages/harmony-utils/ --ignoreCompilerErrors
$ cd docs
$ typedoc --out ./build ../packages/ --ignoreCompilerErrors --theme default --name Harmony_SDK_Doc --readme ../README.md
```
### Run a simpleHTTPServer to test it
```
$ python3 -m http.server 8000
```
Then View the documentation generated at http://localhost:8000
>http://localhost:8000/core/index.html
http://localhost:8000/account/index.html
http://localhost:8000/contract/index.html
http://localhost:8000/crypto/index.html
http://localhost:8000/network/index.html
http://localhost:8000/staking/index.html
http://localhost:8000/transaction/index.html
http://localhost:8000/utils/index.html
### See the generated doc at local
>open the `index.html` under the path `sdk/docs/build/index.html`
## Step 2: Deploy on AWS (harmony core only!)

@ -1,4 +1,13 @@
/**
* ## About this package
*
* `@harmony-js/contract` makes it easy to interact with smart contract on the Harmony Blockchain. This allows you to interact with smart contracts as if they were JavaScript objects.
*
* Develop can use this package to:
* - Interact with Smart Contracts
*
* ## How to use this package
*
* ## Harmony Smart Contract
* Create an Contract instance
* ```javascript

@ -8,25 +8,67 @@ import { isAddress, isBech32Address, isBech32TestNetAddress } from '@harmony-js/
import { toChecksumAddress } from './keyTool';
import { fromBech32, toBech32, HRP, tHRP } from './bech32';
/**
* ### How to use it?
*
* ```
* // Step 1: import the class
* const { HarmonyAddress } = require('@harmony-js/crypto');
*
* // Step 2: call functions
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const res = HarmonyAddress.isValidBech32(addr);
* console.log(res);
* ```
*/
export class HarmonyAddress {
// static validator
/**
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const res = HarmonyAddress.isValidBech32(addr);
* console.log(res);
* ```
*/
static isValidBasic(str: string) {
const toTest = new HarmonyAddress(str);
return toTest.raw === toTest.basic;
}
// static validator
/**
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const res = HarmonyAddress.isValidChecksum(addr);
* console.log(res);
* ```
*/
static isValidChecksum(str: string) {
const toTest = new HarmonyAddress(str);
return toTest.raw === toTest.checksum;
}
// static validator
/**
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const res = HarmonyAddress.isValidBech32(addr);
* console.log(res);
* ```
*/
static isValidBech32(str: string) {
const toTest = new HarmonyAddress(str);
return toTest.raw === toTest.bech32;
}
// static validator
/**
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const res = HarmonyAddress.isValidBech32TestNet(addr);
* console.log(res);
* ```
*/
static isValidBech32TestNet(str: string) {
const toTest = new HarmonyAddress(str);
return toTest.raw === toTest.bech32TestNet;
@ -34,16 +76,53 @@ export class HarmonyAddress {
raw: string;
basic: string;
/**
* get basicHex of the address
*
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const instance = new HarmonyAddress(addr);
* console.log(instance.basicHex);
* ```
*/
get basicHex() {
return `0x${this.basic}`;
}
/**
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const instance = new HarmonyAddress(addr);
* console.log(instance.checksum);
* ```
*/
get checksum() {
return toChecksumAddress(`0x${this.basic}`);
}
/**
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const instance = new HarmonyAddress(addr);
* console.log(instance.bech32);
* ```
*/
get bech32() {
return toBech32(this.basic, HRP);
}
/**
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const instance = new HarmonyAddress(addr);
* console.log(instance.bech32TestNet);
* ```
*/
get bech32TestNet() {
return toBech32(this.basic, tHRP);
}
@ -58,6 +137,13 @@ export class HarmonyAddress {
*
* @param addr string, the address
*
* @example
* ```
* const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
* const instance = new HarmonyAddress(addr);
* const res = instance.getBasic(addr);
* console.log(res)
* ```
*/
private getBasic(addr: string) {
const basicBool = isAddress(addr);

@ -1,4 +1,66 @@
/**
* ## About this package
*
* `@harmony-js/crypot` provides a series of functions to deal with keys
*
* ## How to use this package
*
* ### Create a Harmony Instance
* ```javascript
* const { Harmony } = require('@harmony-js/core');
* const { ChainID, ChainType } = require('@harmony-js/utils');
*
* const hmy = new Harmony(
* 'http://localhost:9500',
* {
* chainType: ChainType.Harmony,
* chainId: ChainID.HmyLocal,
* },
* );
* ```
*
* ### Some examples
*
* ```javascript
* // randomBytes
* const bytes = hmy.crypto.randomBytes(20);
* console.log(bytes)
*
* // encryptPhrase
* const myPhrase = hmy.wallet.newMnemonic();
* const pwd = '1234';
* hmy.crypto.encryptPhrase(myPhrase, pwd).then((value) => {
* console.log(value);
* })
*
* // decryptThePhrase
* hmy.crypto.encryptPhrase(myPhrase, pwd).then((keystore) => {
* hmy.crypto.decryptPhrase(JSON.parse(keystore), pwd).then((value) => {
* console.log(value);
* })
* })
*
* // generatePrivateKey
* const privateKey = hmy.crypto.generatePrivateKey();
* console.log(privateKey)
*
* // getPubkeyFromPrivateKey
* const publicKey = hmy.crypto.getPubkeyFromPrivateKey(privateKey);
* console.log(publicKey);
*
* // getAddressFromPrivateKey
* const address = hmy.crypto.getAddressFromPrivateKey(privateKey);
* console.log(address);
*
* // getAddressFromPublicKey
* const address = hmy.crypto.getAddressFromPublicKey(publicKey);
* console.log(address);
*
* // toChecksumAddress
* const checksumAddr = hmy.crypto.toChecksumAddress(address);
* console.log(checksumAddr);
* ```
*
* @packageDocumentation
* @module harmony-crypto
*/

@ -1,7 +1,6 @@
/**
* @packageDocumentation
* @module harmony-crypto
* @hidden
*/
import elliptic from 'elliptic';

@ -1,7 +1,6 @@
/**
* @packageDocumentation
* @module harmony-crypto
* @hidden
*/
import aes from 'aes-js';
@ -16,6 +15,7 @@ import { concat, hexToIntArray } from './bytes';
import { keccak256 } from './keccak256';
import { KDF, KDFParams, EncryptOptions, PBKDF2Params, ScryptParams, Keystore } from './types';
/** @hidden */
const DEFAULT_ALGORITHM = 'aes-128-ctr';
/**
@ -140,6 +140,9 @@ export const decrypt = async (keystore: Keystore, password: string): Promise<str
return decrypted;
};
/**
* encrypt Phrase
*/
export const encryptPhrase = async (
phrase: string,
password: string,
@ -189,6 +192,9 @@ export const encryptPhrase = async (
});
};
/**
* decrypt phrase
*/
export const decryptPhrase = async (keystore: Keystore, password: string): Promise<string> => {
const result = await decrypt(keystore, password);
return Buffer.from(result.replace('0x', ''), 'hex').toString();

@ -1,12 +1,12 @@
/**
* @packageDocumentation
* @ignore
* @module harmony-crypto
*/
/**
* @function randomBytes
* @description Uses JS-native CSPRNG to generate a specified number of bytes.
* NOTE: this method throws if no PRNG is available.
* Uses JS-native CSPRNG to generate a specified number of bytes.
* @NOTE
* this method throws if no PRNG is available.
* @param {Number} bytes bytes number to generate
* @return {String} ramdom hex string
*/

@ -21,11 +21,19 @@ export interface ShardingProvider {
}
/**
* @class Messenger
* @description Messenger instance
* @param {HttpProvider} provider HttpProvider
* @param {Object} config config object
* @return {Messenger} Messenger instance
* ## How to Create a Massage
* @example
* ```
* const { HttpProvider, Messenger } = require('@harmony-js/network');
* const { ChainType, ChainID } = require('@harmony-js/utils');
*
* // create a custom messenger
* const customMessenger = new Messenger(
* new HttpProvider('http://localhost:9500'),
* ChainType.Harmony, // if you are connected to Harmony's blockchain
* ChainID.HmyLocal, // check if the chainId is correct
* )
* ```
*/
class Messenger extends HarmonyCore {
provider: HttpProvider | WSProvider;
@ -79,13 +87,27 @@ class Messenger extends HarmonyCore {
this.shardProviders = new Map();
// this.setShardingProviders();
}
/**
* @example
* ```
* customMessenger.currentShard
* ```
*/
get currentShard(): number {
return this.getCurrentShardID() || this.defaultShardID || 0;
}
/**
* @example
* ```
* customMessenger.shardCount
* ```
*/
get shardCount(): number {
return this.shardProviders.size;
}
/**
* @function send
* @memberof Messenger.prototype
@ -157,6 +179,7 @@ class Messenger extends HarmonyCore {
* @memberof Messenger
* @param {any} middleware - middle ware for req
* @param {String} method - method name
* @hidden
*/
setReqMiddleware(middleware: any, method = '*', provider: HttpProvider | WSProvider) {
provider.middlewares.request.use(middleware, method);
@ -168,6 +191,7 @@ class Messenger extends HarmonyCore {
* @memberof Messenger
* @param {any} middleware - middle ware for req
* @param {String} method - method name
* @hidden
*/
setResMiddleware(middleware: any, method = '*', provider: HttpProvider | WSProvider) {
provider.middlewares.response.use(middleware, method);
@ -290,6 +314,13 @@ class Messenger extends HarmonyCore {
return;
}
}
/**
* @example
* ```
* hmy.messenger.getShardProvider()
* ```
*/
getShardProvider(shardID: number): HttpProvider | WSProvider {
const provider = this.shardProviders.get(shardID);
if (provider) {
@ -299,6 +330,14 @@ class Messenger extends HarmonyCore {
}
return this.provider;
}
/**
* @example
* ```
* hmy.messenger.getCurrentShardID()
* ```
*/
getCurrentShardID() {
for (const shard of this.shardProviders) {
if (

@ -1,9 +1,33 @@
/**
* ## About this package
*
* `@harmony-js/network` provides functions to handle messenger, providers and subscriptions...
*
* Develop can use this package to:
* - messenger
* - providers
* - subscription
*
* ## How to use this package
*
* ### 1. Create a Message
* ```javascript
* const { HttpProvider, Messenger } = require('@harmony-js/network');
* const { ChainType, ChainID } = require('@harmony-js/utils');
*
* // create a custom messenger
* const customMessenger = new Messenger(
* new HttpProvider('http://localhost:9500'),
* ChainType.Harmony, // if you are connected to Harmony's blockchain
* ChainID.HmyLocal, // check if the chainId is correct
* )
* ```
*
* @packageDocumentation
* @module harmony-network
*/
/**@ignore */
/**@ignore */
export const enum RPCMethod {
// 1. hmy_getBlockByHash
GetBlockByHash = 'hmy_getBlockByHash',

@ -6,6 +6,10 @@
import { Messenger } from '../messenger/messenger';
import { SubscriptionMethod } from './Subscription';
/**
* ### Description:
* Subscribes to incoming block headers. This can be used as timer to check for changes on the blockchain.
*/
export class NewHeaders extends SubscriptionMethod {
constructor(messenger: Messenger, shardID: number = 0) {
super('newHeads', undefined, messenger, shardID);

@ -6,6 +6,10 @@
import { Messenger } from '../messenger/messenger';
import { SubscriptionMethod } from './Subscription';
/**
* ### Description:
* Subscribes to incoming pending transactions
*/
export class NewPendingTransactions extends SubscriptionMethod {
constructor(messenger: Messenger, shardID: number = 0) {
super('newPendingTransactions', undefined, messenger, shardID);

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-network
* @hidden
*/
import { Messenger } from '../messenger/messenger';

@ -36,6 +36,7 @@ export const enum Directive {
DirectiveCollectRewards,
}
/** @hidden */
export class StakingTransaction extends TransactionBase {
private directive: Directive;
private stakeMsg: CreateValidator | EditValidator | Delegate | Undelegate | CollectRewards;
@ -208,6 +209,7 @@ export class StakingTransaction extends TransactionBase {
}
}
/** @hidden */
export class Description {
name: string;
identity: string;
@ -300,6 +302,7 @@ export class Decimal {
}
}
/** @hidden */
export class CommissionRate {
rate: Decimal;
maxRate: Decimal;
@ -319,6 +322,7 @@ export class CommissionRate {
}
}
/** @hidden */
export class CreateValidator {
validatorAddress: string;
description: Description;
@ -366,6 +370,7 @@ export class CreateValidator {
}
}
/** @hidden */
export class EditValidator {
validatorAddress: string;
description: Description;
@ -404,6 +409,7 @@ export class EditValidator {
}
}
/** @hidden */
export class Delegate {
delegatorAddress: string;
validatorAddress: string;
@ -422,6 +428,7 @@ export class Delegate {
}
}
/** @hidden */
export class Undelegate {
delegatorAddress: string;
validatorAddress: string;
@ -440,6 +447,7 @@ export class Undelegate {
}
}
/** @hidden */
export class CollectRewards {
delegatorAddress: string;
constructor(delegatorAddress: string) {

@ -1,4 +1,6 @@
/**
* ## hhahaha
*
* @packageDocumentation
* @module harmony-transaction
*/
@ -25,6 +27,30 @@ export class TransactionFactory {
this.messenger = messenger;
}
/**
* Create a new Transaction
* @params
* ```
* // to: Address of the receiver
* // value: value transferred in wei
* // gasLimit: the maximum gas would pay, can use string
* // shardID: send token from shardID
* // toShardId: send token to shardID
* // gasPrice: you can use Unit class, and use Gwei, then remember to use toWei(), which will be transformed to BN
* ```
*
* @example
* ```javascript
* const txn = hmy.transactions.newTx({
* to: 'one166axnkjmghkf3df7xfvd0hn4dft8kemrza4cd2',
* value: '10000',
* gasLimit: '210000',
* shardID: 0,
* toShardID: 0,
* gasPrice: new hmy.utils.Unit('100').asGwei().toWei(),
* });
* ```
*/
newTx(txParams?: TxParams | any, sharding: boolean = false): Transaction {
if (!sharding) {
return new Transaction(txParams, this.messenger, TxStatus.INTIALIZED);
@ -32,10 +58,31 @@ export class TransactionFactory {
return new ShardingTransaction(txParams, this.messenger, TxStatus.INTIALIZED);
}
/**
* clone the transaction
*
* @param transaction
*
* @example
* ```javascript
* const cloneTxn = hmy.transactions.clone(txn);
* console.log(cloneTxn)
* ```
*/
clone(transaction: Transaction): Transaction {
return new Transaction(transaction.txParams, this.messenger, TxStatus.INTIALIZED);
}
/**
*
* @example
* ```javascript
* txHash = '0xf8698085174876e8008252088080949d72989b68777a1f3ffd6f1db079f1928373ee52830186a08027a0ab8229ff5d5240948098f26372eaed9ab2e9be23e8594b08e358ca56a47f8ae9a0084e5c4d1fec496af444423d8a714f65c079260ff01a1be1de7005dd424adf44'
*
* const recoverTx = hmy.transactions.recover(txHash);
* console.log(recoverTx);
* ```
*/
recover(txHash: string): Transaction {
const newTxn = new Transaction({}, this.messenger, TxStatus.INTIALIZED);
newTxn.recover(txHash);

@ -1,6 +1,7 @@
/**
* @packageDocumentation
* @module harmony-transaction
* @hidden
*/
import { Messenger } from '@harmony-js/network';

@ -26,21 +26,53 @@ import {
import { TransactionBase } from './transactionBase';
class Transaction extends TransactionBase {
/** @hidden */
private from: string;
/** @hidden */
private nonce: number | string;
/** @hidden */
private to: string;
// private shardID: number | string;
/** @hidden */
private toShardID: number | string;
/** @hidden */
private gasLimit: BN;
/** @hidden */
private gasPrice: BN;
/** @hidden */
private data: string;
/** @hidden */
private value: BN;
/** @hidden */
private chainId: number;
/** @hidden */
private rawTransaction: string;
/** @hidden */
private unsignedRawTransaction: string;
/** @hidden */
private signature: Signature;
// constructor
/**
*
* @Params
* ```javascript
* id: string;
from: string;
to: string;
nonce: number | string;
gasLimit: number | string | BN;
gasPrice: number | string | BN;
shardID: number | string;
toShardID: number | string;
data: string;
value: number | string | BN;
chainId: number;
rawTransaction: string;
unsignedRawTransaction: string;
signature: Signature;
receipt?: TransasctionReceipt;
* ```
*/
constructor(
params?: TxParams | any,
messenger: Messenger = defaultMessenger,
@ -87,6 +119,14 @@ class Transaction extends TransactionBase {
this.cxStatus = this.isCrossShard() ? TxStatus.INTIALIZED : TxStatus.NONE;
}
/**
*
* @example
* ```javascript
* const unsigned = txn.getRLPUnsigned(txn);
* console.log(unsigned);
* ```
*/
getRLPUnsigned(): [string, any[]] {
const raw: Array<string | Uint8Array> = [];
@ -143,10 +183,17 @@ class Transaction extends TransactionBase {
return encode(raw);
}
/**
* @example
* ```javascript
* console.log(txn.getRawTransaction());
* ```
*/
getRawTransaction(): string {
return this.rawTransaction;
}
/** @hidden */
recover(rawTransaction: string): Transaction {
// temp setting to be compatible with eth
const recovered =
@ -157,7 +204,16 @@ class Transaction extends TransactionBase {
this.setParams(recovered);
return this;
}
// use when using eth_sendTransaction
/**
* get the payload of transaction
*
* @example
* ```
* const payload = txn.txPayload;
* console.log(payload);
* ```
*/
get txPayload() {
return {
from: this.txParams.from || '0x',
@ -172,6 +228,15 @@ class Transaction extends TransactionBase {
};
}
/**
* get transaction params
*
* @example
* ```
* const txParams = txn.txParams;
* console.log(txParams)
* ```
*/
get txParams(): TxParams {
return {
id: this.id || '0x',
@ -190,6 +255,28 @@ class Transaction extends TransactionBase {
signature: this.signature || '0x',
};
}
/**
* set the params to the txn
*
* @example
* ```
* txn.setParams({
* to: 'one1ew56rqrucu6p6n598fmjmnfh8dd4xpg6atne9c',
* value: '1200',
* gasLimit: '230000',
* shardID: 1,
* toShardID: 0,
* gasPrice: new hmy.utils.Unit('101').asGwei().toWei(),
* signature: {
* r: '0xd693b532a80fed6392b428604171fb32fdbf953728a3a7ecc7d4062b1652c042',
* s: '0x24e9c602ac800b983b035700a14b23f78a253ab762deab5dc27e3555a750b354',
* v: 0
* },
* });
* console.log(txn);
* ```
*/
setParams(params: TxParams) {
this.id = params && params.id ? params.id : '0x';
this.from = params && params.from ? params.from : '0x';
@ -230,6 +317,7 @@ class Transaction extends TransactionBase {
}
}
/** @hidden */
map(fn: any) {
const newParams = fn(this.txParams);
this.setParams(newParams);
@ -237,10 +325,28 @@ class Transaction extends TransactionBase {
return this;
}
/**
* Check whether the transaction is cross shard
*
* @example
* ```javascript
* console.log(txn.isCrossShard());
* ```
*/
isCrossShard(): boolean {
return new BN(this.txParams.shardID).toString() !== new BN(this.txParams.toShardID).toString();
}
/**
*
* @example
* ```
* txn.sendTransaction().then((value) => {
* console.log(value);
* });
* ```
*/
async sendTransaction(): Promise<[Transaction, string]> {
if (this.rawTransaction === 'tx' || this.rawTransaction === undefined) {
throw new Error('Transaction not signed');

@ -1,11 +1,91 @@
/**
* ## About this package
*
* `@harmony-js/transaction` provides the functions to build transactions
*
* Develop can use this package to:
* - build a transaction offline!
* - set params of transaction
* -
*
* ## How to use this package
* ### Step 1: create a Harmony Instance
* ```javascript
* const { Harmony } = require('@harmony-js/core');
* const { ChainID, ChainType } = require('@harmony-js/utils');
* const { BN } = require('@harmony-js/crypto');
*
* const hmy = new Harmony(
* 'http://localhost:9500',
* {
* chainType: ChainType.Harmony,
* chainId: ChainID.HmyLocal,
* },
* );
* ```
*
* ### Step 2: build a transaction
* ```javascript
* const txn = hmy.transactions.newTx({
* to: 'one166axnkjmghkf3df7xfvd0hn4dft8kemrza4cd2',
* value: '10000',
* gasLimit: '210000',
* shardID: 0,
* toShardID: 0,
* gasPrice: new hmy.utils.Unit('100').asGwei().toWei(),
* });
* ```
*
* ## some important information
* Transaction Parameters
* ```java
* // interface TxParams
* id: string;
* from: string;
* to: string;
* nonce: number | string;
* gasLimit: number | string | BN;
* gasPrice: number | string | BN;
* shardID: number | string;
* toShardID: number | string;
* data: string;
* value: number | string | BN;
* chainId: number;
* rawTransaction: string;
* unsignedRawTransaction: string;
* signature: Signature;
* receipt?: TransasctionReceipt;
* ```
*
* Transaction Receipt
* ```java
* // interface TransasctionReceipt
* transactionHash: string;
* transactionIndex: string;
* blockHash: string;
* blockNumber: string; // 11
* from: string;
* to: string;
* gasUsed: string;
* cumulativeGasUsed: string; // 13244
* contractAddress?: string | null; // or null, if none was created
* logs: any[];
* logsBloom: string; // 256 byte bloom filter
* v: string;
* r: string;
* s: string;
* responseType?: string;
* byzantium?: boolean;
* status?: string; // post Byzantium will return `0x0` or `0x1`
* root?: string; // pre Byzantium will return `root`
* ```
*
* @packageDocumentation
* @module harmony-transaction
*/
import { BN, Signature } from '@harmony-js/crypto';
/** @hidden */
export interface TxParams {
id: string;
from: string;
@ -24,7 +104,6 @@ export interface TxParams {
receipt?: TransasctionReceipt;
}
/** @hidden */
export const enum TxStatus {
NONE = 'NONE',
INTIALIZED = 'INITIALIZED',
@ -34,7 +113,6 @@ export const enum TxStatus {
REJECTED = 'REJECTED',
}
/** @hidden */
export interface TransasctionReceipt {
transactionHash: string;
transactionIndex: string;

Loading…
Cancel
Save