@injectivelabs/wallet-cosmos-strategy 1.16.38-alpha.7 → 1.16.38

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.
Files changed (33) hide show
  1. package/dist/cjs/index.d.ts +1 -0
  2. package/dist/cjs/index.js +17 -0
  3. package/dist/cjs/package.json +2 -2
  4. package/dist/cjs/strategy/WalletStrategy.d.ts +8 -0
  5. package/dist/cjs/strategy/WalletStrategy.js +51 -0
  6. package/dist/cjs/strategy/index.d.ts +1 -0
  7. package/dist/cjs/strategy/index.js +17 -0
  8. package/dist/cjs/strategy/strategies/cosmos.d.ts +14 -0
  9. package/dist/cjs/strategy/strategies/cosmos.js +10 -0
  10. package/dist/cjs/strategy/strategies/cosmostation.d.ts +14 -0
  11. package/dist/cjs/strategy/strategies/cosmostation.js +10 -0
  12. package/dist/cjs/strategy/strategies/index.d.ts +2 -0
  13. package/dist/cjs/strategy/strategies/index.js +18 -0
  14. package/dist/cjs/strategy/types.d.ts +6 -0
  15. package/dist/cjs/strategy/types.js +2 -0
  16. package/dist/esm/index.d.ts +1 -18
  17. package/dist/esm/index.js +1 -75
  18. package/dist/esm/package.json +2 -2
  19. package/dist/esm/strategy/WalletStrategy.d.ts +8 -0
  20. package/dist/esm/strategy/WalletStrategy.js +46 -0
  21. package/dist/esm/strategy/index.d.ts +1 -0
  22. package/dist/esm/strategy/index.js +1 -0
  23. package/dist/esm/strategy/strategies/cosmos.d.ts +14 -0
  24. package/dist/esm/strategy/strategies/cosmos.js +6 -0
  25. package/dist/esm/strategy/strategies/cosmostation.d.ts +14 -0
  26. package/dist/esm/strategy/strategies/cosmostation.js +6 -0
  27. package/dist/esm/strategy/strategies/index.d.ts +2 -0
  28. package/dist/esm/strategy/strategies/index.js +2 -0
  29. package/dist/esm/strategy/types.d.ts +6 -0
  30. package/dist/esm/strategy/types.js +1 -0
  31. package/package.json +44 -43
  32. package/dist/cjs/index.cjs +0 -76
  33. package/dist/cjs/index.d.cts +0 -18
