-
Notifications
You must be signed in to change notification settings - Fork 59
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 #1866 from aeternity/feature/refactor-rpc
Extract WalletConnectorFrame, deprecate AeSdkAepp
- Loading branch information
Showing
14 changed files
with
375 additions
and
24 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
const { defineConfig } = require('@vue/cli-service'); | ||
const webpack = require('webpack'); | ||
|
||
module.exports = defineConfig({ | ||
publicPath: process.env.PUBLIC_PATH ?? '/', | ||
devServer: { | ||
port: 9001, | ||
}, | ||
configureWebpack: { | ||
plugins: [ | ||
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }), | ||
], | ||
}, | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Network } from './rpc/types'; | ||
import BrowserConnection from './connection/Browser'; | ||
import WalletConnectorFrameBase from './WalletConnectorFrameBase'; | ||
|
||
interface EventsNetworkId { | ||
networkIdChange: (networkId: string) => void; | ||
} | ||
|
||
/** | ||
* Connect to wallet as iframe/web-extension | ||
* @category aepp wallet communication | ||
*/ | ||
export default class WalletConnectorFrame extends WalletConnectorFrameBase<EventsNetworkId> { | ||
#networkId = ''; | ||
|
||
/** | ||
* The last network id reported by wallet | ||
*/ | ||
get networkId(): string { | ||
return this.#networkId; | ||
} | ||
|
||
protected override _updateNetwork(params: Network): void { | ||
this.#networkId = params.networkId; | ||
this.emit('networkIdChange', this.#networkId); | ||
} | ||
|
||
/** | ||
* Connect to wallet | ||
* @param name - Aepp name | ||
* @param connection - Wallet connection object | ||
*/ | ||
static async connect( | ||
name: string, | ||
connection: BrowserConnection, | ||
): Promise<WalletConnectorFrame> { | ||
const connector = new WalletConnectorFrame(); | ||
await WalletConnectorFrame._connect(name, connection, connector, false); | ||
return connector; | ||
} | ||
} |
Oops, something went wrong.