@injectivelabs/wallet-cosmos-strategy 1.16.25-alpha.1 → 1.16.26
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.d.ts +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/package.json +2 -2
- package/dist/cjs/strategy/WalletStrategy.d.ts +8 -0
- package/dist/cjs/strategy/WalletStrategy.js +51 -0
- package/dist/cjs/strategy/index.d.ts +1 -0
- package/dist/cjs/strategy/index.js +17 -0
- package/dist/cjs/strategy/strategies/cosmos.d.ts +14 -0
- package/dist/cjs/strategy/strategies/cosmos.js +10 -0
- package/dist/cjs/strategy/strategies/cosmostation.d.ts +14 -0
- package/dist/cjs/strategy/strategies/cosmostation.js +10 -0
- package/dist/cjs/strategy/strategies/index.d.ts +2 -0
- package/dist/cjs/strategy/strategies/index.js +18 -0
- package/dist/cjs/strategy/types.d.ts +6 -0
- package/dist/cjs/strategy/types.js +2 -0
- package/dist/esm/index.d.ts +1 -18
- package/dist/esm/index.js +1 -75
- package/dist/esm/package.json +2 -2
- package/dist/esm/strategy/WalletStrategy.d.ts +8 -0
- package/dist/esm/strategy/WalletStrategy.js +46 -0
- package/dist/esm/strategy/index.d.ts +1 -0
- package/dist/esm/strategy/index.js +1 -0
- package/dist/esm/strategy/strategies/cosmos.d.ts +14 -0
- package/dist/esm/strategy/strategies/cosmos.js +6 -0
- package/dist/esm/strategy/strategies/cosmostation.d.ts +14 -0
- package/dist/esm/strategy/strategies/cosmostation.js +6 -0
- package/dist/esm/strategy/strategies/index.d.ts +2 -0
- package/dist/esm/strategy/strategies/index.js +2 -0
- package/dist/esm/strategy/types.d.ts +6 -0
- package/dist/esm/strategy/types.js +1 -0
- package/package.json +18 -18
- package/dist/cjs/index.cjs +0 -76
- 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);
|
package/dist/cjs/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
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,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);
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
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 };
|
|
1
|
+
export * from './strategy/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,75 +1 @@
|
|
|
1
|
-
|
|
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 };
|
|
1
|
+
export * from './strategy/index.js';
|
package/dist/esm/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
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,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 @@
|
|
|
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.16.
|
|
4
|
+
"version": "1.16.26",
|
|
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
|
-
"
|
|
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",
|
|
53
54
|
"coverage:show": "live-server coverage",
|
|
54
55
|
"dev": "ts-node -r tsconfig-paths/register src/index.ts",
|
|
55
|
-
"start": "node dist/index.js"
|
|
56
|
-
"lint": "eslint . --ext .ts,.js"
|
|
56
|
+
"start": "node dist/index.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.26",
|
|
60
|
+
"@injectivelabs/wallet-base": "1.16.26",
|
|
61
|
+
"@injectivelabs/wallet-core": "1.16.26",
|
|
62
|
+
"@injectivelabs/wallet-cosmos": "1.16.26",
|
|
63
|
+
"@injectivelabs/wallet-cosmostation": "1.16.26"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"shx": "^0.3.3"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "cc507916c46b41e6bc70a01744e23d43b12ebc65"
|
|
69
69
|
}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -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
|
-
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;
|
package/dist/cjs/index.d.cts
DELETED
|
@@ -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): void;
|
|
15
|
-
}
|
|
16
|
-
declare const createCosmosStrategyFactory: (args: CosmosWalletStrategyArguments) => BaseCosmosWalletStrategy;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { BaseCosmosWalletStrategy, createCosmosStrategyFactory };
|