@@ -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);
@@ -1,3 +1,3 @@
1
1
  {
2
- "type": "commonjs"
3
- }
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,51 @@
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;
@@ -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 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
+ }
@@ -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 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
+ }
@@ -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 type { Wallet } from '@injectivelabs/wallet-base';
2
+ import type { CosmosChainId } from '@injectivelabs/ts-types';
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 });
@@ -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): Promise<void>;
15
- }
16
- declare const createCosmosStrategyFactory: (args: CosmosWalletStrategyArguments) => BaseCosmosWalletStrategy;
17
- //#endregion
18
- export { BaseCosmosWalletStrategy, createCosmosStrategyFactory };
1
+ export * from './strategy/index.js';
package/dist/esm/index.js CHANGED
@@ -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
- async 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 };
1
+ export * from './strategy/index.js';
@@ -1,3 +1,3 @@
1
1
  {
2
- "type": "module"
3
- }
2
+ "type": "module"
3
+ }
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,46 @@
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
+ };
@@ -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 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
+ }
@@ -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 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
+ }
@@ -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 type { Wallet } from '@injectivelabs/wallet-base';
2
+ import type { CosmosChainId } from '@injectivelabs/ts-types';
3
+ export interface CosmosWalletStrategyArguments {
4
+ chainId: CosmosChainId;
5
+ wallet?: Wallet;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,68 +1,69 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-cosmos-strategy",
3
- "version": "1.16.38-alpha.7",
4
3
  "description": "Wallet Cosmos Strategy with instantiated wallets",
5
- "license": "Apache-2.0",
4
+ "version": "1.16.38",
5
+ "sideEffects": false,
6
+ "type": "module",
6
7
  "author": {
7
8
  "name": "InjectiveLabs",
8
9
  "email": "admin@injectivelabs.org"
9
10
  },
10
- "type": "module",
11
- "sideEffects": false,
11
+ "license": "Apache-2.0",
12
+ "types": "dist/cjs/index.d.ts",
13
+ "main": "dist/cjs/index.js",
14
+ "module": "dist/esm/index.js",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "_moduleAliases": {
19
+ "~wallet-cosmos-strategy": "dist"
20
+ },
12
21
  "exports": {
13
22
  ".": {
14
23
  "react-native": {
15
24
  "import": "./dist/esm/index.js",
16
- "require": "./dist/cjs/index.cjs",
17
- "types": "./dist/cjs/index.d.cts",
18
- "default": "./dist/cjs/index.cjs"
25
+ "require": "./dist/cjs/index.js",
26
+ "types": "./dist/cjs/index.d.ts",
27
+ "default": "./dist/cjs/index.js"
19
28
  },
20
29
  "require": {
21
- "types": "./dist/cjs/index.d.cts",
22
- "default": "./dist/cjs/index.cjs"
30
+ "types": "./dist/cjs/index.d.ts",
31
+ "default": "./dist/cjs/index.js"
23
32
  },
24
33
  "import": {
25
34
  "types": "./dist/esm/index.d.ts",
26
35
  "default": "./dist/esm/index.js"
27
36
  },
28
37
  "default": {
29
- "types": "./dist/cjs/index.d.cts",
30
- "default": "./dist/cjs/index.cjs"
38
+ "types": "./dist/cjs/index.d.ts",
39
+ "default": "./dist/cjs/index.js"
31
40
  }
32
41
  }
33
42
  },
34
- "main": "dist/cjs/index.cjs",
35
- "module": "dist/esm/index.js",
36
- "types": "dist/cjs/index.d.cts",
37
- "files": [
38
- "dist"
39
- ],
40
- "dependencies": {
41
- "@injectivelabs/ts-types": "1.16.38-alpha.3",
42
- "@injectivelabs/wallet-base": "1.16.38-alpha.7",
43
- "@injectivelabs/wallet-core": "1.16.38-alpha.7",
44
- "@injectivelabs/wallet-cosmostation": "1.16.38-alpha.7",
45
- "@injectivelabs/wallet-cosmos": "1.16.38-alpha.7"
46
- },
47
- "publishConfig": {
48
- "access": "public"
49
- },
50
- "_moduleAliases": {
51
- "~wallet-cosmos-strategy": "dist"
52
- },
53
43
  "scripts": {
54
- "build": "pnpm type-check && tsdown",
55
- "build:fast": "tsdown",
56
- "build:watch": "tsdown --watch",
57
- "clean": "shx rm -rf dist coverage *.log junit.xml && shx mkdir -p dist",
58
- "type-check": "tsc --noEmit",
59
- "test": "vitest",
60
- "test:watch": "vitest --watch",
61
- "test:ci": "vitest run --coverage --reporter=verbose",
62
- "coverage": "vitest run --coverage",
44
+ "build": "pnpm build:cjs && pnpm build:esm && pnpm build:post",
45
+ "build:cjs": "tsc --build --force tsconfig.build.json",
46
+ "build:esm": "tsc --build --force tsconfig.build.esm.json",
47
+ "build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && pnpm build:post",
48
+ "build:post": "shx cp ../../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../../etc/stub/package.esm.json.stub dist/esm/package.json",
49
+ "clean": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.esm.json --clean && shx rm -rf coverage *.log junit.xml dist && jest --clearCache && shx mkdir -p dist",
50
+ "test": "jest",
51
+ "test:watch": "jest --watch",
52
+ "test:ci": "jest --coverage --ci --reporters='jest-junit'",
53
+ "coverage": "jest --coverage",
63
54
  "coverage:show": "live-server coverage",
64
55
  "dev": "ts-node -r tsconfig-paths/register src/index.ts",
65
- "start": "node dist/index.js",
66
- "lint": "eslint . --ext .ts,.js"
67
- }
68
- }
56
+ "start": "node dist/index.js"
57
+ },
58
+ "dependencies": {
59
+ "@injectivelabs/ts-types": "1.16.38",
60
+ "@injectivelabs/wallet-base": "1.16.38",
61
+ "@injectivelabs/wallet-core": "1.16.38",
62
+ "@injectivelabs/wallet-cosmos": "1.16.38",
63
+ "@injectivelabs/wallet-cosmostation": "1.16.38"
64
+ },
65
+ "devDependencies": {
66
+ "shx": "^0.3.3"
67
+ },
68
+ "gitHead": "c67633f9ba4c5efb2c969c3df815d54995459966"
69
+ }
@@ -1,76 +0,0 @@
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
- async 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;
@@ -1,18 +0,0 @@
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): Promise<void>;
15
- }
16
- declare const createCosmosStrategyFactory: (args: CosmosWalletStrategyArguments) => BaseCosmosWalletStrategy;
17
- //#endregion
18
- export { BaseCosmosWalletStrategy, createCosmosStrategyFactory };