@interchain-kit/store 0.6.0 → 0.8.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/README.md
CHANGED
|
@@ -30,19 +30,21 @@ npm install store
|
|
|
30
30
|
When first cloning the repo:
|
|
31
31
|
|
|
32
32
|
```sh
|
|
33
|
-
|
|
33
|
+
pnpm
|
|
34
34
|
# build the prod packages. When devs would like to navigate to the source code, this will only navigate from references to their definitions (.d.ts files) between packages.
|
|
35
|
-
|
|
35
|
+
pnpm build
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Or if you want to make your dev process smoother, you can run:
|
|
39
39
|
|
|
40
40
|
```sh
|
|
41
|
-
|
|
41
|
+
pnpm
|
|
42
42
|
# build the dev packages with .map files, this enables navigation from references to their source code between packages.
|
|
43
|
-
|
|
43
|
+
pnpm build:dev
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
---
|
|
47
|
+
|
|
46
48
|
## Interchain JavaScript Stack
|
|
47
49
|
|
|
48
50
|
A unified toolkit for building applications and smart contracts in the Interchain ecosystem ⚛️
|
|
@@ -65,6 +67,6 @@ A unified toolkit for building applications and smart contracts in the Interchai
|
|
|
65
67
|
|
|
66
68
|
## Disclaimer
|
|
67
69
|
|
|
68
|
-
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED
|
|
70
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
69
71
|
|
|
70
72
|
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
|
package/esm/store/index.js
CHANGED
|
@@ -65,6 +65,20 @@ export class InterchainStore {
|
|
|
65
65
|
else {
|
|
66
66
|
this.addChainWalletState(walletName, chainName, state);
|
|
67
67
|
}
|
|
68
|
+
switch (state.walletState) {
|
|
69
|
+
case WalletState.Connected:
|
|
70
|
+
this.setCurrentWalletName(walletName);
|
|
71
|
+
this.setCurrentChainName(chainName);
|
|
72
|
+
break;
|
|
73
|
+
case WalletState.Disconnected:
|
|
74
|
+
if (this.state.currentWalletName === walletName && this.state.currentChainName === chainName) {
|
|
75
|
+
// TODO: for supporting multiple wallet connections,
|
|
76
|
+
// we should set these to the previous instead of clearing
|
|
77
|
+
this.setCurrentWalletName('');
|
|
78
|
+
this.setCurrentChainName('');
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
68
82
|
}
|
|
69
83
|
// 添加新的 chain wallet state
|
|
70
84
|
addChainWalletState(walletName, chainName, state) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletManager, WalletState } from '@interchain-kit/core';
|
|
2
2
|
import { createCosmosQueryClient } from '@interchainjs/cosmos';
|
|
3
|
-
import { getSigner } from 'interchainjs';
|
|
3
|
+
import { getSigner, COSMOS_DIRECT, COSMOS_AMINO } from 'interchainjs';
|
|
4
4
|
import { createProxiedWallet } from '../proxied-wallets';
|
|
5
5
|
import { InterchainStore } from '../store';
|
|
6
6
|
import { LocalStorage } from '../utils/local-storage';
|
|
@@ -218,13 +218,13 @@ export class WalletManagerStore {
|
|
|
218
218
|
};
|
|
219
219
|
if (preferredSignType === 'direct') {
|
|
220
220
|
return getSigner(offlineSigner, {
|
|
221
|
-
preferredSignType:
|
|
221
|
+
preferredSignType: COSMOS_DIRECT,
|
|
222
222
|
signerOptions,
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
else {
|
|
226
226
|
return getSigner(offlineSigner, {
|
|
227
|
-
preferredSignType:
|
|
227
|
+
preferredSignType: COSMOS_AMINO,
|
|
228
228
|
signerOptions,
|
|
229
229
|
});
|
|
230
230
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interchain-kit/store",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"author": "Hyperweb <developers@hyperweb.io>",
|
|
5
5
|
"description": "interchain-kit wallet connector store package",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "esm/index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"homepage": "https://github.com/interchain-kit/store",
|
|
10
|
-
"license": "
|
|
10
|
+
"license": "MIT",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public",
|
|
13
13
|
"directory": "dist"
|
|
@@ -20,16 +20,25 @@
|
|
|
20
20
|
"url": "https://github.com/interchain-kit/interchain-kit/issues"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"prepare": "npm run build",
|
|
26
|
-
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
|
|
23
|
+
"clean": "makage clean",
|
|
24
|
+
"build": "makage build",
|
|
27
25
|
"build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
|
|
28
26
|
"lint": "eslint . --fix",
|
|
29
27
|
"test": "jest",
|
|
30
28
|
"test:watch": "jest --watch",
|
|
31
|
-
"watch:dev": "tsc -w -p tsconfig.esm.json & tsc -w"
|
|
29
|
+
"watch:dev": "tsc -w -p tsconfig.esm.json & tsc -w",
|
|
30
|
+
"prepack": "npm run build"
|
|
32
31
|
},
|
|
33
32
|
"keywords": [],
|
|
34
|
-
"
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"makage": "^0.1.12"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@chain-registry/types": "^2.0.1",
|
|
38
|
+
"@interchain-kit/core": "0.9.0",
|
|
39
|
+
"@interchainjs/cosmos": "1.20.0",
|
|
40
|
+
"@interchainjs/types": "1.20.0",
|
|
41
|
+
"interchainjs": "1.20.0"
|
|
42
|
+
},
|
|
43
|
+
"gitHead": "980945a1ae65907c7fda4430647f0cd1fb1b7f61"
|
|
35
44
|
}
|
package/store/index.js
CHANGED
|
@@ -68,6 +68,20 @@ class InterchainStore {
|
|
|
68
68
|
else {
|
|
69
69
|
this.addChainWalletState(walletName, chainName, state);
|
|
70
70
|
}
|
|
71
|
+
switch (state.walletState) {
|
|
72
|
+
case core_1.WalletState.Connected:
|
|
73
|
+
this.setCurrentWalletName(walletName);
|
|
74
|
+
this.setCurrentChainName(chainName);
|
|
75
|
+
break;
|
|
76
|
+
case core_1.WalletState.Disconnected:
|
|
77
|
+
if (this.state.currentWalletName === walletName && this.state.currentChainName === chainName) {
|
|
78
|
+
// TODO: for supporting multiple wallet connections,
|
|
79
|
+
// we should set these to the previous instead of clearing
|
|
80
|
+
this.setCurrentWalletName('');
|
|
81
|
+
this.setCurrentChainName('');
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
71
85
|
}
|
|
72
86
|
// 添加新的 chain wallet state
|
|
73
87
|
addChainWalletState(walletName, chainName, state) {
|
|
@@ -221,13 +221,13 @@ class WalletManagerStore {
|
|
|
221
221
|
};
|
|
222
222
|
if (preferredSignType === 'direct') {
|
|
223
223
|
return (0, interchainjs_1.getSigner)(offlineSigner, {
|
|
224
|
-
preferredSignType:
|
|
224
|
+
preferredSignType: interchainjs_1.COSMOS_DIRECT,
|
|
225
225
|
signerOptions,
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
else {
|
|
229
229
|
return (0, interchainjs_1.getSigner)(offlineSigner, {
|
|
230
|
-
preferredSignType:
|
|
230
|
+
preferredSignType: interchainjs_1.COSMOS_AMINO,
|
|
231
231
|
signerOptions,
|
|
232
232
|
});
|
|
233
233
|
}
|