@injectivelabs/wallet-cosmos-strategy 1.16.24 → 1.16.25-alpha.1
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/dist/cjs/index.cjs +76 -0
- package/dist/cjs/index.d.cts +18 -0
- package/dist/cjs/package.json +2 -2
- package/dist/esm/index.d.ts +18 -1
- package/dist/esm/index.js +75 -1
- package/dist/esm/package.json +2 -2
- package/package.json +18 -18
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -17
- package/dist/cjs/strategy/WalletStrategy.d.ts +0 -8
- package/dist/cjs/strategy/WalletStrategy.js +0 -51
- package/dist/cjs/strategy/index.d.ts +0 -1
- package/dist/cjs/strategy/index.js +0 -17
- package/dist/cjs/strategy/strategies/cosmos.d.ts +0 -14
- package/dist/cjs/strategy/strategies/cosmos.js +0 -10
- package/dist/cjs/strategy/strategies/cosmostation.d.ts +0 -14
- package/dist/cjs/strategy/strategies/cosmostation.js +0 -10
- package/dist/cjs/strategy/strategies/index.d.ts +0 -2
- package/dist/cjs/strategy/strategies/index.js +0 -18
- package/dist/cjs/strategy/types.d.ts +0 -6
- package/dist/cjs/strategy/types.js +0 -2
- package/dist/esm/strategy/WalletStrategy.d.ts +0 -8
- package/dist/esm/strategy/WalletStrategy.js +0 -46
- package/dist/esm/strategy/index.d.ts +0 -1
- package/dist/esm/strategy/index.js +0 -1
- package/dist/esm/strategy/strategies/cosmos.d.ts +0 -14
- package/dist/esm/strategy/strategies/cosmos.js +0 -6
- package/dist/esm/strategy/strategies/cosmostation.d.ts +0 -14
- package/dist/esm/strategy/strategies/cosmostation.js +0 -6
- package/dist/esm/strategy/strategies/index.d.ts +0 -2
- package/dist/esm/strategy/strategies/index.js +0 -2
- package/dist/esm/strategy/types.d.ts +0 -6
- package/dist/esm/strategy/types.js +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
let __injectivelabs_wallet_core = require("@injectivelabs/wallet-core");
|
|
2
|
+
let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
|
|
3
|
+
let __injectivelabs_wallet_cosmos = require("@injectivelabs/wallet-cosmos");
|
|
4
|
+
let __injectivelabs_wallet_cosmostation = require("@injectivelabs/wallet-cosmostation");
|
|
5
|
+
|
|
6
|
+
//#region src/strategy/strategies/cosmos.ts
|
|
7
|
+
var CosmosWalletStrategy = class extends __injectivelabs_wallet_cosmos.CosmosWalletStrategy {
|
|
8
|
+
constructor(args) {
|
|
9
|
+
super(args);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/strategy/strategies/cosmostation.ts
|
|
15
|
+
var CosmostationWalletStrategy = class extends __injectivelabs_wallet_cosmostation.CosmostationWalletStrategy {
|
|
16
|
+
constructor(args) {
|
|
17
|
+
super(args);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/strategy/WalletStrategy.ts
|
|
23
|
+
const createStrategy = ({ args, wallet }) => {
|
|
24
|
+
switch (wallet) {
|
|
25
|
+
case __injectivelabs_wallet_base.Wallet.Keplr: return new CosmosWalletStrategy({
|
|
26
|
+
...args,
|
|
27
|
+
wallet: __injectivelabs_wallet_base.Wallet.Keplr
|
|
28
|
+
});
|
|
29
|
+
case __injectivelabs_wallet_base.Wallet.Cosmostation: return new CosmostationWalletStrategy({
|
|
30
|
+
...args,
|
|
31
|
+
wallet: __injectivelabs_wallet_base.Wallet.Cosmostation
|
|
32
|
+
});
|
|
33
|
+
case __injectivelabs_wallet_base.Wallet.Leap: return new CosmosWalletStrategy({
|
|
34
|
+
...args,
|
|
35
|
+
wallet: __injectivelabs_wallet_base.Wallet.Leap
|
|
36
|
+
});
|
|
37
|
+
case __injectivelabs_wallet_base.Wallet.Ninji: return new CosmosWalletStrategy({
|
|
38
|
+
...args,
|
|
39
|
+
wallet: __injectivelabs_wallet_base.Wallet.Ninji
|
|
40
|
+
});
|
|
41
|
+
case __injectivelabs_wallet_base.Wallet.OWallet: return new CosmosWalletStrategy({
|
|
42
|
+
...args,
|
|
43
|
+
wallet: __injectivelabs_wallet_base.Wallet.OWallet
|
|
44
|
+
});
|
|
45
|
+
default: return;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const createAllStrategies = (args) => {
|
|
49
|
+
return Object.values(__injectivelabs_wallet_base.Wallet).reduce((strategies, wallet) => {
|
|
50
|
+
if (strategies[wallet]) return strategies;
|
|
51
|
+
strategies[wallet] = createStrategy({
|
|
52
|
+
args,
|
|
53
|
+
wallet
|
|
54
|
+
});
|
|
55
|
+
return strategies;
|
|
56
|
+
}, {});
|
|
57
|
+
};
|
|
58
|
+
var BaseCosmosWalletStrategy = class extends __injectivelabs_wallet_core.BaseWalletStrategy {
|
|
59
|
+
constructor(args) {
|
|
60
|
+
const strategies = createAllStrategies(args);
|
|
61
|
+
super({
|
|
62
|
+
...args,
|
|
63
|
+
strategies
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
setWallet(wallet) {
|
|
67
|
+
this.wallet = (0, __injectivelabs_wallet_base.isCosmosWallet)(wallet) ? wallet : __injectivelabs_wallet_base.Wallet.Keplr;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const createCosmosStrategyFactory = (args) => {
|
|
71
|
+
return new BaseCosmosWalletStrategy(args);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
exports.BaseCosmosWalletStrategy = BaseCosmosWalletStrategy;
|
|
76
|
+
exports.createCosmosStrategyFactory = createCosmosStrategyFactory;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseWalletStrategy } from "@injectivelabs/wallet-core";
|
|
2
|
+
import { Wallet } from "@injectivelabs/wallet-base";
|
|
3
|
+
import { CosmosChainId } from "@injectivelabs/ts-types";
|
|
4
|
+
|
|
5
|
+
//#region src/strategy/types.d.ts
|
|
6
|
+
interface CosmosWalletStrategyArguments {
|
|
7
|
+
chainId: CosmosChainId;
|
|
8
|
+
wallet?: Wallet;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/strategy/WalletStrategy.d.ts
|
|
12
|
+
declare class BaseCosmosWalletStrategy extends BaseWalletStrategy {
|
|
13
|
+
constructor(args: CosmosWalletStrategyArguments);
|
|
14
|
+
setWallet(wallet: Wallet): void;
|
|
15
|
+
}
|
|
16
|
+
declare const createCosmosStrategyFactory: (args: CosmosWalletStrategyArguments) => BaseCosmosWalletStrategy;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { BaseCosmosWalletStrategy, createCosmosStrategyFactory };
|
package/dist/cjs/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
"type": "commonjs"
|
|
3
|
+
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { BaseWalletStrategy } from "@injectivelabs/wallet-core";
|
|
2
|
+
import { Wallet } from "@injectivelabs/wallet-base";
|
|
3
|
+
import { CosmosChainId } from "@injectivelabs/ts-types";
|
|
4
|
+
|
|
5
|
+
//#region src/strategy/types.d.ts
|
|
6
|
+
interface CosmosWalletStrategyArguments {
|
|
7
|
+
chainId: CosmosChainId;
|
|
8
|
+
wallet?: Wallet;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/strategy/WalletStrategy.d.ts
|
|
12
|
+
declare class BaseCosmosWalletStrategy extends BaseWalletStrategy {
|
|
13
|
+
constructor(args: CosmosWalletStrategyArguments);
|
|
14
|
+
setWallet(wallet: Wallet): void;
|
|
15
|
+
}
|
|
16
|
+
declare const createCosmosStrategyFactory: (args: CosmosWalletStrategyArguments) => BaseCosmosWalletStrategy;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { BaseCosmosWalletStrategy, createCosmosStrategyFactory };
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
import { BaseWalletStrategy } from "@injectivelabs/wallet-core";
|
|
2
|
+
import { Wallet, isCosmosWallet } from "@injectivelabs/wallet-base";
|
|
3
|
+
import { CosmosWalletStrategy } from "@injectivelabs/wallet-cosmos";
|
|
4
|
+
import { CosmostationWalletStrategy } from "@injectivelabs/wallet-cosmostation";
|
|
5
|
+
|
|
6
|
+
//#region src/strategy/strategies/cosmos.ts
|
|
7
|
+
var CosmosWalletStrategy$1 = class extends CosmosWalletStrategy {
|
|
8
|
+
constructor(args) {
|
|
9
|
+
super(args);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/strategy/strategies/cosmostation.ts
|
|
15
|
+
var CosmostationWalletStrategy$1 = class extends CosmostationWalletStrategy {
|
|
16
|
+
constructor(args) {
|
|
17
|
+
super(args);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/strategy/WalletStrategy.ts
|
|
23
|
+
const createStrategy = ({ args, wallet }) => {
|
|
24
|
+
switch (wallet) {
|
|
25
|
+
case Wallet.Keplr: return new CosmosWalletStrategy$1({
|
|
26
|
+
...args,
|
|
27
|
+
wallet: Wallet.Keplr
|
|
28
|
+
});
|
|
29
|
+
case Wallet.Cosmostation: return new CosmostationWalletStrategy$1({
|
|
30
|
+
...args,
|
|
31
|
+
wallet: Wallet.Cosmostation
|
|
32
|
+
});
|
|
33
|
+
case Wallet.Leap: return new CosmosWalletStrategy$1({
|
|
34
|
+
...args,
|
|
35
|
+
wallet: Wallet.Leap
|
|
36
|
+
});
|
|
37
|
+
case Wallet.Ninji: return new CosmosWalletStrategy$1({
|
|
38
|
+
...args,
|
|
39
|
+
wallet: Wallet.Ninji
|
|
40
|
+
});
|
|
41
|
+
case Wallet.OWallet: return new CosmosWalletStrategy$1({
|
|
42
|
+
...args,
|
|
43
|
+
wallet: Wallet.OWallet
|
|
44
|
+
});
|
|
45
|
+
default: return;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const createAllStrategies = (args) => {
|
|
49
|
+
return Object.values(Wallet).reduce((strategies, wallet) => {
|
|
50
|
+
if (strategies[wallet]) return strategies;
|
|
51
|
+
strategies[wallet] = createStrategy({
|
|
52
|
+
args,
|
|
53
|
+
wallet
|
|
54
|
+
});
|
|
55
|
+
return strategies;
|
|
56
|
+
}, {});
|
|
57
|
+
};
|
|
58
|
+
var BaseCosmosWalletStrategy = class extends BaseWalletStrategy {
|
|
59
|
+
constructor(args) {
|
|
60
|
+
const strategies = createAllStrategies(args);
|
|
61
|
+
super({
|
|
62
|
+
...args,
|
|
63
|
+
strategies
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
setWallet(wallet) {
|
|
67
|
+
this.wallet = isCosmosWallet(wallet) ? wallet : Wallet.Keplr;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const createCosmosStrategyFactory = (args) => {
|
|
71
|
+
return new BaseCosmosWalletStrategy(args);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { BaseCosmosWalletStrategy, createCosmosStrategyFactory };
|
package/dist/esm/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
"type": "module"
|
|
3
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-cosmos-strategy",
|
|
3
3
|
"description": "Wallet Cosmos Strategy with instantiated wallets",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.25-alpha.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": {
|
|
@@ -41,29 +41,29 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "pnpm
|
|
45
|
-
"build:
|
|
46
|
-
"build:
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"test": "
|
|
51
|
-
"test:
|
|
52
|
-
"
|
|
53
|
-
"coverage": "jest --coverage",
|
|
44
|
+
"build": "pnpm type-check && tsdown",
|
|
45
|
+
"build:fast": "tsdown",
|
|
46
|
+
"build:watch": "tsdown --watch",
|
|
47
|
+
"clean": "shx rm -rf dist coverage *.log junit.xml && shx mkdir -p dist",
|
|
48
|
+
"type-check": "tsc --noEmit",
|
|
49
|
+
"test": "vitest",
|
|
50
|
+
"test:watch": "vitest --watch",
|
|
51
|
+
"test:ci": "vitest run --coverage --reporter=verbose",
|
|
52
|
+
"coverage": "vitest run --coverage",
|
|
54
53
|
"coverage:show": "live-server coverage",
|
|
55
54
|
"dev": "ts-node -r tsconfig-paths/register src/index.ts",
|
|
56
|
-
"start": "node dist/index.js"
|
|
55
|
+
"start": "node dist/index.js",
|
|
56
|
+
"lint": "eslint . --ext .ts,.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@injectivelabs/ts-types": "1.16.
|
|
60
|
-
"@injectivelabs/wallet-base": "1.16.
|
|
61
|
-
"@injectivelabs/wallet-core": "1.16.
|
|
62
|
-
"@injectivelabs/wallet-cosmos": "1.16.
|
|
63
|
-
"@injectivelabs/wallet-cosmostation": "1.16.
|
|
59
|
+
"@injectivelabs/ts-types": "1.16.25-alpha.1",
|
|
60
|
+
"@injectivelabs/wallet-base": "1.16.25-alpha.1",
|
|
61
|
+
"@injectivelabs/wallet-core": "1.16.25-alpha.1",
|
|
62
|
+
"@injectivelabs/wallet-cosmos": "1.16.25-alpha.1",
|
|
63
|
+
"@injectivelabs/wallet-cosmostation": "1.16.25-alpha.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"shx": "^0.3.3"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "e59fe33d170260cc2214f5db7e48e0c7223dc37f"
|
|
69
69
|
}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './strategy/index.js';
|
package/dist/cjs/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./strategy/index.js"), exports);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BaseWalletStrategy } from '@injectivelabs/wallet-core';
|
|
2
|
-
import { Wallet } from '@injectivelabs/wallet-base';
|
|
3
|
-
import type { CosmosWalletStrategyArguments } from './types.js';
|
|
4
|
-
export declare class BaseCosmosWalletStrategy extends BaseWalletStrategy {
|
|
5
|
-
constructor(args: CosmosWalletStrategyArguments);
|
|
6
|
-
setWallet(wallet: Wallet): void;
|
|
7
|
-
}
|
|
8
|
-
export declare const createCosmosStrategyFactory: (args: CosmosWalletStrategyArguments) => BaseCosmosWalletStrategy;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCosmosStrategyFactory = exports.BaseCosmosWalletStrategy = void 0;
|
|
4
|
-
const wallet_core_1 = require("@injectivelabs/wallet-core");
|
|
5
|
-
const wallet_base_1 = require("@injectivelabs/wallet-base");
|
|
6
|
-
const index_js_1 = require("./strategies/index.js");
|
|
7
|
-
const createStrategy = ({ args, wallet, }) => {
|
|
8
|
-
switch (wallet) {
|
|
9
|
-
case wallet_base_1.Wallet.Keplr:
|
|
10
|
-
return new index_js_1.CosmosWalletStrategy({ ...args, wallet: wallet_base_1.Wallet.Keplr });
|
|
11
|
-
case wallet_base_1.Wallet.Cosmostation:
|
|
12
|
-
return new index_js_1.CosmostationWalletStrategy({
|
|
13
|
-
...args,
|
|
14
|
-
wallet: wallet_base_1.Wallet.Cosmostation,
|
|
15
|
-
});
|
|
16
|
-
case wallet_base_1.Wallet.Leap:
|
|
17
|
-
return new index_js_1.CosmosWalletStrategy({ ...args, wallet: wallet_base_1.Wallet.Leap });
|
|
18
|
-
case wallet_base_1.Wallet.Ninji:
|
|
19
|
-
return new index_js_1.CosmosWalletStrategy({ ...args, wallet: wallet_base_1.Wallet.Ninji });
|
|
20
|
-
case wallet_base_1.Wallet.OWallet:
|
|
21
|
-
return new index_js_1.CosmosWalletStrategy({ ...args, wallet: wallet_base_1.Wallet.OWallet });
|
|
22
|
-
default:
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const createAllStrategies = (args) => {
|
|
27
|
-
return Object.values(wallet_base_1.Wallet).reduce((strategies, wallet) => {
|
|
28
|
-
if (strategies[wallet]) {
|
|
29
|
-
return strategies;
|
|
30
|
-
}
|
|
31
|
-
strategies[wallet] = createStrategy({ args, wallet: wallet });
|
|
32
|
-
return strategies;
|
|
33
|
-
}, {});
|
|
34
|
-
};
|
|
35
|
-
class BaseCosmosWalletStrategy extends wallet_core_1.BaseWalletStrategy {
|
|
36
|
-
constructor(args) {
|
|
37
|
-
const strategies = createAllStrategies(args);
|
|
38
|
-
super({
|
|
39
|
-
...args,
|
|
40
|
-
strategies,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
setWallet(wallet) {
|
|
44
|
-
this.wallet = (0, wallet_base_1.isCosmosWallet)(wallet) ? wallet : wallet_base_1.Wallet.Keplr;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.BaseCosmosWalletStrategy = BaseCosmosWalletStrategy;
|
|
48
|
-
const createCosmosStrategyFactory = (args) => {
|
|
49
|
-
return new BaseCosmosWalletStrategy(args);
|
|
50
|
-
};
|
|
51
|
-
exports.createCosmosStrategyFactory = createCosmosStrategyFactory;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './WalletStrategy.js';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./WalletStrategy.js"), exports);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CosmosWalletStrategy as BaseCosmosWalletStrategy } from '@injectivelabs/wallet-cosmos';
|
|
2
|
-
import type { Wallet } from '@injectivelabs/wallet-base';
|
|
3
|
-
import type { CosmosChainId } from '@injectivelabs/ts-types';
|
|
4
|
-
export declare class CosmosWalletStrategy extends BaseCosmosWalletStrategy {
|
|
5
|
-
constructor(args: {
|
|
6
|
-
chainId: CosmosChainId;
|
|
7
|
-
endpoints?: {
|
|
8
|
-
rest: string;
|
|
9
|
-
rpc: string;
|
|
10
|
-
};
|
|
11
|
-
} & {
|
|
12
|
-
wallet: Wallet;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CosmosWalletStrategy = void 0;
|
|
4
|
-
const wallet_cosmos_1 = require("@injectivelabs/wallet-cosmos");
|
|
5
|
-
class CosmosWalletStrategy extends wallet_cosmos_1.CosmosWalletStrategy {
|
|
6
|
-
constructor(args) {
|
|
7
|
-
super(args);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CosmosWalletStrategy = CosmosWalletStrategy;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CosmostationWalletStrategy as BaseCosmostationWalletStrategy } from '@injectivelabs/wallet-cosmostation';
|
|
2
|
-
import type { Wallet } from '@injectivelabs/wallet-base';
|
|
3
|
-
import type { CosmosChainId } from '@injectivelabs/ts-types';
|
|
4
|
-
export declare class CosmostationWalletStrategy extends BaseCosmostationWalletStrategy {
|
|
5
|
-
constructor(args: {
|
|
6
|
-
chainId: CosmosChainId;
|
|
7
|
-
endpoints?: {
|
|
8
|
-
rest: string;
|
|
9
|
-
rpc: string;
|
|
10
|
-
};
|
|
11
|
-
} & {
|
|
12
|
-
wallet: Wallet;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CosmostationWalletStrategy = void 0;
|
|
4
|
-
const wallet_cosmostation_1 = require("@injectivelabs/wallet-cosmostation");
|
|
5
|
-
class CosmostationWalletStrategy extends wallet_cosmostation_1.CosmostationWalletStrategy {
|
|
6
|
-
constructor(args) {
|
|
7
|
-
super(args);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CosmostationWalletStrategy = CosmostationWalletStrategy;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./cosmos.js"), exports);
|
|
18
|
-
__exportStar(require("./cosmostation.js"), exports);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BaseWalletStrategy } from '@injectivelabs/wallet-core';
|
|
2
|
-
import { Wallet } from '@injectivelabs/wallet-base';
|
|
3
|
-
import type { CosmosWalletStrategyArguments } from './types.js';
|
|
4
|
-
export declare class BaseCosmosWalletStrategy extends BaseWalletStrategy {
|
|
5
|
-
constructor(args: CosmosWalletStrategyArguments);
|
|
6
|
-
setWallet(wallet: Wallet): void;
|
|
7
|
-
}
|
|
8
|
-
export declare const createCosmosStrategyFactory: (args: CosmosWalletStrategyArguments) => BaseCosmosWalletStrategy;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { BaseWalletStrategy } from '@injectivelabs/wallet-core';
|
|
2
|
-
import { Wallet, isCosmosWallet } from '@injectivelabs/wallet-base';
|
|
3
|
-
import { CosmosWalletStrategy, CosmostationWalletStrategy, } from './strategies/index.js';
|
|
4
|
-
const createStrategy = ({ args, wallet, }) => {
|
|
5
|
-
switch (wallet) {
|
|
6
|
-
case Wallet.Keplr:
|
|
7
|
-
return new CosmosWalletStrategy({ ...args, wallet: Wallet.Keplr });
|
|
8
|
-
case Wallet.Cosmostation:
|
|
9
|
-
return new CosmostationWalletStrategy({
|
|
10
|
-
...args,
|
|
11
|
-
wallet: Wallet.Cosmostation,
|
|
12
|
-
});
|
|
13
|
-
case Wallet.Leap:
|
|
14
|
-
return new CosmosWalletStrategy({ ...args, wallet: Wallet.Leap });
|
|
15
|
-
case Wallet.Ninji:
|
|
16
|
-
return new CosmosWalletStrategy({ ...args, wallet: Wallet.Ninji });
|
|
17
|
-
case Wallet.OWallet:
|
|
18
|
-
return new CosmosWalletStrategy({ ...args, wallet: Wallet.OWallet });
|
|
19
|
-
default:
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const createAllStrategies = (args) => {
|
|
24
|
-
return Object.values(Wallet).reduce((strategies, wallet) => {
|
|
25
|
-
if (strategies[wallet]) {
|
|
26
|
-
return strategies;
|
|
27
|
-
}
|
|
28
|
-
strategies[wallet] = createStrategy({ args, wallet: wallet });
|
|
29
|
-
return strategies;
|
|
30
|
-
}, {});
|
|
31
|
-
};
|
|
32
|
-
export class BaseCosmosWalletStrategy extends BaseWalletStrategy {
|
|
33
|
-
constructor(args) {
|
|
34
|
-
const strategies = createAllStrategies(args);
|
|
35
|
-
super({
|
|
36
|
-
...args,
|
|
37
|
-
strategies,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
setWallet(wallet) {
|
|
41
|
-
this.wallet = isCosmosWallet(wallet) ? wallet : Wallet.Keplr;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export const createCosmosStrategyFactory = (args) => {
|
|
45
|
-
return new BaseCosmosWalletStrategy(args);
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './WalletStrategy.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './WalletStrategy.js';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CosmosWalletStrategy as BaseCosmosWalletStrategy } from '@injectivelabs/wallet-cosmos';
|
|
2
|
-
import type { Wallet } from '@injectivelabs/wallet-base';
|
|
3
|
-
import type { CosmosChainId } from '@injectivelabs/ts-types';
|
|
4
|
-
export declare class CosmosWalletStrategy extends BaseCosmosWalletStrategy {
|
|
5
|
-
constructor(args: {
|
|
6
|
-
chainId: CosmosChainId;
|
|
7
|
-
endpoints?: {
|
|
8
|
-
rest: string;
|
|
9
|
-
rpc: string;
|
|
10
|
-
};
|
|
11
|
-
} & {
|
|
12
|
-
wallet: Wallet;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CosmostationWalletStrategy as BaseCosmostationWalletStrategy } from '@injectivelabs/wallet-cosmostation';
|
|
2
|
-
import type { Wallet } from '@injectivelabs/wallet-base';
|
|
3
|
-
import type { CosmosChainId } from '@injectivelabs/ts-types';
|
|
4
|
-
export declare class CosmostationWalletStrategy extends BaseCosmostationWalletStrategy {
|
|
5
|
-
constructor(args: {
|
|
6
|
-
chainId: CosmosChainId;
|
|
7
|
-
endpoints?: {
|
|
8
|
-
rest: string;
|
|
9
|
-
rpc: string;
|
|
10
|
-
};
|
|
11
|
-
} & {
|
|
12
|
-
wallet: Wallet;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|