Skip to content

Commit

Permalink
refactor!: remove ability to connect without sharing node if requested
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `shareNode` argument in accept callback of `onConnection` removed
Just `deny` the connection if you don't want to share the node url.
  • Loading branch information
davidyuk committed May 30, 2022
1 parent 791eb9a commit 7dd4af5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions docs/guides/build-wallet.md
Expand Up @@ -146,9 +146,8 @@ async function init () {
if (confirm(`Aepp ${aepp.info.name} with id ${aepp.id} wants to connect`)) {
// Whitelist aepp domains for node connection
const aepps = ['https://test', 'https://aepp.aeternity.com']
if (aepp.info.connectNode && aepps.includes(aepp.info.origin)) {
action.accept({ shareNode: true })
}
if (aepp.info.connectNode && aepps.includes(aepp.info.origin)) action.accept()
else action.deny()
action.accept() // Accept wallet connection without sharing node URLs
} else {
action.deny()
Expand Down
6 changes: 3 additions & 3 deletions src/utils/aepp-wallet-communication/rpc/wallet-rpc.js
Expand Up @@ -56,11 +56,11 @@ const METHOD_HANDLERS = {
return callInstance(
'onConnection',
{ name, version },
({ shareNode } = {}) => {
client.updateInfo({ status: shareNode ? RPC_STATUS.NODE_BINDED : RPC_STATUS.CONNECTED })
() => {
client.updateInfo({ status: connectNode ? RPC_STATUS.NODE_BINDED : RPC_STATUS.CONNECTED })
return {
...instance.getWalletInfo(),
...shareNode && { node: instance.selectedNode }
...connectNode && { node: instance.selectedNode }
}
},
(error) => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/rpc.js
Expand Up @@ -454,7 +454,7 @@ describe('Aepp<->Wallet', function () {
type: WALLET_TYPE.window,
name: 'Wallet',
onConnection (aepp, { accept }) {
accept({ shareNode: true })
accept()
},
onSubscription () {},
onSign () {},
Expand Down

0 comments on commit 7dd4af5

Please sign in to comment.