Skip to content

Commit

Permalink
fix(RPC): Remove NodePool stamp from AE composition (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
nduchak authored Aug 20, 2019
1 parent dd8f85f commit 21af2eb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions es/ae/aepp.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
import Ae from './'
import Aens from './aens'
import Rpc from '../rpc/client'
import { ContractAPI } from './contract'
import Oracle from './oracle'
import GeneralizeAccount from '../contract/ga'
import { Contract } from './contract'

/**
* Aepp Stamp
Expand All @@ -40,6 +41,6 @@ import { Contract } from './contract'
* @param {Object} [options={}] - Initializer object
* @return {Object} Aepp instance
*/
const Aepp = Ae.compose(Contract, Aens, GeneralizeAccount, Rpc)
const Aepp = Ae.compose(ContractAPI, Aens, Oracle, GeneralizeAccount, Rpc)

export default Aepp
5 changes: 3 additions & 2 deletions es/ae/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import ContractCompilerAPI from '../contract/compiler'
import ContractBase from '../contract'
import ContractACI from '../contract/aci'
import BigNumber from 'bignumber.js'
import NodePool from '../node-pool'

/**
* Handle contract call error
Expand Down Expand Up @@ -293,7 +294,7 @@ async function contractCompile (source, options = {}) {
* const client = await ContractWithAe({ url, internalUrl, compilerUrl, keypair, ... })
*
*/
export const Contract = Ae.compose(ContractBase, ContractACI, {
export const ContractAPI = Ae.compose(ContractBase, ContractACI, {
methods: {
contractCompile,
contractCallStatic,
Expand All @@ -317,6 +318,6 @@ export const Contract = Ae.compose(ContractBase, ContractACI, {
}
})

export const Contract = ContractAPI.compose(NodePool)
export const ContractWithCompiler = Contract.compose(ContractCompilerAPI)

export default ContractWithCompiler
4 changes: 2 additions & 2 deletions es/ae/universal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Oracle from './oracle'
import GeneralizeAccount from '../contract/ga'
import Accounts from '../accounts'
import Contract from './contract'
import NodePool from '../node-pool'

/**
* Universal Stamp
Expand All @@ -42,8 +43,7 @@ import Contract from './contract'
* @param {Object} [options={}] - Initializer object
* @return {Object} Universal instance
*/

export const Universal = Ae.compose(Accounts, Chain, Transaction, Aens, Contract, Oracle, GeneralizeAccount, {
export const Universal = Ae.compose(Accounts, Chain, NodePool, Transaction, Aens, Contract, Oracle, GeneralizeAccount, {
init () {},
props: { process: {} }
})
Expand Down
3 changes: 2 additions & 1 deletion es/ae/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Rpc from '../rpc/server'
import * as R from 'ramda'
import Tx from '../tx/tx'
import Contract from './contract'
import NodePool from '../node-pool'
import GeneralizeAccount from '../contract/ga'

const contains = R.flip(R.contains)
Expand Down Expand Up @@ -130,7 +131,7 @@ async function rpcAddress ({ params, session }) {
onContract: confirm
})
*/
const Wallet = Ae.compose(Accounts, Chain, Tx, Contract, GeneralizeAccount, Rpc, {
const Wallet = Ae.compose(Accounts, Chain, NodePool, Tx, Contract, GeneralizeAccount, Rpc, {
init ({ onTx = this.onTx, onChain = this.onChain, onAccount = this.onAccount, onContract = this.onContract }, { stamp }) {
this.onTx = onTx
this.onChain = onChain
Expand Down
3 changes: 1 addition & 2 deletions es/chain/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import Oracle from '../oracle'
import { required } from '@stamp/required'
import { NodePool } from '../node-pool'

/**
* Basic Chain Stamp
Expand All @@ -37,7 +36,7 @@ import { NodePool } from '../node-pool'
* @param {Object} [options={}] - Initializer object
* @return {Object} Chain instance
*/
const Chain = NodePool.compose(Oracle, {
const Chain = Oracle.compose({
deepProps: { Chain: { defaults: { waitMined: true } } },
statics: { waitMined (bool) { return this.deepProps({ Chain: { defaults: { waitMined: bool } } }) } },
deepConf: {
Expand Down
3 changes: 2 additions & 1 deletion es/chain/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Chain from './'
import Oracle from '../oracle/node'
import formatBalance from '../utils/amount-formatter'
import TransactionValidator from '../tx/validator'
import NodePool from '../node-pool'

/**
* ChainNode module
Expand Down Expand Up @@ -187,7 +188,7 @@ async function getName (name) {
* @return {Object} ChainNode instance
* @example ChainNode({url: 'https://sdk-testnet.aepps.com/'})
*/
const ChainNode = Chain.compose(Oracle, TransactionValidator, {
const ChainNode = Chain.compose(Oracle, TransactionValidator, NodePool, {
init ({ verifyTx = false }) {
this.verifyTxBeforeSend = verifyTx
},
Expand Down
4 changes: 2 additions & 2 deletions es/oracle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

import { required } from '@stamp/required'
import { NodePool } from '../node-pool'
import stampit from '@stamp/it'

/**
* Basic Oracle Stamp
Expand All @@ -37,7 +37,7 @@ import { NodePool } from '../node-pool'
* @param {Object} [options={}] - Initializer object
* @return {Object} Oracle instance
*/
const OracleBase = NodePool.compose({
const OracleBase = stampit({
deepConf: {
Contract: {
methods: [
Expand Down

0 comments on commit 21af2eb

Please sign in to comment.