@onekeyfe/onekey-algo-provider 2.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,51 @@
1
+ # ONEKEY STANDARD SOURCE LICENSE (O-SSL)
2
+
3
+ This license governs use of the accompanying software. If you use the software,
4
+ you accept this license. If you do not accept the license, do not use the
5
+ software.
6
+
7
+ ## 1. Definitions
8
+
9
+ The terms "reproduce," "reproduction" and "distribution" have the same meaning
10
+ here as under Hong Kong copyright law.
11
+
12
+ "You" means the licensee of the software.
13
+
14
+ "Your company" means the company you worked for when you downloaded the
15
+ software.
16
+
17
+ "Reference use" means use of the software within your company as a reference,
18
+ in read only form, for the sole purposes of debugging your products,
19
+ maintaining your products, or enhancing the interoperability of your products
20
+ with the software, and specifically excludes the right to distribute the
21
+ software outside of your company.
22
+
23
+ "Licensed patents" means any Licensor patent claims which read directly on the
24
+ software as distributed by the Licensor under this license.
25
+
26
+ ## 2. Grant of Rights
27
+
28
+ (A) Copyright Grant - Subject to the terms of this license, the Licensor grants
29
+ you a non-transferable, non-exclusive, worldwide, royalty-free copyright
30
+ license to reproduce the software for reference use.
31
+
32
+ (B) Patent Grant - Subject to the terms of this license, the Licensor grants
33
+ you a non-transferable, non-exclusive, worldwide, royalty-free patent license
34
+ under licensed patents for reference use.
35
+
36
+ ## 3. Limitations
37
+
38
+ (A) No Trademark License - This license does not grant you any rights to use
39
+ the Licensor's name, logo, or trademarks.
40
+
41
+ (B) If you begin patent litigation against the Licensor over patents that you
42
+ think may apply to the software (including a cross-claim or counterclaim in
43
+ a lawsuit), your license to the software ends automatically.
44
+
45
+ (C) The software is licensed "as-is." You bear the risk of using it. The
46
+ Licensor gives no express warranties, guarantees or conditions. You may have
47
+ additional consumer rights under your local laws which this license cannot
48
+ change. To the extent permitted under your local laws, the Licensor excludes
49
+ the implied warranties of merchantability, fitness for a particular purpose and
50
+ non-infringement.This license agreement is governed by the laws of Hong Kong,
51
+ and any disputes related to this license agreement shall be resolved in accordance with Hong Kong law.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # cross-inpage-provider
@@ -0,0 +1,34 @@
1
+ import { IInpageProviderConfig } from '@onekeyfe/cross-inpage-provider-core';
2
+ import { ProviderAlgoBase } from './ProviderAlgoBase';
3
+ import { AlgoProviderEventsMap, BaseHTTPClient, DisplayEncoding, EnableOpts, EnableResult, IProviderAlgo, PostTxnsResult, SignTxnsResult, TransactionResult, WalletTransaction } from './types';
4
+ declare class ProviderAlgo extends ProviderAlgoBase implements IProviderAlgo {
5
+ readonly isExodus = true;
6
+ readonly isOneKey = true;
7
+ isConnected: boolean;
8
+ address: string | null;
9
+ constructor(props: IInpageProviderConfig);
10
+ private _registerEvents;
11
+ private _handleConnected;
12
+ private _handleDisconnected;
13
+ private _handleAccountChange;
14
+ on<E extends keyof AlgoProviderEventsMap>(event: E, listener: AlgoProviderEventsMap[E]): this;
15
+ off<E extends keyof AlgoProviderEventsMap>(event: E, listener: AlgoProviderEventsMap[E]): this;
16
+ emit<E extends keyof AlgoProviderEventsMap>(event: E, ...args: Parameters<AlgoProviderEventsMap[E]>): boolean;
17
+ enable(opts?: EnableOpts): Promise<EnableResult>;
18
+ signTxns(transactions: WalletTransaction[]): Promise<SignTxnsResult>;
19
+ postTxns(transactions: string[]): Promise<PostTxnsResult>;
20
+ signAndPostTxns(transactions: WalletTransaction[]): Promise<PostTxnsResult>;
21
+ getAlgodv2Client(): Promise<BaseHTTPClient>;
22
+ getIndexerClient(): Promise<BaseHTTPClient>;
23
+ connect(): Promise<{
24
+ address: string;
25
+ }>;
26
+ disconnect(): Promise<void>;
27
+ signAndSendTransaction(transactions: Uint8Array[]): Promise<TransactionResult>;
28
+ signTransaction(transactions: Uint8Array[]): Promise<Uint8Array[]>;
29
+ signMessage(encodedMessage: Uint8Array, display?: DisplayEncoding | undefined): Promise<{
30
+ signature: Uint8Array;
31
+ address: string;
32
+ }>;
33
+ }
34
+ export { ProviderAlgo };
@@ -0,0 +1,115 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { ProviderAlgoBase } from './ProviderAlgoBase';
11
+ import { PROVIDER_EVENTS, } from './types';
12
+ import { isWalletEventMethodMatch } from './utils';
13
+ class ProviderAlgo extends ProviderAlgoBase {
14
+ constructor(props) {
15
+ super(props);
16
+ this.isExodus = true;
17
+ this.isOneKey = true;
18
+ this.isConnected = false;
19
+ this.address = null;
20
+ this._registerEvents();
21
+ }
22
+ _registerEvents() {
23
+ window.addEventListener('onekey_bridge_disconnect', () => {
24
+ this._handleDisconnected();
25
+ });
26
+ this.on(PROVIDER_EVENTS.message_low_level, (payload) => {
27
+ const { method, params } = payload;
28
+ if (isWalletEventMethodMatch(method, PROVIDER_EVENTS.accountChanged)) {
29
+ this._handleAccountChange(params);
30
+ }
31
+ });
32
+ }
33
+ _handleConnected(connectInfo) {
34
+ this.isConnected = true;
35
+ this.address = connectInfo.address;
36
+ this.emit(PROVIDER_EVENTS.connect, connectInfo);
37
+ this.emit(PROVIDER_EVENTS.accountChanged, connectInfo.address);
38
+ }
39
+ _handleDisconnected(options = { emit: true }) {
40
+ this.isConnected = false;
41
+ this.address = null;
42
+ if (options.emit && this.isConnectionStatusChanged('disconnected')) {
43
+ this.emit(PROVIDER_EVENTS.disconnect);
44
+ this.emit(PROVIDER_EVENTS.accountChanged, '');
45
+ }
46
+ }
47
+ _handleAccountChange(address) {
48
+ this.emit(PROVIDER_EVENTS.accountChanged, address);
49
+ }
50
+ on(event, listener) {
51
+ return super.on(event, listener);
52
+ }
53
+ off(event, listener) {
54
+ return super.off(event, listener);
55
+ }
56
+ emit(event, ...args) {
57
+ return super.emit(event, ...args);
58
+ }
59
+ enable(opts) {
60
+ return this.request({ method: 'algo_enable', params: opts });
61
+ }
62
+ signTxns(transactions) {
63
+ return this.request({ method: 'algo_signTxns', params: transactions });
64
+ }
65
+ postTxns(transactions) {
66
+ return this.request({ method: 'algo_postTxns', params: transactions });
67
+ }
68
+ signAndPostTxns(transactions) {
69
+ return this.request({ method: 'algo_signAndPostTxns', params: transactions });
70
+ }
71
+ getAlgodv2Client() {
72
+ return this.request({ method: 'algo_getAlgodv2Client' });
73
+ }
74
+ getIndexerClient() {
75
+ return this.request({ method: 'algo_getIndexerClient' });
76
+ }
77
+ // legacy
78
+ connect() {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const addresses = yield this.request({ method: 'algo_requestAccounts' });
81
+ const address = addresses[0];
82
+ this._handleConnected({ address });
83
+ return { address };
84
+ });
85
+ }
86
+ disconnect() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ yield this.request({ method: 'algo_disconnect' });
89
+ this._handleDisconnected();
90
+ });
91
+ }
92
+ signAndSendTransaction(transactions) {
93
+ return this.request({
94
+ method: 'algo_signAndSendTransaction',
95
+ params: transactions,
96
+ });
97
+ }
98
+ signTransaction(transactions) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const result = yield this.request({
101
+ method: 'algo_signTransaction',
102
+ params: transactions,
103
+ });
104
+ const rawTxs = result.split(',').map((tx) => Uint8Array.from(Buffer.from(tx, 'base64')));
105
+ return rawTxs;
106
+ });
107
+ }
108
+ signMessage(encodedMessage, display) {
109
+ return this.request({
110
+ method: 'algo_signMessage',
111
+ params: { encodedMessage, display },
112
+ });
113
+ }
114
+ }
115
+ export { ProviderAlgo };
@@ -0,0 +1,8 @@
1
+ import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
2
+ import { ProviderBase, IInpageProviderConfig } from '@onekeyfe/cross-inpage-provider-core';
3
+ declare class ProviderAlgoBase extends ProviderBase {
4
+ constructor(props: IInpageProviderConfig);
5
+ protected readonly providerName = IInjectedProviderNames.algo;
6
+ request<T>(data: unknown): Promise<T>;
7
+ }
8
+ export { ProviderAlgoBase };
@@ -0,0 +1,23 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
11
+ import { ProviderBase } from '@onekeyfe/cross-inpage-provider-core';
12
+ class ProviderAlgoBase extends ProviderBase {
13
+ constructor(props) {
14
+ super(props);
15
+ this.providerName = IInjectedProviderNames.algo;
16
+ }
17
+ request(data) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ return (yield this.bridgeRequest(data));
20
+ });
21
+ }
22
+ }
23
+ export { ProviderAlgoBase };
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProviderAlgo = void 0;
13
+ const ProviderAlgoBase_1 = require("./ProviderAlgoBase");
14
+ const types_1 = require("./types");
15
+ const utils_1 = require("./utils");
16
+ class ProviderAlgo extends ProviderAlgoBase_1.ProviderAlgoBase {
17
+ constructor(props) {
18
+ super(props);
19
+ this.isExodus = true;
20
+ this.isOneKey = true;
21
+ this.isConnected = false;
22
+ this.address = null;
23
+ this._registerEvents();
24
+ }
25
+ _registerEvents() {
26
+ window.addEventListener('onekey_bridge_disconnect', () => {
27
+ this._handleDisconnected();
28
+ });
29
+ this.on(types_1.PROVIDER_EVENTS.message_low_level, (payload) => {
30
+ const { method, params } = payload;
31
+ if ((0, utils_1.isWalletEventMethodMatch)(method, types_1.PROVIDER_EVENTS.accountChanged)) {
32
+ this._handleAccountChange(params);
33
+ }
34
+ });
35
+ }
36
+ _handleConnected(connectInfo) {
37
+ this.isConnected = true;
38
+ this.address = connectInfo.address;
39
+ this.emit(types_1.PROVIDER_EVENTS.connect, connectInfo);
40
+ this.emit(types_1.PROVIDER_EVENTS.accountChanged, connectInfo.address);
41
+ }
42
+ _handleDisconnected(options = { emit: true }) {
43
+ this.isConnected = false;
44
+ this.address = null;
45
+ if (options.emit && this.isConnectionStatusChanged('disconnected')) {
46
+ this.emit(types_1.PROVIDER_EVENTS.disconnect);
47
+ this.emit(types_1.PROVIDER_EVENTS.accountChanged, '');
48
+ }
49
+ }
50
+ _handleAccountChange(address) {
51
+ this.emit(types_1.PROVIDER_EVENTS.accountChanged, address);
52
+ }
53
+ on(event, listener) {
54
+ return super.on(event, listener);
55
+ }
56
+ off(event, listener) {
57
+ return super.off(event, listener);
58
+ }
59
+ emit(event, ...args) {
60
+ return super.emit(event, ...args);
61
+ }
62
+ enable(opts) {
63
+ return this.request({ method: 'algo_enable', params: opts });
64
+ }
65
+ signTxns(transactions) {
66
+ return this.request({ method: 'algo_signTxns', params: transactions });
67
+ }
68
+ postTxns(transactions) {
69
+ return this.request({ method: 'algo_postTxns', params: transactions });
70
+ }
71
+ signAndPostTxns(transactions) {
72
+ return this.request({ method: 'algo_signAndPostTxns', params: transactions });
73
+ }
74
+ getAlgodv2Client() {
75
+ return this.request({ method: 'algo_getAlgodv2Client' });
76
+ }
77
+ getIndexerClient() {
78
+ return this.request({ method: 'algo_getIndexerClient' });
79
+ }
80
+ // legacy
81
+ connect() {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const addresses = yield this.request({ method: 'algo_requestAccounts' });
84
+ const address = addresses[0];
85
+ this._handleConnected({ address });
86
+ return { address };
87
+ });
88
+ }
89
+ disconnect() {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ yield this.request({ method: 'algo_disconnect' });
92
+ this._handleDisconnected();
93
+ });
94
+ }
95
+ signAndSendTransaction(transactions) {
96
+ return this.request({
97
+ method: 'algo_signAndSendTransaction',
98
+ params: transactions,
99
+ });
100
+ }
101
+ signTransaction(transactions) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ const result = yield this.request({
104
+ method: 'algo_signTransaction',
105
+ params: transactions,
106
+ });
107
+ const rawTxs = result.split(',').map((tx) => Uint8Array.from(Buffer.from(tx, 'base64')));
108
+ return rawTxs;
109
+ });
110
+ }
111
+ signMessage(encodedMessage, display) {
112
+ return this.request({
113
+ method: 'algo_signMessage',
114
+ params: { encodedMessage, display },
115
+ });
116
+ }
117
+ }
118
+ exports.ProviderAlgo = ProviderAlgo;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProviderAlgoBase = void 0;
13
+ const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
14
+ const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-core");
15
+ class ProviderAlgoBase extends cross_inpage_provider_core_1.ProviderBase {
16
+ constructor(props) {
17
+ super(props);
18
+ this.providerName = cross_inpage_provider_types_1.IInjectedProviderNames.algo;
19
+ }
20
+ request(data) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ return (yield this.bridgeRequest(data));
23
+ });
24
+ }
25
+ }
26
+ exports.ProviderAlgoBase = ProviderAlgoBase;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./ProviderAlgo"), exports);
14
+ __exportStar(require("./ProviderAlgoBase"), exports);
15
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROVIDER_EVENTS = void 0;
4
+ exports.PROVIDER_EVENTS = {
5
+ 'connect': 'connect',
6
+ 'disconnect': 'disconnect',
7
+ 'accountChanged': 'accountChanged',
8
+ 'message_low_level': 'message_low_level',
9
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWalletEventMethodMatch = void 0;
4
+ function isWalletEventMethodMatch(method, name) {
5
+ return method === `metamask_${name}` || method === `wallet_events_${name}`;
6
+ }
7
+ exports.isWalletEventMethodMatch = isWalletEventMethodMatch;
@@ -0,0 +1,3 @@
1
+ export * from './ProviderAlgo';
2
+ export * from './ProviderAlgoBase';
3
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './ProviderAlgo';
2
+ export * from './ProviderAlgoBase';
3
+ export * from './types';
@@ -0,0 +1,87 @@
1
+ import { IJsonRpcRequest } from '@onekeyfe/cross-inpage-provider-types';
2
+ export interface EnableNetworkOpts {
3
+ genesisID?: string;
4
+ genesisHash?: string;
5
+ }
6
+ export interface EnableAccountsOpts {
7
+ accounts?: string[];
8
+ }
9
+ export declare type EnableOpts = EnableNetworkOpts & EnableAccountsOpts;
10
+ export interface EnableNetworkResult {
11
+ genesisID: string;
12
+ genesisHash: string;
13
+ }
14
+ export interface EnableAccountsResult {
15
+ accounts: string[];
16
+ }
17
+ export declare type EnableResult = EnableNetworkResult & EnableAccountsResult;
18
+ export declare type SignTxnsResult = (string | null)[];
19
+ export interface WalletTransaction {
20
+ txn: string;
21
+ authAddr?: string;
22
+ signers?: string[];
23
+ stxn?: string;
24
+ }
25
+ export interface PostTxnsResult {
26
+ txnIDs: string[];
27
+ }
28
+ export declare type Query<F> = {
29
+ format?: F;
30
+ [key: string]: any;
31
+ };
32
+ export interface BaseHTTPClientResponse {
33
+ body: Uint8Array;
34
+ status: number;
35
+ headers: Record<string, string>;
36
+ }
37
+ export interface BaseHTTPClientError {
38
+ response: BaseHTTPClientResponse;
39
+ }
40
+ export interface BaseHTTPClient {
41
+ get(relativePath: string, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
42
+ post(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
43
+ delete(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
44
+ }
45
+ interface ConnectionOptions {
46
+ onlyIfTrusted?: boolean;
47
+ }
48
+ export declare type ConnectInfo = {
49
+ address: string;
50
+ };
51
+ export interface TransactionResult {
52
+ txId: string;
53
+ }
54
+ export declare type DisplayEncoding = 'utf8' | 'hex';
55
+ export interface IProviderAlgo {
56
+ isConnected: boolean;
57
+ isExodus: boolean;
58
+ isOneKey: boolean;
59
+ address: string | null;
60
+ enable(opts?: EnableOpts): Promise<EnableResult>;
61
+ signTxns(transactions: WalletTransaction[]): Promise<SignTxnsResult>;
62
+ postTxns(transactions: string[]): Promise<PostTxnsResult>;
63
+ signAndPostTxns(transactions: WalletTransaction[]): Promise<PostTxnsResult>;
64
+ getAlgodv2Client(): Promise<BaseHTTPClient>;
65
+ getIndexerClient(): Promise<BaseHTTPClient>;
66
+ connect(options?: ConnectionOptions): Promise<ConnectInfo>;
67
+ disconnect(): void;
68
+ signAndSendTransaction(transactions: Uint8Array[]): Promise<TransactionResult>;
69
+ signTransaction(transactions: Uint8Array[]): Promise<Uint8Array[]>;
70
+ signMessage(encodedMessage: Uint8Array, display?: DisplayEncoding): Promise<{
71
+ signature: Uint8Array;
72
+ address: string;
73
+ }>;
74
+ }
75
+ export declare const PROVIDER_EVENTS: {
76
+ readonly connect: "connect";
77
+ readonly disconnect: "disconnect";
78
+ readonly accountChanged: "accountChanged";
79
+ readonly message_low_level: "message_low_level";
80
+ };
81
+ export declare type AlgoProviderEventsMap = {
82
+ [PROVIDER_EVENTS.connect]: (connectInfo: ConnectInfo) => void;
83
+ [PROVIDER_EVENTS.disconnect]: () => void;
84
+ [PROVIDER_EVENTS.accountChanged]: (address: string) => void;
85
+ [PROVIDER_EVENTS.message_low_level]: (payload: IJsonRpcRequest) => void;
86
+ };
87
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ export const PROVIDER_EVENTS = {
2
+ 'connect': 'connect',
3
+ 'disconnect': 'disconnect',
4
+ 'accountChanged': 'accountChanged',
5
+ 'message_low_level': 'message_low_level',
6
+ };
@@ -0,0 +1 @@
1
+ export declare function isWalletEventMethodMatch(method: string, name: string): boolean;
package/dist/utils.js ADDED
@@ -0,0 +1,3 @@
1
+ export function isWalletEventMethodMatch(method, name) {
2
+ return method === `metamask_${name}` || method === `wallet_events_${name}`;
3
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@onekeyfe/onekey-algo-provider",
3
+ "version": "2.0.0-alpha.7",
4
+ "keywords": [
5
+ "cross-inpage-provider"
6
+ ],
7
+ "author": "dev-fe@onekey.so",
8
+ "repository": "https://github.com/OneKeyHQ/cross-inpage-provider",
9
+ "license": "Apache-2.0",
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "type": "module",
14
+ "files": [
15
+ "dist/*"
16
+ ],
17
+ "exports": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/cjs/index.js"
21
+ },
22
+ "types": "./dist/index.d.ts",
23
+ "module": "./dist/index.js",
24
+ "main": "./dist/cjs/index.js",
25
+ "scripts": {
26
+ "prebuild": "rm -rf dist",
27
+ "build": "tsc && tsc --project tsconfig.cjs.json",
28
+ "start": "tsc --watch"
29
+ },
30
+ "dependencies": {
31
+ "@onekeyfe/cross-inpage-provider-core": "2.0.0-alpha.7",
32
+ "@onekeyfe/cross-inpage-provider-errors": "2.0.0-alpha.7",
33
+ "@onekeyfe/cross-inpage-provider-types": "2.0.0-alpha.7",
34
+ "@onekeyfe/extension-bridge-injected": "2.0.0-alpha.7"
35
+ },
36
+ "gitHead": "365f8bcf8ae4b5a66409fcf2f5d17cc07a0aba2c"
37
+ }