@dynamic-labs/cosmos 3.0.0 → 3.0.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.
- package/CHANGELOG.md +15 -0
- package/package.json +5 -5
- package/src/wallet/CosmosWallet.cjs +56 -44
- package/src/wallet/CosmosWallet.js +57 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
### [3.0.2](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.1...v3.0.2) (2024-09-13)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* solana and cosmos signers not working properly ([#6897](https://github.com/dynamic-labs/DynamicAuth/issues/6897)) ([6e27c08](https://github.com/dynamic-labs/DynamicAuth/commit/6e27c0817f8f0a454eaa14ff56a430072f9730e3))
|
|
8
|
+
|
|
9
|
+
### [3.0.1](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0...v3.0.1) (2024-09-13)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* create v2 embedded wallet experience in manual mode ([#6887](https://github.com/dynamic-labs/DynamicAuth/issues/6887)) ([#6891](https://github.com/dynamic-labs/DynamicAuth/issues/6891)) ([64d027b](https://github.com/dynamic-labs/DynamicAuth/commit/64d027b4b5d877845551eae23c666d7863f7109d))
|
|
15
|
+
* solana pk export format ([#6888](https://github.com/dynamic-labs/DynamicAuth/issues/6888)) ([#6890](https://github.com/dynamic-labs/DynamicAuth/issues/6890)) ([cb68997](https://github.com/dynamic-labs/DynamicAuth/commit/cb68997970ccf53734b7d296153185b4866c7f94))
|
|
16
|
+
|
|
2
17
|
## [3.0.0](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.68...v3.0.0) (2024-09-13)
|
|
3
18
|
|
|
4
19
|
## [3.0.0-alpha.68](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.67...v3.0.0-alpha.68) (2024-09-12)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/cosmos",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@keplr-wallet/types": "0.12.121",
|
|
30
|
-
"@dynamic-labs/types": "3.0.
|
|
31
|
-
"@dynamic-labs/utils": "3.0.
|
|
32
|
-
"@dynamic-labs/wallet-book": "3.0.
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "3.0.
|
|
30
|
+
"@dynamic-labs/types": "3.0.2",
|
|
31
|
+
"@dynamic-labs/utils": "3.0.2",
|
|
32
|
+
"@dynamic-labs/wallet-book": "3.0.2",
|
|
33
|
+
"@dynamic-labs/wallet-connector-core": "3.0.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {}
|
|
36
36
|
}
|
|
@@ -14,40 +14,46 @@ class CosmosWallet extends walletConnectorCore.Wallet {
|
|
|
14
14
|
if (!provider) {
|
|
15
15
|
throw new Error('unable to retrieve Cosmos provider');
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
17
|
+
try {
|
|
18
|
+
return utils.cloneObjectWithOverrides(provider, {
|
|
19
|
+
sendEthereumTx: (chainId, tx) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
yield this.sync();
|
|
21
|
+
return provider.sendEthereumTx(chainId, tx);
|
|
22
|
+
}),
|
|
23
|
+
sendTx: (chainId, tx, mode) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
yield this.sync();
|
|
25
|
+
return provider.sendTx(chainId, tx, mode);
|
|
26
|
+
}),
|
|
27
|
+
signAmino: (chainId, signer, signerDoc, signerOperations) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
yield this.sync();
|
|
29
|
+
return provider.signAmino(chainId, signer, signerDoc, signerOperations);
|
|
30
|
+
}),
|
|
31
|
+
signArbitrary: (chainId, signer, data) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield this.sync();
|
|
33
|
+
return provider.signArbitrary(chainId, signer, data);
|
|
34
|
+
}),
|
|
35
|
+
signDirect: (chainId, signer, signDoc, signOptions) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield this.sync();
|
|
37
|
+
return provider.signDirect(chainId, signer, signDoc, signOptions);
|
|
38
|
+
}),
|
|
39
|
+
signDirectAux: (chainId, signer, signDoc, signOptions) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
yield this.sync();
|
|
41
|
+
return provider.signDirectAux(chainId, signer, signDoc, signOptions);
|
|
42
|
+
}),
|
|
43
|
+
signEthereum: (chainId, signer, data, type) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
yield this.sync();
|
|
45
|
+
return provider.signEthereum(chainId, signer, data, type);
|
|
46
|
+
}),
|
|
47
|
+
signICNSAdr36: (chainId, contractAddress, owner, username, addressChainIds) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
yield this.sync();
|
|
49
|
+
return provider.signICNSAdr36(chainId, contractAddress, owner, username, addressChainIds);
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
walletConnectorCore.logger.warn(`Failed to add logic to auto-sync the wallet. Provider might be out of sync for wallet: ${this._connector.name} (${this.address})`, error);
|
|
55
|
+
return provider;
|
|
56
|
+
}
|
|
51
57
|
});
|
|
52
58
|
}
|
|
53
59
|
getOfflineSigner() {
|
|
@@ -56,16 +62,22 @@ class CosmosWallet extends walletConnectorCore.Wallet {
|
|
|
56
62
|
if (!offlineSigner) {
|
|
57
63
|
throw new Error('unable to retrieve Cosmos offline signer');
|
|
58
64
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
try {
|
|
66
|
+
return utils.cloneObjectWithOverrides(offlineSigner, {
|
|
67
|
+
signAmino: (signerAddress, signerDoc) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
yield this.sync();
|
|
69
|
+
return offlineSigner.signAmino(signerAddress, signerDoc);
|
|
70
|
+
}),
|
|
71
|
+
signDirect: (signerAddress, signDoc) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
yield this.sync();
|
|
73
|
+
return offlineSigner.signDirect(signerAddress, signDoc);
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
walletConnectorCore.logger.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`, error);
|
|
79
|
+
return offlineSigner;
|
|
80
|
+
}
|
|
69
81
|
});
|
|
70
82
|
}
|
|
71
83
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
-
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { Wallet, logger } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { cloneObjectWithOverrides } from '@dynamic-labs/utils';
|
|
5
5
|
|
|
6
6
|
class CosmosWallet extends Wallet {
|
|
@@ -10,40 +10,46 @@ class CosmosWallet extends Wallet {
|
|
|
10
10
|
if (!provider) {
|
|
11
11
|
throw new Error('unable to retrieve Cosmos provider');
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
13
|
+
try {
|
|
14
|
+
return cloneObjectWithOverrides(provider, {
|
|
15
|
+
sendEthereumTx: (chainId, tx) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
yield this.sync();
|
|
17
|
+
return provider.sendEthereumTx(chainId, tx);
|
|
18
|
+
}),
|
|
19
|
+
sendTx: (chainId, tx, mode) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
yield this.sync();
|
|
21
|
+
return provider.sendTx(chainId, tx, mode);
|
|
22
|
+
}),
|
|
23
|
+
signAmino: (chainId, signer, signerDoc, signerOperations) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
yield this.sync();
|
|
25
|
+
return provider.signAmino(chainId, signer, signerDoc, signerOperations);
|
|
26
|
+
}),
|
|
27
|
+
signArbitrary: (chainId, signer, data) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
yield this.sync();
|
|
29
|
+
return provider.signArbitrary(chainId, signer, data);
|
|
30
|
+
}),
|
|
31
|
+
signDirect: (chainId, signer, signDoc, signOptions) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield this.sync();
|
|
33
|
+
return provider.signDirect(chainId, signer, signDoc, signOptions);
|
|
34
|
+
}),
|
|
35
|
+
signDirectAux: (chainId, signer, signDoc, signOptions) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield this.sync();
|
|
37
|
+
return provider.signDirectAux(chainId, signer, signDoc, signOptions);
|
|
38
|
+
}),
|
|
39
|
+
signEthereum: (chainId, signer, data, type) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
yield this.sync();
|
|
41
|
+
return provider.signEthereum(chainId, signer, data, type);
|
|
42
|
+
}),
|
|
43
|
+
signICNSAdr36: (chainId, contractAddress, owner, username, addressChainIds) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
yield this.sync();
|
|
45
|
+
return provider.signICNSAdr36(chainId, contractAddress, owner, username, addressChainIds);
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
logger.warn(`Failed to add logic to auto-sync the wallet. Provider might be out of sync for wallet: ${this._connector.name} (${this.address})`, error);
|
|
51
|
+
return provider;
|
|
52
|
+
}
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
55
|
getOfflineSigner() {
|
|
@@ -52,16 +58,22 @@ class CosmosWallet extends Wallet {
|
|
|
52
58
|
if (!offlineSigner) {
|
|
53
59
|
throw new Error('unable to retrieve Cosmos offline signer');
|
|
54
60
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
try {
|
|
62
|
+
return cloneObjectWithOverrides(offlineSigner, {
|
|
63
|
+
signAmino: (signerAddress, signerDoc) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
yield this.sync();
|
|
65
|
+
return offlineSigner.signAmino(signerAddress, signerDoc);
|
|
66
|
+
}),
|
|
67
|
+
signDirect: (signerAddress, signDoc) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
yield this.sync();
|
|
69
|
+
return offlineSigner.signDirect(signerAddress, signDoc);
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
logger.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`, error);
|
|
75
|
+
return offlineSigner;
|
|
76
|
+
}
|
|
65
77
|
});
|
|
66
78
|
}
|
|
67
79
|
}
|