move connectors to own folder
This commit is contained in:
parent
74ac60fbfa
commit
145e2558aa
13
libs/react-helpers/src/lib/vega-wallet/connectors/index.ts
Normal file
13
libs/react-helpers/src/lib/vega-wallet/connectors/index.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { VegaKey } from '@vegaprotocol/vegawallet-service-api-client';
|
||||||
|
export { RestConnector } from './rest-connector';
|
||||||
|
|
||||||
|
export interface VegaConnector {
|
||||||
|
/** Description of how to use this connector */
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
/** Connect to wallet and return keys */
|
||||||
|
connect(): Promise<VegaKey[] | null>;
|
||||||
|
|
||||||
|
/** Disconnect from wallet */
|
||||||
|
disconnect(): Promise<void>;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
import { VegaConnector } from '.';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy injected connector that we may use when browser wallet is implemented
|
||||||
|
*/
|
||||||
|
export class InjectedConnector implements VegaConnector {
|
||||||
|
description = 'Connects using the Vega wallet browser extension';
|
||||||
|
|
||||||
|
async connect() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
index: 9,
|
||||||
|
pub: '0x123',
|
||||||
|
algorithm: { name: 'algo', version: 2 },
|
||||||
|
tainted: false,
|
||||||
|
meta: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
async disconnect() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -2,21 +2,10 @@ import {
|
|||||||
DefaultApi,
|
DefaultApi,
|
||||||
createConfiguration,
|
createConfiguration,
|
||||||
Configuration,
|
Configuration,
|
||||||
VegaKey,
|
|
||||||
} from '@vegaprotocol/vegawallet-service-api-client';
|
} from '@vegaprotocol/vegawallet-service-api-client';
|
||||||
import { LocalStorage } from '@vegaprotocol/storage';
|
import { LocalStorage } from '@vegaprotocol/storage';
|
||||||
import { WALLET_CONFIG } from './storage-keys';
|
import { WALLET_CONFIG } from '../storage-keys';
|
||||||
|
import { VegaConnector } from '.';
|
||||||
export interface VegaConnector {
|
|
||||||
/** Description of how to use this connector */
|
|
||||||
description: string;
|
|
||||||
|
|
||||||
/** Connect to wallet and return keys */
|
|
||||||
connect(): Promise<VegaKey[] | null>;
|
|
||||||
|
|
||||||
/** Disconnect from wallet */
|
|
||||||
disconnect(): Promise<void>;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perhaps there should be a default ConnectorConfig that others can extend off. Do all connectors
|
// Perhaps there should be a default ConnectorConfig that others can extend off. Do all connectors
|
||||||
// need to use local storage, I don't think so...
|
// need to use local storage, I don't think so...
|
||||||
@ -117,26 +106,3 @@ export class RestConnector implements VegaConnector {
|
|||||||
LocalStorage.removeItem(this.configKey);
|
LocalStorage.removeItem(this.configKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Dummy injected connector that we may use when browser wallet is implemented
|
|
||||||
*/
|
|
||||||
export class InjectedConnector implements VegaConnector {
|
|
||||||
description = 'Connects using the Vega wallet browser extension';
|
|
||||||
|
|
||||||
async connect() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
index: 9,
|
|
||||||
pub: '0x123',
|
|
||||||
algorithm: { name: 'algo', version: 2 },
|
|
||||||
tainted: false,
|
|
||||||
meta: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
async disconnect() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user