@dynamic-labs/cosmos 3.0.0-alpha.8 → 3.0.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.
@@ -0,0 +1,73 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../_virtual/_tslib.cjs');
7
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
+ var utils = require('@dynamic-labs/utils');
9
+
10
+ class CosmosWallet extends walletConnectorCore.Wallet {
11
+ getProvider() {
12
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
13
+ const provider = yield this._connector.getProvider();
14
+ if (!provider) {
15
+ throw new Error('unable to retrieve Cosmos provider');
16
+ }
17
+ return utils.cloneObjectWithOverrides(provider, {
18
+ sendEthereumTx: (chainId, tx) => _tslib.__awaiter(this, void 0, void 0, function* () {
19
+ yield this.sync();
20
+ return provider.sendEthereumTx(chainId, tx);
21
+ }),
22
+ sendTx: (chainId, tx, mode) => _tslib.__awaiter(this, void 0, void 0, function* () {
23
+ yield this.sync();
24
+ return provider.sendTx(chainId, tx, mode);
25
+ }),
26
+ signAmino: (chainId, signer, signerDoc, signerOperations) => _tslib.__awaiter(this, void 0, void 0, function* () {
27
+ yield this.sync();
28
+ return provider.signAmino(chainId, signer, signerDoc, signerOperations);
29
+ }),
30
+ signArbitrary: (chainId, signer, data) => _tslib.__awaiter(this, void 0, void 0, function* () {
31
+ yield this.sync();
32
+ return provider.signArbitrary(chainId, signer, data);
33
+ }),
34
+ signDirect: (chainId, signer, signDoc, signOptions) => _tslib.__awaiter(this, void 0, void 0, function* () {
35
+ yield this.sync();
36
+ return provider.signDirect(chainId, signer, signDoc, signOptions);
37
+ }),
38
+ signDirectAux: (chainId, signer, signDoc, signOptions) => _tslib.__awaiter(this, void 0, void 0, function* () {
39
+ yield this.sync();
40
+ return provider.signDirectAux(chainId, signer, signDoc, signOptions);
41
+ }),
42
+ signEthereum: (chainId, signer, data, type) => _tslib.__awaiter(this, void 0, void 0, function* () {
43
+ yield this.sync();
44
+ return provider.signEthereum(chainId, signer, data, type);
45
+ }),
46
+ signICNSAdr36: (chainId, contractAddress, owner, username, addressChainIds) => _tslib.__awaiter(this, void 0, void 0, function* () {
47
+ yield this.sync();
48
+ return provider.signICNSAdr36(chainId, contractAddress, owner, username, addressChainIds);
49
+ }),
50
+ });
51
+ });
52
+ }
53
+ getOfflineSigner() {
54
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
55
+ const offlineSigner = yield this._connector.getOfflineSigner();
56
+ if (!offlineSigner) {
57
+ throw new Error('unable to retrieve Cosmos offline signer');
58
+ }
59
+ return utils.cloneObjectWithOverrides(offlineSigner, {
60
+ signAmino: (signerAddress, signerDoc) => _tslib.__awaiter(this, void 0, void 0, function* () {
61
+ yield this.sync();
62
+ return offlineSigner.signAmino(signerAddress, signerDoc);
63
+ }),
64
+ signDirect: (signerAddress, signDoc) => _tslib.__awaiter(this, void 0, void 0, function* () {
65
+ yield this.sync();
66
+ return offlineSigner.signDirect(signerAddress, signDoc);
67
+ }),
68
+ });
69
+ });
70
+ }
71
+ }
72
+
73
+ exports.CosmosWallet = CosmosWallet;
@@ -0,0 +1,7 @@
1
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
+ import { CosmosWalletConnector } from '../connectors';
3
+ import { ICosmosOfflineSigner, ICosmosProvider } from '../types';
4
+ export declare class CosmosWallet extends Wallet<CosmosWalletConnector> {
5
+ getProvider(): Promise<ICosmosProvider>;
6
+ getOfflineSigner(): Promise<ICosmosOfflineSigner>;
7
+ }
@@ -0,0 +1,69 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../_virtual/_tslib.js';
3
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
4
+ import { cloneObjectWithOverrides } from '@dynamic-labs/utils';
5
+
6
+ class CosmosWallet extends Wallet {
7
+ getProvider() {
8
+ return __awaiter(this, void 0, void 0, function* () {
9
+ const provider = yield this._connector.getProvider();
10
+ if (!provider) {
11
+ throw new Error('unable to retrieve Cosmos provider');
12
+ }
13
+ return cloneObjectWithOverrides(provider, {
14
+ sendEthereumTx: (chainId, tx) => __awaiter(this, void 0, void 0, function* () {
15
+ yield this.sync();
16
+ return provider.sendEthereumTx(chainId, tx);
17
+ }),
18
+ sendTx: (chainId, tx, mode) => __awaiter(this, void 0, void 0, function* () {
19
+ yield this.sync();
20
+ return provider.sendTx(chainId, tx, mode);
21
+ }),
22
+ signAmino: (chainId, signer, signerDoc, signerOperations) => __awaiter(this, void 0, void 0, function* () {
23
+ yield this.sync();
24
+ return provider.signAmino(chainId, signer, signerDoc, signerOperations);
25
+ }),
26
+ signArbitrary: (chainId, signer, data) => __awaiter(this, void 0, void 0, function* () {
27
+ yield this.sync();
28
+ return provider.signArbitrary(chainId, signer, data);
29
+ }),
30
+ signDirect: (chainId, signer, signDoc, signOptions) => __awaiter(this, void 0, void 0, function* () {
31
+ yield this.sync();
32
+ return provider.signDirect(chainId, signer, signDoc, signOptions);
33
+ }),
34
+ signDirectAux: (chainId, signer, signDoc, signOptions) => __awaiter(this, void 0, void 0, function* () {
35
+ yield this.sync();
36
+ return provider.signDirectAux(chainId, signer, signDoc, signOptions);
37
+ }),
38
+ signEthereum: (chainId, signer, data, type) => __awaiter(this, void 0, void 0, function* () {
39
+ yield this.sync();
40
+ return provider.signEthereum(chainId, signer, data, type);
41
+ }),
42
+ signICNSAdr36: (chainId, contractAddress, owner, username, addressChainIds) => __awaiter(this, void 0, void 0, function* () {
43
+ yield this.sync();
44
+ return provider.signICNSAdr36(chainId, contractAddress, owner, username, addressChainIds);
45
+ }),
46
+ });
47
+ });
48
+ }
49
+ getOfflineSigner() {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const offlineSigner = yield this._connector.getOfflineSigner();
52
+ if (!offlineSigner) {
53
+ throw new Error('unable to retrieve Cosmos offline signer');
54
+ }
55
+ return cloneObjectWithOverrides(offlineSigner, {
56
+ signAmino: (signerAddress, signerDoc) => __awaiter(this, void 0, void 0, function* () {
57
+ yield this.sync();
58
+ return offlineSigner.signAmino(signerAddress, signerDoc);
59
+ }),
60
+ signDirect: (signerAddress, signDoc) => __awaiter(this, void 0, void 0, function* () {
61
+ yield this.sync();
62
+ return offlineSigner.signDirect(signerAddress, signDoc);
63
+ }),
64
+ });
65
+ });
66
+ }
67
+ }
68
+
69
+ export { CosmosWallet };
@@ -0,0 +1,2 @@
1
+ export * from './CosmosWallet';
2
+ export * from './isCosmosWallet';
@@ -0,0 +1 @@
1
+ export * from './isCosmosWallet';
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const isCosmosWallet = (wallet) => wallet.chain === 'COSMOS';
7
+
8
+ exports.isCosmosWallet = isCosmosWallet;
@@ -0,0 +1,3 @@
1
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
+ import { CosmosWallet } from '../CosmosWallet';
3
+ export declare const isCosmosWallet: (wallet: Wallet) => wallet is CosmosWallet;
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ const isCosmosWallet = (wallet) => wallet.chain === 'COSMOS';
3
+
4
+ export { isCosmosWallet };