-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1557 from aeternity/update-mdw
refactor: use middleware api wrapper from new sdk and update deps
- Loading branch information
Showing
19 changed files
with
573 additions
and
611 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,49 +81,37 @@ export default (store) => { | |
}; | ||
|
||
const acceptCb = (_, { accept }) => accept(); | ||
const [sdk, middleware2] = await Promise.all([ | ||
Ae.compose(ChainNode, Transaction, Contract, Aens, WalletRPC, { methods })({ | ||
nodes: [{ | ||
name: network.name, | ||
instance: await Node({ url: network.url, ignoreVersion: true }), | ||
}], | ||
name: 'Base Aepp', | ||
onConnection: acceptCb, | ||
async onSubscription(_, { accept }, origin) { | ||
const activeAccount = await this.address(this.getApp(origin)); | ||
accept({ | ||
accounts: { | ||
current: { [activeAccount]: {} }, | ||
connected: Object.fromEntries( | ||
store.state.accounts.list | ||
.filter(({ address }) => address !== activeAccount) | ||
.map(({ address }) => [address, {}]), | ||
), | ||
}, | ||
}); | ||
}, | ||
async onSign(_, { accept }) { | ||
accept(null, { | ||
onAccount: { sign: () => {}, address: () => {} }, | ||
}); | ||
}, | ||
onMessageSign: acceptCb, | ||
onAskAccounts: acceptCb, | ||
onDisconnect() { | ||
Object.keys(this.rpcClients).forEach((id) => this.removeRpcClient(id)); | ||
}, | ||
}), | ||
(async () => { | ||
const specUrl = `${network.middlewareUrl}/v2/api`; | ||
const spec = await fetchJson(specUrl); | ||
spec.paths['/status'].parameters ??= []; // bug in @aeternity/[email protected] | ||
// TODO: remove after solving https://github.com/aeternity/ae_mdw/issues/1759 | ||
if (network.middlewareUrl === 'http://localhost:4000') { | ||
spec.servers[0].url = spec.servers[0].url.replace('/mdw', ''); | ||
} | ||
return genSwaggerClient(specUrl, { spec }); | ||
})(), | ||
]); | ||
const sdk = await Ae.compose(ChainNode, Transaction, Contract, Aens, WalletRPC, { methods })({ | ||
nodes: [{ | ||
name: network.name, | ||
instance: await Node({ url: network.url, ignoreVersion: true }), | ||
}], | ||
name: 'Base Aepp', | ||
onConnection: acceptCb, | ||
async onSubscription(_, { accept }, origin) { | ||
const activeAccount = await this.address(this.getApp(origin)); | ||
accept({ | ||
accounts: { | ||
current: { [activeAccount]: {} }, | ||
connected: Object.fromEntries( | ||
store.state.accounts.list | ||
.filter(({ address }) => address !== activeAccount) | ||
.map(({ address }) => [address, {}]), | ||
), | ||
}, | ||
}); | ||
}, | ||
async onSign(_, { accept }) { | ||
accept(null, { | ||
onAccount: { sign: () => {}, address: () => {} }, | ||
}); | ||
}, | ||
onMessageSign: acceptCb, | ||
onAskAccounts: acceptCb, | ||
onDisconnect() { | ||
Object.keys(this.rpcClients).forEach((id) => this.removeRpcClient(id)); | ||
}, | ||
}); | ||
// TODO: remove after updating sdk | ||
sdk.Ae.defaults.verify = false; | ||
|
||
|
@@ -138,7 +126,6 @@ export default (store) => { | |
} | ||
|
||
sdk.selectNode(network.name); | ||
sdk.middleware2 = middleware2; | ||
return sdk; | ||
}; | ||
|
||
|
Oops, something went wrong.