Compare commits
1 Commits
dependabot
...
master
Author | SHA1 | Date |
---|---|---|
nico | 18da2be63d | 9 months ago |
@ -1,31 +1,31 @@ |
|||||||
import fetch from 'jest-fetch-mock'; |
import fetch from 'jest-fetch-mock'; |
||||||
// tslint:disable-next-line: no-implicit-dependencies
|
// tslint:disable-next-line: no-implicit-dependencies
|
||||||
import { Harmony } from '@harmony-js/core'; |
import { Woop } from '@woop-js/core'; |
||||||
// tslint:disable-next-line: no-implicit-dependencies
|
// tslint:disable-next-line: no-implicit-dependencies
|
||||||
import { ChainType } from '@harmony-js/utils'; |
import { ChainType } from '@woop-js/utils'; |
||||||
// tslint:disable-next-line: no-implicit-dependencies
|
// tslint:disable-next-line: no-implicit-dependencies
|
||||||
import { Account } from '@harmony-js/account'; |
import { Account } from '@woop-js/account'; |
||||||
|
|
||||||
const CHAIN_ID: number = 2; |
const CHAIN_ID: number = 2; |
||||||
const CHAIN_TYPE: string = 'hmy'; |
const CHAIN_TYPE: string = 'wiki'; |
||||||
const HTTP_PROVIDER: string = 'http://localhost:9500'; |
const HTTP_PROVIDER: string = 'http://localhost:9500'; |
||||||
const GENESIS_PRIV_KEY: string = '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'; |
const GENESIS_PRIV_KEY: string = '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'; |
||||||
|
|
||||||
let chainType: ChainType = ChainType.Harmony; |
let chainType: ChainType = ChainType.Woop; |
||||||
|
|
||||||
if (CHAIN_TYPE === 'hmy') { |
if (CHAIN_TYPE === 'wiki') { |
||||||
chainType = ChainType.Harmony; |
chainType = ChainType.Woop; |
||||||
} else if (CHAIN_TYPE === 'eth') { |
} else if (CHAIN_TYPE === 'eth') { |
||||||
chainType = ChainType.Ethereum; |
chainType = ChainType.Ethereum; |
||||||
} |
} |
||||||
|
|
||||||
export const harmony: Harmony = new Harmony(HTTP_PROVIDER, { |
export const woop: Woop = new Woop(HTTP_PROVIDER, { |
||||||
chainId: CHAIN_ID, |
chainId: CHAIN_ID, |
||||||
chainType, |
chainType, |
||||||
chainUrl: HTTP_PROVIDER, |
chainUrl: HTTP_PROVIDER, |
||||||
}); |
}); |
||||||
|
|
||||||
export const myAccount: Account = harmony.wallet.addByPrivateKey( |
export const myAccount: Account = woop.wallet.addByPrivateKey( |
||||||
GENESIS_PRIV_KEY, |
GENESIS_PRIV_KEY, |
||||||
); |
); |
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@ |
|||||||
# Packages available are: |
# Packages available are: |
||||||
|
|
||||||
1. [@harmony-js/core](https://github.com/harmony-one/sdk/tree/master/packages/harmony-core) |
1. [@woop-js/core](https://github.com/woop-chain/sdk/tree/master/packages/woop-core) |
||||||
2. [@harmony-js/account](https://github.com/harmony-one/sdk/tree/master/packages/harmony-account) |
2. [@woop-js/account](https://github.com/woop-chain/sdk/tree/master/packages/woop-account) |
||||||
3. [@harmony-js/crypto](https://github.com/harmony-one/sdk/tree/master/packages/harmony-crypto) |
3. [@woop-js/crypto](https://github.com/woop-chain/sdk/tree/master/packages/woop-crypto) |
||||||
4. [@harmony-js/network](https://github.com/harmony-one/sdk/tree/master/packages/harmony-network) |
4. [@woop-js/network](https://github.com/woop-chain/sdk/tree/master/packages/woop-network) |
||||||
5. [@harmony-js/utils](https://github.com/harmony-one/sdk/tree/master/packages/harmony-utils) |
5. [@woop-js/utils](https://github.com/woop-chain/sdk/tree/master/packages/woop-utils) |
||||||
6. [@harmony-js/transaction](https://github.com/harmony-one/sdk/tree/master/packages/harmony-transaction) |
6. [@woop-js/transaction](https://github.com/woop-chain/sdk/tree/master/packages/woop-transaction) |
||||||
7. [@harmony-js/contract](https://github.com/harmony-one/sdk/tree/master/packages/harmony-contract) |
7. [@woop-js/contract](https://github.com/woop-chain/sdk/tree/master/packages/woop-contract) |
||||||
8. [@harmony-js/staking](https://github.com/harmony-one/sdk/tree/master/packages/harmony-staking) |
8. [@woop-js/staking](https://github.com/woop-chain/sdk/tree/master/packages/woop-staking) |
||||||
|
|
||||||
<mark>Package level documentation and examples are inside each package</mark> |
<mark>Package level documentation and examples are inside each package</mark> |
@ -1,14 +0,0 @@ |
|||||||
/** |
|
||||||
* @packageDocumentation |
|
||||||
* @module harmony-account |
|
||||||
* @hidden |
|
||||||
*/ |
|
||||||
|
|
||||||
import { HttpProvider, Messenger } from '@harmony-js/network'; |
|
||||||
import { ChainType, ChainID } from '@harmony-js/utils'; |
|
||||||
|
|
||||||
export const defaultMessenger = new Messenger( |
|
||||||
new HttpProvider('http://localhost:9500'), |
|
||||||
ChainType.Harmony, |
|
||||||
ChainID.HmyLocal, |
|
||||||
); |
|
@ -1,30 +0,0 @@ |
|||||||
{ |
|
||||||
"name": "@harmony-js/core", |
|
||||||
"version": "0.1.58", |
|
||||||
"description": "harmony core package", |
|
||||||
"main": "dist/index.js", |
|
||||||
"node": "dist/index.js", |
|
||||||
"browser": "dist/index.js", |
|
||||||
"module": "dist/index.esm.js", |
|
||||||
"jsnext:main": "dist/index.esm.js", |
|
||||||
"typings": "dist/index.d.ts", |
|
||||||
"types": "dist/index.d.ts", |
|
||||||
"scripts": { |
|
||||||
"test": "echo \"Error: no test specified\" && exit 1" |
|
||||||
}, |
|
||||||
"publishConfig": { |
|
||||||
"access": "public" |
|
||||||
}, |
|
||||||
"author": "neeboo@firestack.one", |
|
||||||
"license": "MIT", |
|
||||||
"dependencies": { |
|
||||||
"@harmony-js/account": "0.1.58", |
|
||||||
"@harmony-js/contract": "0.1.58", |
|
||||||
"@harmony-js/crypto": "0.1.58", |
|
||||||
"@harmony-js/network": "0.1.58", |
|
||||||
"@harmony-js/staking": "0.1.58", |
|
||||||
"@harmony-js/transaction": "0.1.58", |
|
||||||
"@harmony-js/utils": "0.1.58" |
|
||||||
}, |
|
||||||
"gitHead": "56606e9365721729a490c27d6a294e0daf90fbdf" |
|
||||||
} |
|
@ -1,31 +0,0 @@ |
|||||||
/** |
|
||||||
* @packageDocumentation |
|
||||||
* @module harmony-core |
|
||||||
* @hidden |
|
||||||
*/ |
|
||||||
|
|
||||||
import { HttpProvider, Messenger } from '@harmony-js/network'; |
|
||||||
import { TransactionFactory, Transaction } from '@harmony-js/transaction'; |
|
||||||
import { Wallet, Account } from '@harmony-js/account'; |
|
||||||
import { ChainType, ChainID } from '@harmony-js/utils'; |
|
||||||
import { Blockchain } from './blockchain'; |
|
||||||
|
|
||||||
export interface HarmonyModule { |
|
||||||
HttpProvider: HttpProvider; |
|
||||||
Messenger: Messenger; |
|
||||||
Blockchain: Blockchain; |
|
||||||
TransactionFactory: TransactionFactory; |
|
||||||
Wallet: Wallet; |
|
||||||
Transaction: Transaction; |
|
||||||
Account: Account; |
|
||||||
} |
|
||||||
|
|
||||||
export enum UrlType { |
|
||||||
http, |
|
||||||
ws, |
|
||||||
} |
|
||||||
|
|
||||||
export interface HarmonySetting<T extends ChainType, I extends ChainID> { |
|
||||||
type: T; |
|
||||||
id: I; |
|
||||||
} |
|
@ -1,16 +0,0 @@ |
|||||||
{ |
|
||||||
"extends": "../../tsconfig.base.json", |
|
||||||
"compilerOptions": { |
|
||||||
"rootDir": "src", |
|
||||||
"outDir": "dist" |
|
||||||
}, |
|
||||||
"include": ["src", "../../typings/**/*.d.ts", "../harmony-utils/src/core.ts"], |
|
||||||
"references": [ |
|
||||||
{"path": "../harmony-account"}, |
|
||||||
{"path": "../harmony-crypto"}, |
|
||||||
{"path": "../harmony-utils"}, |
|
||||||
{"path": "../harmony-network"}, |
|
||||||
{"path": "../harmony-transaction"}, |
|
||||||
{"path": "../harmony-contract"} |
|
||||||
] |
|
||||||
} |
|
@ -1,136 +0,0 @@ |
|||||||
/** |
|
||||||
# @harmony-js/network |
|
||||||
|
|
||||||
This package provides a collection of apis to create messengers (HTTP, WebSocket) to connect to blockchain networks. |
|
||||||
|
|
||||||
## Installation |
|
||||||
|
|
||||||
``` |
|
||||||
npm install @harmony-js/network |
|
||||||
``` |
|
||||||
|
|
||||||
## Usage |
|
||||||
|
|
||||||
```javascript
|
|
||||||
const { Messenger, HttpProvider, WSProvider } = require('@harmony-js/network'); |
|
||||||
const { ChainID, ChainType } = require('@harmony-js/utils'); |
|
||||||
const testnetHTTP = 'https://api.s0.b.hmny.io'; |
|
||||||
const testnetWS = 'wss://ws.s0.b.hmny.io'; |
|
||||||
const localHTTP = 'http://localhost:9500/'; |
|
||||||
const localWS = 'http://localhost:9800/'; |
|
||||||
const http = new HttpProvider(testnetHTTP); // for local use localHTTP
|
|
||||||
const ws = new WSProvider(testnetWS); // for local use testnetWS
|
|
||||||
const customHTTPMessenger = new Messenger(http, ChainType.Harmony, ChainID.HmyTestnet); // for local ChainID.HmyLocal
|
|
||||||
const customWSMessenger = new Messenger(ws, ChainType.Harmony, ChainID.HmyTestnet); // for local ChainID.HmyLocal
|
|
||||||
``` |
|
||||||
* |
|
||||||
* @packageDocumentation |
|
||||||
* @module harmony-network |
|
||||||
*/ |
|
||||||
|
|
||||||
/**@ignore */ |
|
||||||
export enum RPCMethod { |
|
||||||
// 1. hmy_getBlockByHash
|
|
||||||
GetBlockByHash = 'hmy_getBlockByHash', |
|
||||||
// 2. hmy_getBlockByNumber
|
|
||||||
GetBlockByNumber = 'hmy_getBlockByNumber', |
|
||||||
// 3. hmy_getBlockTransactionCountByHash
|
|
||||||
GetBlockTransactionCountByHash = 'hmy_getBlockTransactionCountByHash', |
|
||||||
// 4. hmy_getBlockTransactionCountByNumber
|
|
||||||
GetBlockTransactionCountByNumber = 'hmy_getBlockTransactionCountByNumber', |
|
||||||
// 5. hmy_getCode
|
|
||||||
GetCode = 'hmy_getCode', |
|
||||||
// 6. hmy_getTransactionByBlockHashAndIndex
|
|
||||||
GetTransactionByBlockHashAndIndex = 'hmy_getTransactionByBlockHashAndIndex', |
|
||||||
// 7. hmy_getTransactionByBlockNumberAndIndex
|
|
||||||
GetTransactionByBlockNumberAndIndex = 'hmy_getTransactionByBlockNumberAndIndex', |
|
||||||
// 8. hmy_getTransactionByHash
|
|
||||||
GetTransactionByHash = 'hmy_getTransactionByHash', |
|
||||||
|
|
||||||
GetTransactionReceipt = 'hmy_getTransactionReceipt', |
|
||||||
|
|
||||||
GetCXReceiptByHash = 'hmy_getCXReceiptByHash', |
|
||||||
// 9. hmy_syncing
|
|
||||||
Syncing = 'hmy_syncing', |
|
||||||
// 10. net_peerCount
|
|
||||||
PeerCount = 'net_peerCount', |
|
||||||
|
|
||||||
// 11. hmy_getBalance
|
|
||||||
GetBalance = 'hmy_getBalance', |
|
||||||
// 12. hmy_getStorageAt
|
|
||||||
GetStorageAt = 'hmy_getStorageAt', |
|
||||||
// 13. hmy_getTransactionCount
|
|
||||||
GetTransactionCount = 'hmy_getTransactionCount', |
|
||||||
// 14. hmy_sendTransaction
|
|
||||||
SendTransaction = 'hmy_sendTransaction', |
|
||||||
// 15. hmy_sendRawTransaction
|
|
||||||
SendRawTransaction = 'hmy_sendRawTransaction', |
|
||||||
// 16. hmy_subscribe
|
|
||||||
Subscribe = 'hmy_subscribe', |
|
||||||
// 17. hmy_getlogs
|
|
||||||
GetPastLogs = 'hmy_getLogs', |
|
||||||
// 18. hmy_getWork
|
|
||||||
GetWork = 'hmy_getWork', |
|
||||||
// 19. hmy_submitWork
|
|
||||||
// SubmitWork = 'hmy_submitWork',
|
|
||||||
// 20. hmy_getProof
|
|
||||||
GetProof = 'hmy_getProof', |
|
||||||
// 21, hmy_getFilterChanges
|
|
||||||
GetFilterChanges = 'hmy_getFilterChanges', |
|
||||||
// 22. hmy_newPendingTransactionFilter
|
|
||||||
NewPendingTransactionFilter = 'hmy_newPendingTransactionFilter', |
|
||||||
// 23. hmy_newBlockFilter
|
|
||||||
NewBlockFilter = 'hmy_newBlockFilter', |
|
||||||
// 24. hmy_newFilter
|
|
||||||
NewFilter = 'hmy_newFilter', |
|
||||||
// 25. hmy_call
|
|
||||||
Call = 'hmy_call', |
|
||||||
// 26. hmy_estimateGas
|
|
||||||
EstimateGas = 'hmy_estimateGas', |
|
||||||
// 27. hmy_gasPrice
|
|
||||||
GasPrice = 'hmy_gasPrice', |
|
||||||
// 28. hmy_blockNumber
|
|
||||||
BlockNumber = 'hmy_blockNumber', |
|
||||||
// 29. hmy_unsubscribe
|
|
||||||
UnSubscribe = 'hmy_unsubscribe', |
|
||||||
// 30. net_version
|
|
||||||
NetVersion = 'net_version', |
|
||||||
// 31. hmy_protocolVersion
|
|
||||||
ProtocolVersion = 'hmy_protocolVersion', |
|
||||||
// 32. hmy_getShardingStructure
|
|
||||||
GetShardingStructure = 'hmy_getShardingStructure', |
|
||||||
// 33. hmy_sendRawStakingTransaction
|
|
||||||
SendRawStakingTransaction = 'hmy_sendRawStakingTransaction', |
|
||||||
// 34. hmy_getAccountNonce
|
|
||||||
GetAccountNonce = 'hmy_getAccountNonce', |
|
||||||
// 35. hmy_getBlocks
|
|
||||||
GetBlocks = 'hmy_getBlocks', |
|
||||||
} |
|
||||||
|
|
||||||
/**@ignore */ |
|
||||||
export enum RPCErrorCode { |
|
||||||
// Standard JSON-RPC 2.0 errors
|
|
||||||
// RPC_INVALID_REQUEST is internally mapped to HTTP_BAD_REQUEST (400).
|
|
||||||
// It should not be used for application-layer errors.
|
|
||||||
RPC_INVALID_REQUEST = -32600, |
|
||||||
// RPC_METHOD_NOT_FOUND is internally mapped to HTTP_NOT_FOUND (404).
|
|
||||||
// It should not be used for application-layer errors.
|
|
||||||
RPC_METHOD_NOT_FOUND = -32601, |
|
||||||
RPC_INVALID_PARAMS = -32602, |
|
||||||
// RPC_INTERNAL_ERROR should only be used for genuine errors in bitcoind
|
|
||||||
// (for example datadir corruption).
|
|
||||||
RPC_INTERNAL_ERROR = -32603, |
|
||||||
RPC_PARSE_ERROR = -32700, |
|
||||||
|
|
||||||
// General application defined errors
|
|
||||||
RPC_MISC_ERROR = -1, // std::exception thrown in command handling
|
|
||||||
RPC_TYPE_ERROR = -3, // Unexpected type was passed as parameter
|
|
||||||
RPC_INVALID_ADDRESS_OR_KEY = -5, // Invalid address or key
|
|
||||||
RPC_INVALID_PARAMETER = -8, // Invalid, missing or duplicate parameter
|
|
||||||
RPC_DATABASE_ERROR = -20, // Database error
|
|
||||||
RPC_DESERIALIZATION_ERROR = -22, // Error parsing or validating structure in raw format
|
|
||||||
RPC_VERIFY_ERROR = -25, // General error during transaction or block submission
|
|
||||||
RPC_VERIFY_REJECTED = -26, // Transaction or block was rejected by network rules
|
|
||||||
RPC_IN_WARMUP = -28, // Client still warming up
|
|
||||||
RPC_METHOD_DEPRECATED = -32, // RPC method is deprecated
|
|
||||||
} |
|
@ -0,0 +1,29 @@ |
|||||||
|
{ |
||||||
|
"name": "@woop-js/account", |
||||||
|
"version": "0.1.58", |
||||||
|
"description": "account and wallet for woop", |
||||||
|
"main": "dist/index.js", |
||||||
|
"node": "dist/index.js", |
||||||
|
"browser": "dist/index.js", |
||||||
|
"module": "dist/index.esm.js", |
||||||
|
"jsnext:main": "dist/index.esm.js", |
||||||
|
"typings": "dist/index.d.ts", |
||||||
|
"types": "dist/index.d.ts", |
||||||
|
"scripts": { |
||||||
|
"test": "echo \"Error: no test specified\" && exit 1" |
||||||
|
}, |
||||||
|
"publishConfig": { |
||||||
|
"access": "public" |
||||||
|
}, |
||||||
|
"author": "neeboo@firestack.one", |
||||||
|
"license": "MIT", |
||||||
|
"dependencies": { |
||||||
|
"@woop-js/core": "0.1.58", |
||||||
|
"@woop-js/crypto": "0.1.58", |
||||||
|
"@woop-js/network": "0.1.58", |
||||||
|
"@woop-js/staking": "0.1.58", |
||||||
|
"@woop-js/transaction": "0.1.58", |
||||||
|
"@woop-js/utils": "0.1.58" |
||||||
|
}, |
||||||
|
"gitHead": "56606e9365721729a490c27d6a294e0daf90fbdf" |
||||||
|
} |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-account |
* @module woop-account |
||||||
* @ignore |
* @ignore |
||||||
*/ |
*/ |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-account |
* @module woop-account |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -0,0 +1,14 @@ |
|||||||
|
/** |
||||||
|
* @packageDocumentation |
||||||
|
* @module woop-account |
||||||
|
* @hidden |
||||||
|
*/ |
||||||
|
|
||||||
|
import { HttpProvider, Messenger } from '@woop-js/network'; |
||||||
|
import { ChainType, ChainID } from '@woop-js/utils'; |
||||||
|
|
||||||
|
export const defaultMessenger = new Messenger( |
||||||
|
new HttpProvider('http://localhost:9500'), |
||||||
|
ChainType.Woop, |
||||||
|
ChainID.WikiLocal, |
||||||
|
); |
@ -1,16 +1,16 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-account |
* @module woop-account |
||||||
* @ignore |
* @ignore |
||||||
*/ |
*/ |
||||||
|
|
||||||
import fetch from 'jest-fetch-mock'; |
import fetch from 'jest-fetch-mock'; |
||||||
import { Account } from '../src/account'; |
import { Account } from '../src/account'; |
||||||
import { HttpProvider, Messenger } from '@harmony-js/network'; |
import { HttpProvider, Messenger } from '@woop-js/network'; |
||||||
import { ChainType, ChainID } from '@harmony-js/utils'; |
import { ChainType, ChainID } from '@woop-js/utils'; |
||||||
|
|
||||||
const provider = new HttpProvider('http://localhost:9500'); |
const provider = new HttpProvider('http://localhost:9500'); |
||||||
const messenger = new Messenger(provider, ChainType.Harmony, ChainID.HmyLocal); |
const messenger = new Messenger(provider, ChainType.Woop, ChainID.WikiLocal); |
||||||
|
|
||||||
describe('test account', () => { |
describe('test account', () => { |
||||||
it('test Account.getBalance returns object that implements Balance interface', () => { |
it('test Account.getBalance returns object that implements Balance interface', () => { |
@ -1,12 +1,12 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { AbiCoder as ABICoder, ParamType, toUtf8Bytes } from './abiCoder'; |
import { AbiCoder as ABICoder, ParamType, toUtf8Bytes } from './abiCoder'; |
||||||
import { isObject, isArray } from '@harmony-js/utils'; |
import { isObject, isArray } from '@woop-js/utils'; |
||||||
import { keccak256, Arrayish } from '@harmony-js/crypto'; |
import { keccak256, Arrayish } from '@woop-js/crypto'; |
||||||
import { jsonInterfaceMethodToString, bnToString } from './utils'; |
import { jsonInterfaceMethodToString, bnToString } from './utils'; |
||||||
|
|
||||||
export class AbiCoderClass { |
export class AbiCoderClass { |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,11 +1,11 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { isObject, isArray } from '@harmony-js/utils'; |
import { isObject, isArray } from '@woop-js/utils'; |
||||||
import { BN } from '@harmony-js/crypto'; |
import { BN } from '@woop-js/crypto'; |
||||||
|
|
||||||
export const jsonInterfaceMethodToString = (json: any): string => { |
export const jsonInterfaceMethodToString = (json: any): string => { |
||||||
if (isObject(json) && json.name && json.name.includes('(')) { |
if (isObject(json) && json.name && json.name.includes('(')) { |
@ -1,12 +1,12 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { Wallet } from '@harmony-js/account'; |
import { Wallet } from '@woop-js/account'; |
||||||
import { Messenger } from '@harmony-js/network'; |
import { Messenger } from '@woop-js/network'; |
||||||
import { Transaction } from '@harmony-js/transaction'; |
import { Transaction } from '@woop-js/transaction'; |
||||||
import { AbiCoder } from './abi/index'; |
import { AbiCoder } from './abi/index'; |
||||||
import { abiMapper } from './utils/mapper'; |
import { abiMapper } from './utils/mapper'; |
||||||
import { ContractOptions } from './utils/options'; |
import { ContractOptions } from './utils/options'; |
@ -1,9 +1,9 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { Wallet } from '@harmony-js/account'; |
import { Wallet } from '@woop-js/account'; |
||||||
import { Contract } from './contract'; |
import { Contract } from './contract'; |
||||||
import { ContractOptions } from './utils/options'; |
import { ContractOptions } from './utils/options'; |
||||||
|
|
@ -1,9 +1,9 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { LogSub } from '@harmony-js/network'; |
import { LogSub } from '@woop-js/network'; |
||||||
import { AbiItemModel } from '../models/types'; |
import { AbiItemModel } from '../models/types'; |
||||||
import { Contract } from '../contract'; |
import { Contract } from '../contract'; |
||||||
import { decode as eventLogDecoder } from '../utils/decoder'; |
import { decode as eventLogDecoder } from '../utils/decoder'; |
@ -1,10 +1,10 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { isArray } from '@harmony-js/utils'; |
import { isArray } from '@woop-js/utils'; |
||||||
import { AbiCoderClass } from '../abi/api'; |
import { AbiCoderClass } from '../abi/api'; |
||||||
import { AbiModel, AbiItemModel } from '../models/types'; |
import { AbiModel, AbiItemModel } from '../models/types'; |
||||||
import { Contract } from '../contract'; |
import { Contract } from '../contract'; |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,13 +1,13 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { Wallet } from '@harmony-js/account'; |
import { Wallet } from '@woop-js/account'; |
||||||
import { TransactionFactory, Transaction, TxStatus } from '@harmony-js/transaction'; |
import { TransactionFactory, Transaction, TxStatus } from '@woop-js/transaction'; |
||||||
import { RPCMethod, getResultForData, Emitter } from '@harmony-js/network'; |
import { RPCMethod, getResultForData, Emitter } from '@woop-js/network'; |
||||||
import { hexToBN, Unit } from '@harmony-js/utils'; |
import { hexToBN, Unit } from '@woop-js/utils'; |
||||||
import { getAddress } from '@harmony-js/crypto'; |
import { getAddress } from '@woop-js/crypto'; |
||||||
import { AbiItemModel } from '../models/types'; |
import { AbiItemModel } from '../models/types'; |
||||||
import { Contract } from '../contract'; |
import { Contract } from '../contract'; |
||||||
import { methodEncoder } from '../utils/encoder'; |
import { methodEncoder } from '../utils/encoder'; |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,10 +1,10 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { isArray } from '@harmony-js/utils'; |
import { isArray } from '@woop-js/utils'; |
||||||
import { AbiItemModel, AbiOutput, AbiInput } from './types'; |
import { AbiItemModel, AbiOutput, AbiInput } from './types'; |
||||||
|
|
||||||
export class AbiItem { |
export class AbiItem { |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,10 +1,10 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { isArray } from '@harmony-js/utils'; |
import { isArray } from '@woop-js/utils'; |
||||||
import { AbiItemModel } from '../models/types'; |
import { AbiItemModel } from '../models/types'; |
||||||
import { AbiCoderClass } from '../abi/api'; |
import { AbiCoderClass } from '../abi/api'; |
||||||
|
|
@ -1,10 +1,10 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
||||||
import { isArray } from '@harmony-js/utils'; |
import { isArray } from '@woop-js/utils'; |
||||||
import { AbiItem } from '../models/AbiItemModel'; |
import { AbiItem } from '../models/AbiItemModel'; |
||||||
import { AbiModel } from '../models/AbiModel'; |
import { AbiModel } from '../models/AbiModel'; |
||||||
import { AbiItemModel } from '../models/types'; |
import { AbiItemModel } from '../models/types'; |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-contract |
* @module woop-contract |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,11 +1,11 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-core |
* @module woop-core |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
||||||
export * from './harmony'; |
export * from './woop'; |
||||||
export * from './blockchain'; |
export * from './blockchain'; |
||||||
export * from './truffleProvider'; |
export * from './truffleProvider'; |
||||||
export * from './harmonyExtension'; |
export * from './woopExtension'; |
||||||
export * from './types'; |
export * from './types'; |
@ -0,0 +1,31 @@ |
|||||||
|
/** |
||||||
|
* @packageDocumentation |
||||||
|
* @module woop-core |
||||||
|
* @hidden |
||||||
|
*/ |
||||||
|
|
||||||
|
import { HttpProvider, Messenger } from '@woop-js/network'; |
||||||
|
import { TransactionFactory, Transaction } from '@woop-js/transaction'; |
||||||
|
import { Wallet, Account } from '@woop-js/account'; |
||||||
|
import { ChainType, ChainID } from '@woop-js/utils'; |
||||||
|
import { Blockchain } from './blockchain'; |
||||||
|
|
||||||
|
export interface WoopModule { |
||||||
|
HttpProvider: HttpProvider; |
||||||
|
Messenger: Messenger; |
||||||
|
Blockchain: Blockchain; |
||||||
|
TransactionFactory: TransactionFactory; |
||||||
|
Wallet: Wallet; |
||||||
|
Transaction: Transaction; |
||||||
|
Account: Account; |
||||||
|
} |
||||||
|
|
||||||
|
export enum UrlType { |
||||||
|
http, |
||||||
|
ws, |
||||||
|
} |
||||||
|
|
||||||
|
export interface WoopSetting<T extends ChainType, I extends ChainID> { |
||||||
|
type: T; |
||||||
|
id: I; |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
{ |
||||||
|
"extends": "../../tsconfig.base.json", |
||||||
|
"compilerOptions": { |
||||||
|
"rootDir": "src", |
||||||
|
"outDir": "dist" |
||||||
|
}, |
||||||
|
"include": ["src", "../../typings/**/*.d.ts", "../woop-utils/src/core.ts"], |
||||||
|
"references": [ |
||||||
|
{"path": "../woop-account"}, |
||||||
|
{"path": "../woop-crypto"}, |
||||||
|
{"path": "../woop-utils"}, |
||||||
|
{"path": "../woop-network"}, |
||||||
|
{"path": "../woop-transaction"}, |
||||||
|
{"path": "../woop-contract"} |
||||||
|
] |
||||||
|
} |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-crypto |
* @module woop-crypto |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-crypto |
* @module woop-crypto |
||||||
* @ignore |
* @ignore |
||||||
*/ |
*/ |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-crypto |
* @module woop-crypto |
||||||
* @ignore |
* @ignore |
||||||
*/ |
*/ |
||||||
|
|
@ -1,13 +1,13 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-crypto |
* @module woop-crypto |
||||||
*/ |
*/ |
||||||
|
|
||||||
import aes from 'aes-js'; |
import aes from 'aes-js'; |
||||||
import scrypt from 'scrypt.js'; |
import scrypt from 'scrypt.js'; |
||||||
import { pbkdf2Sync } from 'pbkdf2'; |
import { pbkdf2Sync } from 'pbkdf2'; |
||||||
import uuid from 'uuid'; |
import uuid from 'uuid'; |
||||||
import { isPrivateKey } from '@harmony-js/utils'; |
import { isPrivateKey } from '@woop-js/utils'; |
||||||
import { randomBytes } from './random'; |
import { randomBytes } from './random'; |
||||||
import { getAddressFromPrivateKey } from './keyTool'; |
import { getAddressFromPrivateKey } from './keyTool'; |
||||||
import { concat, hexToIntArray } from './bytes'; |
import { concat, hexToIntArray } from './bytes'; |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-crypto |
* @module woop-crypto |
||||||
*/ |
*/ |
||||||
|
|
||||||
/** |
/** |
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-crypto |
* @module woop-crypto |
||||||
* @hidden |
* @hidden |
||||||
*/ |
*/ |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
/** |
/** |
||||||
* @packageDocumentation |
* @packageDocumentation |
||||||
* @module harmony-crypto |
* @module woop-crypto |
||||||
* @ignore |
* @ignore |
||||||
*/ |
*/ |
||||||
|
|
@ -1,24 +1,24 @@ |
|||||||
# @harmony-js/network |
# @woop-js/network |
||||||
|
|
||||||
This package provides a collection of apis to create messengers (HTTP, WebSocket) to connect to blockchain networks. |
This package provides a collection of apis to create messengers (HTTP, WebSocket) to connect to blockchain networks. |
||||||
|
|
||||||
## Installation |
## Installation |
||||||
|
|
||||||
``` |
``` |
||||||
npm install @harmony-js/network |
npm install @woop-js/network |
||||||
``` |
``` |
||||||
|
|
||||||
## Usage |
## Usage |
||||||
|
|
||||||
```javascript |
```javascript |
||||||
const { Messenger, HttpProvider, WSProvider } = require('@harmony-js/network'); |
const { Messenger, HttpProvider, WSProvider } = require('@woop-js/network'); |
||||||
const { ChainID, ChainType } = require('@harmony-js/utils'); |
const { ChainID, ChainType } = require('@woop-js/utils'); |
||||||
const testnetHTTP = 'https://api.s0.b.hmny.io'; |
const testnetHTTP = 'https://api.s0.b.hmny.io'; |
||||||
const testnetWS = 'wss://ws.s0.b.hmny.io'; |
const testnetWS = 'wss://ws.s0.b.hmny.io'; |
||||||
const localHTTP = 'http://localhost:9500/'; |
const localHTTP = 'http://localhost:9500/'; |
||||||
const localWS = 'http://localhost:9800/'; |
const localWS = 'http://localhost:9800/'; |
||||||
const http = new HttpProvider(testnetHTTP); // for local use localHTTP |
const http = new HttpProvider(testnetHTTP); // for local use localHTTP |
||||||
const ws = new WSProvider(testnetWS); // for local use testnetWS |
const ws = new WSProvider(testnetWS); // for local use testnetWS |
||||||
const customHTTPMessenger = new Messenger(http, ChainType.Harmony, ChainID.HmyTestnet); // for local ChainID.HmyLocal |
const customHTTPMessenger = new Messenger(http, ChainType.Woop, ChainID.WikiTestnet); // for local ChainID.WikiLocal |
||||||
const customWSMessenger = new Messenger(ws, ChainType.Harmony, ChainID.HmyTestnet); // for local ChainID.HmyLocal |
const customWSMessenger = new Messenger(ws, ChainType.Woop, ChainID.WikiTestnet); // for local ChainID.WikiLocal |
||||||
``` |
``` |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue