Skip to content

Commit 21af2eb

Browse files
authored
fix(RPC): Remove NodePool stamp from AE composition (#612)
1 parent dd8f85f commit 21af2eb

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

es/ae/aepp.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
import Ae from './'
2626
import Aens from './aens'
2727
import Rpc from '../rpc/client'
28+
import { ContractAPI } from './contract'
29+
import Oracle from './oracle'
2830
import GeneralizeAccount from '../contract/ga'
29-
import { Contract } from './contract'
3031

3132
/**
3233
* Aepp Stamp
@@ -40,6 +41,6 @@ import { Contract } from './contract'
4041
* @param {Object} [options={}] - Initializer object
4142
* @return {Object} Aepp instance
4243
*/
43-
const Aepp = Ae.compose(Contract, Aens, GeneralizeAccount, Rpc)
44+
const Aepp = Ae.compose(ContractAPI, Aens, Oracle, GeneralizeAccount, Rpc)
4445

4546
export default Aepp

es/ae/contract.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import ContractCompilerAPI from '../contract/compiler'
3434
import ContractBase from '../contract'
3535
import ContractACI from '../contract/aci'
3636
import BigNumber from 'bignumber.js'
37+
import NodePool from '../node-pool'
3738

3839
/**
3940
* Handle contract call error
@@ -293,7 +294,7 @@ async function contractCompile (source, options = {}) {
293294
* const client = await ContractWithAe({ url, internalUrl, compilerUrl, keypair, ... })
294295
*
295296
*/
296-
export const Contract = Ae.compose(ContractBase, ContractACI, {
297+
export const ContractAPI = Ae.compose(ContractBase, ContractACI, {
297298
methods: {
298299
contractCompile,
299300
contractCallStatic,
@@ -317,6 +318,6 @@ export const Contract = Ae.compose(ContractBase, ContractACI, {
317318
}
318319
})
319320

321+
export const Contract = ContractAPI.compose(NodePool)
320322
export const ContractWithCompiler = Contract.compose(ContractCompilerAPI)
321-
322323
export default ContractWithCompiler

es/ae/universal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import Oracle from './oracle'
3030
import GeneralizeAccount from '../contract/ga'
3131
import Accounts from '../accounts'
3232
import Contract from './contract'
33+
import NodePool from '../node-pool'
3334

3435
/**
3536
* Universal Stamp
@@ -42,8 +43,7 @@ import Contract from './contract'
4243
* @param {Object} [options={}] - Initializer object
4344
* @return {Object} Universal instance
4445
*/
45-
46-
export const Universal = Ae.compose(Accounts, Chain, Transaction, Aens, Contract, Oracle, GeneralizeAccount, {
46+
export const Universal = Ae.compose(Accounts, Chain, NodePool, Transaction, Aens, Contract, Oracle, GeneralizeAccount, {
4747
init () {},
4848
props: { process: {} }
4949
})

es/ae/wallet.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import Rpc from '../rpc/server'
3131
import * as R from 'ramda'
3232
import Tx from '../tx/tx'
3333
import Contract from './contract'
34+
import NodePool from '../node-pool'
3435
import GeneralizeAccount from '../contract/ga'
3536

3637
const contains = R.flip(R.contains)
@@ -130,7 +131,7 @@ async function rpcAddress ({ params, session }) {
130131
onContract: confirm
131132
})
132133
*/
133-
const Wallet = Ae.compose(Accounts, Chain, Tx, Contract, GeneralizeAccount, Rpc, {
134+
const Wallet = Ae.compose(Accounts, Chain, NodePool, Tx, Contract, GeneralizeAccount, Rpc, {
134135
init ({ onTx = this.onTx, onChain = this.onChain, onAccount = this.onAccount, onContract = this.onContract }, { stamp }) {
135136
this.onTx = onTx
136137
this.onChain = onChain

es/chain/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

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

2928
/**
3029
* Basic Chain Stamp
@@ -37,7 +36,7 @@ import { NodePool } from '../node-pool'
3736
* @param {Object} [options={}] - Initializer object
3837
* @return {Object} Chain instance
3938
*/
40-
const Chain = NodePool.compose(Oracle, {
39+
const Chain = Oracle.compose({
4140
deepProps: { Chain: { defaults: { waitMined: true } } },
4241
statics: { waitMined (bool) { return this.deepProps({ Chain: { defaults: { waitMined: bool } } }) } },
4342
deepConf: {

es/chain/node.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Chain from './'
1919
import Oracle from '../oracle/node'
2020
import formatBalance from '../utils/amount-formatter'
2121
import TransactionValidator from '../tx/validator'
22+
import NodePool from '../node-pool'
2223

2324
/**
2425
* ChainNode module
@@ -187,7 +188,7 @@ async function getName (name) {
187188
* @return {Object} ChainNode instance
188189
* @example ChainNode({url: 'https://sdk-testnet.aepps.com/'})
189190
*/
190-
const ChainNode = Chain.compose(Oracle, TransactionValidator, {
191+
const ChainNode = Chain.compose(Oracle, TransactionValidator, NodePool, {
191192
init ({ verifyTx = false }) {
192193
this.verifyTxBeforeSend = verifyTx
193194
},

es/oracle/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

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

2828
/**
2929
* Basic Oracle Stamp
@@ -37,7 +37,7 @@ import { NodePool } from '../node-pool'
3737
* @param {Object} [options={}] - Initializer object
3838
* @return {Object} Oracle instance
3939
*/
40-
const OracleBase = NodePool.compose({
40+
const OracleBase = stampit({
4141
deepConf: {
4242
Contract: {
4343
methods: [

0 commit comments

Comments
 (0)