@interchain-kit/station-extension 0.2.221 → 0.3.0
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/esm/index.js +9 -3
- package/esm/registry.js +2 -1
- package/index.d.ts +2 -3
- package/index.js +9 -3
- package/package.json +2 -2
- package/registry.js +2 -1
- package/esm/extension.js +0 -39
- package/extension.d.ts +0 -7
- package/extension.js +0 -43
package/esm/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AminoGenericOfflineSigner } from '@interchainjs/cosmos/types/wallet';
|
|
2
|
+
import { CosmosWallet, ExtensionWallet } from '@interchain-kit/core';
|
|
2
3
|
import { stationExtensionInfo } from "./registry";
|
|
3
|
-
export * from './extension';
|
|
4
4
|
export * from './registry';
|
|
5
|
-
const stationWallet = new
|
|
5
|
+
const stationWallet = new ExtensionWallet(stationExtensionInfo);
|
|
6
|
+
class StationCosmosWallet extends CosmosWallet {
|
|
7
|
+
async getOfflineSigner(chainId) {
|
|
8
|
+
return new AminoGenericOfflineSigner(this.client.getOfflineSigner(chainId));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
stationWallet.setNetworkWallet('cosmos', new StationCosmosWallet(stationExtensionInfo));
|
|
6
12
|
export { stationWallet };
|
package/esm/registry.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export * from './extension';
|
|
1
|
+
import { ExtensionWallet } from '@interchain-kit/core';
|
|
3
2
|
export * from './registry';
|
|
4
|
-
declare const stationWallet:
|
|
3
|
+
declare const stationWallet: ExtensionWallet;
|
|
5
4
|
export { stationWallet };
|
package/index.js
CHANGED
|
@@ -15,9 +15,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.stationWallet = void 0;
|
|
18
|
-
const
|
|
18
|
+
const wallet_1 = require("@interchainjs/cosmos/types/wallet");
|
|
19
|
+
const core_1 = require("@interchain-kit/core");
|
|
19
20
|
const registry_1 = require("./registry");
|
|
20
|
-
__exportStar(require("./extension"), exports);
|
|
21
21
|
__exportStar(require("./registry"), exports);
|
|
22
|
-
const stationWallet = new
|
|
22
|
+
const stationWallet = new core_1.ExtensionWallet(registry_1.stationExtensionInfo);
|
|
23
23
|
exports.stationWallet = stationWallet;
|
|
24
|
+
class StationCosmosWallet extends core_1.CosmosWallet {
|
|
25
|
+
async getOfflineSigner(chainId) {
|
|
26
|
+
return new wallet_1.AminoGenericOfflineSigner(this.client.getOfflineSigner(chainId));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
stationWallet.setNetworkWallet('cosmos', new StationCosmosWallet(registry_1.stationExtensionInfo));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interchain-kit/station-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"author": "Hyperweb <developers@hyperweb.io>",
|
|
5
5
|
"description": "interchain-kit wallet connector",
|
|
6
6
|
"main": "index.js",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@interchain-kit/core": "0.0.1-beta.22"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "2fa62ae0dbeb2833b55d59c0cfe8446d1c7a7b06"
|
|
38
38
|
}
|
package/registry.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stationExtensionInfo = void 0;
|
|
4
4
|
const constant_1 = require("./constant");
|
|
5
5
|
exports.stationExtensionInfo = {
|
|
6
|
-
windowKey: 'station',
|
|
6
|
+
windowKey: 'station.keplr',
|
|
7
|
+
walletIdentifyKey: 'station._pendingRequests',
|
|
7
8
|
name: 'station-extension',
|
|
8
9
|
prettyName: 'Station',
|
|
9
10
|
logo: constant_1.ICON,
|
package/esm/extension.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ExtensionWallet } from '@interchain-kit/core';
|
|
2
|
-
export class StationExtension extends ExtensionWallet {
|
|
3
|
-
async connect(chainId) {
|
|
4
|
-
try {
|
|
5
|
-
this.client.connect(chainId);
|
|
6
|
-
}
|
|
7
|
-
catch (e) {
|
|
8
|
-
console.error('StationExtension connect error.', e);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
async getAccount(chainId) {
|
|
12
|
-
const info = (await this.client.info())[chainId];
|
|
13
|
-
if (!info)
|
|
14
|
-
throw new Error(`The requested chainID (${chainId}) is not available, try to switch network on the Station extension.`);
|
|
15
|
-
let { name, addresses, pubkey: pubkeys } = await this.client.connect();
|
|
16
|
-
if (!pubkeys) {
|
|
17
|
-
pubkeys = (await this.client.getPublicKey()).pubkey;
|
|
18
|
-
}
|
|
19
|
-
const pubkey = pubkeys?.[info.coinType];
|
|
20
|
-
const address = addresses[chainId];
|
|
21
|
-
if (!address || !pubkey)
|
|
22
|
-
throw new Error('The requested account is not available, try to use a different wallet on the Station extension or to import it again.');
|
|
23
|
-
return {
|
|
24
|
-
address,
|
|
25
|
-
// pubkey: Buffer.from(pubkey, 'base64'),
|
|
26
|
-
pubkey,
|
|
27
|
-
username: name,
|
|
28
|
-
isNanoLedger: true,
|
|
29
|
-
algo: 'secp256k1',
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
getOfflineSignerAmino(chainId) {
|
|
33
|
-
return this.client.keplr.getOfflineSignerOnlyAmino(chainId);
|
|
34
|
-
// return this.client.getOfflineSigner(chainId)
|
|
35
|
-
}
|
|
36
|
-
async disconnect() {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
package/extension.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ExtensionWallet, WalletAccount } from '@interchain-kit/core';
|
|
2
|
-
export declare class StationExtension extends ExtensionWallet {
|
|
3
|
-
connect(chainId: string | string[]): Promise<void>;
|
|
4
|
-
getAccount(chainId: string): Promise<WalletAccount>;
|
|
5
|
-
getOfflineSignerAmino(chainId: string): any;
|
|
6
|
-
disconnect(): Promise<void>;
|
|
7
|
-
}
|
package/extension.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StationExtension = void 0;
|
|
4
|
-
const core_1 = require("@interchain-kit/core");
|
|
5
|
-
class StationExtension extends core_1.ExtensionWallet {
|
|
6
|
-
async connect(chainId) {
|
|
7
|
-
try {
|
|
8
|
-
this.client.connect(chainId);
|
|
9
|
-
}
|
|
10
|
-
catch (e) {
|
|
11
|
-
console.error('StationExtension connect error.', e);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
async getAccount(chainId) {
|
|
15
|
-
const info = (await this.client.info())[chainId];
|
|
16
|
-
if (!info)
|
|
17
|
-
throw new Error(`The requested chainID (${chainId}) is not available, try to switch network on the Station extension.`);
|
|
18
|
-
let { name, addresses, pubkey: pubkeys } = await this.client.connect();
|
|
19
|
-
if (!pubkeys) {
|
|
20
|
-
pubkeys = (await this.client.getPublicKey()).pubkey;
|
|
21
|
-
}
|
|
22
|
-
const pubkey = pubkeys?.[info.coinType];
|
|
23
|
-
const address = addresses[chainId];
|
|
24
|
-
if (!address || !pubkey)
|
|
25
|
-
throw new Error('The requested account is not available, try to use a different wallet on the Station extension or to import it again.');
|
|
26
|
-
return {
|
|
27
|
-
address,
|
|
28
|
-
// pubkey: Buffer.from(pubkey, 'base64'),
|
|
29
|
-
pubkey,
|
|
30
|
-
username: name,
|
|
31
|
-
isNanoLedger: true,
|
|
32
|
-
algo: 'secp256k1',
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
getOfflineSignerAmino(chainId) {
|
|
36
|
-
return this.client.keplr.getOfflineSignerOnlyAmino(chainId);
|
|
37
|
-
// return this.client.getOfflineSigner(chainId)
|
|
38
|
-
}
|
|
39
|
-
async disconnect() {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.StationExtension = StationExtension;
|