@injectivelabs/wallet-cosmos-strategy 1.15.0 → 1.15.2

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.
@@ -0,0 +1 @@
1
+ export * from './strategy/index.js';
@@ -0,0 +1,17 @@
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);
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,8 @@
1
+ import { Wallet } from '@injectivelabs/wallet-base';
2
+ import { BaseWalletStrategy } from '@injectivelabs/wallet-core';
3
+ import { 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;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCosmosStrategyFactory = exports.BaseCosmosWalletStrategy = void 0;
4
+ const wallet_base_1 = require("@injectivelabs/wallet-base");
5
+ const wallet_core_1 = require("@injectivelabs/wallet-core");
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;
@@ -0,0 +1 @@
1
+ export * from './WalletStrategy.js';
@@ -0,0 +1,17 @@
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);
@@ -0,0 +1,14 @@
1
+ import { CosmosWalletStrategy as BaseCosmosWalletStrategy } from '@injectivelabs/wallet-cosmos';
2
+ import { CosmosChainId } from '@injectivelabs/ts-types';
3
+ import { Wallet } from '@injectivelabs/wallet-base';
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
+ }
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,14 @@
1
+ import { CosmostationWalletStrategy as BaseCosmostationWalletStrategy } from '@injectivelabs/wallet-cosmostation';
2
+ import { CosmosChainId } from '@injectivelabs/ts-types';
3
+ import { Wallet } from '@injectivelabs/wallet-base';
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
+ }
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,2 @@
1
+ export * from './cosmos.js';
2
+ export * from './cosmostation.js';
@@ -0,0 +1,18 @@
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);
@@ -0,0 +1,6 @@
1
+ import { CosmosChainId } from "@injectivelabs/ts-types";
2
+ import { Wallet } from '@injectivelabs/wallet-base';
3
+ export interface CosmosWalletStrategyArguments {
4
+ chainId: CosmosChainId;
5
+ wallet?: Wallet;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './strategy/index.js';
@@ -0,0 +1 @@
1
+ export * from './strategy/index.js';
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,8 @@
1
+ import { Wallet } from '@injectivelabs/wallet-base';
2
+ import { BaseWalletStrategy } from '@injectivelabs/wallet-core';
3
+ import { 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;
@@ -0,0 +1,46 @@
1
+ import { Wallet, isCosmosWallet, } from '@injectivelabs/wallet-base';
2
+ import { BaseWalletStrategy } from '@injectivelabs/wallet-core';
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
+ };
@@ -0,0 +1 @@
1
+ export * from './WalletStrategy.js';
@@ -0,0 +1 @@
1
+ export * from './WalletStrategy.js';
@@ -0,0 +1,14 @@
1
+ import { CosmosWalletStrategy as BaseCosmosWalletStrategy } from '@injectivelabs/wallet-cosmos';
2
+ import { CosmosChainId } from '@injectivelabs/ts-types';
3
+ import { Wallet } from '@injectivelabs/wallet-base';
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
+ }
@@ -0,0 +1,6 @@
1
+ import { CosmosWalletStrategy as BaseCosmosWalletStrategy } from '@injectivelabs/wallet-cosmos';
2
+ export class CosmosWalletStrategy extends BaseCosmosWalletStrategy {
3
+ constructor(args) {
4
+ super(args);
5
+ }
6
+ }
@@ -0,0 +1,14 @@
1
+ import { CosmostationWalletStrategy as BaseCosmostationWalletStrategy } from '@injectivelabs/wallet-cosmostation';
2
+ import { CosmosChainId } from '@injectivelabs/ts-types';
3
+ import { Wallet } from '@injectivelabs/wallet-base';
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
+ }
@@ -0,0 +1,6 @@
1
+ import { CosmostationWalletStrategy as BaseCosmostationWalletStrategy } from '@injectivelabs/wallet-cosmostation';
2
+ export class CosmostationWalletStrategy extends BaseCosmostationWalletStrategy {
3
+ constructor(args) {
4
+ super(args);
5
+ }
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from './cosmos.js';
2
+ export * from './cosmostation.js';
@@ -0,0 +1,2 @@
1
+ export * from './cosmos.js';
2
+ export * from './cosmostation.js';
@@ -0,0 +1,6 @@
1
+ import { CosmosChainId } from "@injectivelabs/ts-types";
2
+ import { Wallet } from '@injectivelabs/wallet-base';
3
+ export interface CosmosWalletStrategyArguments {
4
+ chainId: CosmosChainId;
5
+ wallet?: Wallet;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
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.15.0",
4
+ "version": "1.15.2",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "author": {
@@ -56,14 +56,14 @@
56
56
  "start": "node dist/index.js"
57
57
  },
58
58
  "dependencies": {
59
- "@injectivelabs/ts-types": "^1.15.0",
60
- "@injectivelabs/wallet-base": "^1.15.0",
61
- "@injectivelabs/wallet-core": "^1.15.0",
62
- "@injectivelabs/wallet-cosmos": "^1.15.0",
63
- "@injectivelabs/wallet-cosmostation": "^1.15.0"
59
+ "@injectivelabs/ts-types": "^1.15.2",
60
+ "@injectivelabs/wallet-base": "^1.15.2",
61
+ "@injectivelabs/wallet-core": "^1.15.2",
62
+ "@injectivelabs/wallet-cosmos": "^1.15.2",
63
+ "@injectivelabs/wallet-cosmostation": "^1.15.2"
64
64
  },
65
65
  "devDependencies": {
66
66
  "shx": "^0.3.3"
67
67
  },
68
- "gitHead": "acae5b41a4c8a0ac4f137cce434b9db81800a1c5"
68
+ "gitHead": "64a57f3115b63114124d0d1fb61f75e520905499"
69
69
  }