@rango-dev/provider-walletconnect-2 0.7.1-next.0 → 0.7.1-next.1
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/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/signers/cosmos.d.ts +3 -4
- package/dist/signers/cosmos.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/signers/cosmos.ts +30 -25
package/dist/signers/cosmos.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { SignClient } from '@walletconnect/sign-client/dist/types/client';
|
|
2
|
-
import { SessionTypes } from '@walletconnect/types';
|
|
3
|
-
import type { GenericSigner } from 'rango-types';
|
|
4
|
-
import { CosmosTransaction } from 'rango-types';
|
|
1
|
+
import type { SignClient } from '@walletconnect/sign-client/dist/types/client';
|
|
2
|
+
import type { SessionTypes } from '@walletconnect/types';
|
|
3
|
+
import type { CosmosTransaction, GenericSigner } from 'rango-types';
|
|
5
4
|
declare class COSMOSSigner implements GenericSigner<CosmosTransaction> {
|
|
6
5
|
private client;
|
|
7
6
|
private session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../../src/signers/cosmos.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../../src/signers/cosmos.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA+BpE,cAAM,YAAa,YAAW,aAAa,CAAC,iBAAiB,CAAC;IAC5D,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAsB;gBAEzB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM;IAK/C,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAIrC,aAAa,CACjB,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAyJ5B,OAAO,CAAC,iCAAiC;CAyC1C;AAED,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-walletconnect-2",
|
|
3
|
-
"version": "0.7.1-next.
|
|
3
|
+
"version": "0.7.1-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@cosmjs/launchpad": "^0.27.1",
|
|
24
24
|
"@keplr-wallet/cosmos": "^0.9.12",
|
|
25
25
|
"@keplr-wallet/simple-fetch": "^0.12.14",
|
|
26
|
-
"@rango-dev/signer-cosmos": "^0.14.0",
|
|
26
|
+
"@rango-dev/signer-cosmos": "^0.14.1-next.0",
|
|
27
27
|
"@rango-dev/signer-evm": "^0.14.0",
|
|
28
28
|
"@rango-dev/signer-solana": "^0.14.0",
|
|
29
29
|
"@rango-dev/wallets-shared": "^0.14.0",
|
package/src/signers/cosmos.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { AminoSignResponse } from '@cosmjs/launchpad';
|
|
2
|
+
import type { SignClient } from '@walletconnect/sign-client/dist/types/client';
|
|
3
|
+
import type { SessionTypes } from '@walletconnect/types';
|
|
4
|
+
import type { CosmosTransaction, GenericSigner } from 'rango-types';
|
|
5
|
+
|
|
6
|
+
import { BroadcastMode, makeSignDoc } from '@cosmjs/launchpad';
|
|
7
|
+
import { cosmos } from '@keplr-wallet/cosmos';
|
|
8
|
+
import { getsignedTx } from '@rango-dev/signer-cosmos';
|
|
9
|
+
import { uint8ArrayToHex } from '@rango-dev/wallets-shared';
|
|
3
10
|
import { AccountId, ChainId } from 'caip';
|
|
4
|
-
import
|
|
5
|
-
import { SignerError,
|
|
11
|
+
import { formatDirectSignDoc, stringifySignDocValues } from 'cosmos-wallet';
|
|
12
|
+
import { SignerError, SignerErrorCode } from 'rango-types';
|
|
13
|
+
|
|
6
14
|
import { CosmosRPCMethods, NAMESPACES } from '../constants';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
AminoSignResponse,
|
|
10
|
-
BroadcastMode,
|
|
11
|
-
makeSignDoc,
|
|
12
|
-
} from '@cosmjs/launchpad';
|
|
15
|
+
|
|
13
16
|
import { sendTx } from './helper';
|
|
14
17
|
import { supportedChains } from './mock';
|
|
15
|
-
import { uint8ArrayToHex } from '@rango-dev/wallets-shared';
|
|
16
|
-
import { cosmos } from '@keplr-wallet/cosmos';
|
|
17
|
-
import { formatDirectSignDoc, stringifySignDocValues } from 'cosmos-wallet';
|
|
18
18
|
|
|
19
19
|
const NAMESPACE_NAME = NAMESPACES.COSMOS;
|
|
20
20
|
type DirectSignResponse = {
|
|
@@ -60,22 +60,25 @@ class COSMOSSigner implements GenericSigner<CosmosTransaction> {
|
|
|
60
60
|
const { memo, sequence, account_number, chainId, msgs, fee, signType } =
|
|
61
61
|
tx.data;
|
|
62
62
|
const msgsWithoutType = msgs.map((m) => ({
|
|
63
|
-
...
|
|
63
|
+
...m,
|
|
64
64
|
__type: undefined,
|
|
65
65
|
'@type': undefined,
|
|
66
66
|
}));
|
|
67
|
-
if (!chainId)
|
|
67
|
+
if (!chainId) {
|
|
68
68
|
throw SignerError.AssertionFailed('chainId is undefined from server');
|
|
69
|
-
|
|
69
|
+
}
|
|
70
|
+
if (!account_number) {
|
|
70
71
|
throw SignerError.AssertionFailed(
|
|
71
72
|
'account_number is undefined from server'
|
|
72
73
|
);
|
|
73
|
-
|
|
74
|
+
}
|
|
75
|
+
if (!sequence) {
|
|
74
76
|
throw SignerError.AssertionFailed('sequence is undefined from server');
|
|
77
|
+
}
|
|
75
78
|
|
|
76
79
|
if (signType === 'AMINO') {
|
|
77
80
|
const signDoc = makeSignDoc(
|
|
78
|
-
msgsWithoutType
|
|
81
|
+
msgsWithoutType,
|
|
79
82
|
fee as any,
|
|
80
83
|
chainId,
|
|
81
84
|
memo || undefined,
|
|
@@ -185,15 +188,17 @@ class COSMOSSigner implements GenericSigner<CosmosTransaction> {
|
|
|
185
188
|
console.log({ result });
|
|
186
189
|
|
|
187
190
|
return { hash: uint8ArrayToHex(result) };
|
|
188
|
-
} else {
|
|
189
|
-
throw new SignerError(
|
|
190
|
-
SignerErrorCode.OPERATION_UNSUPPORTED,
|
|
191
|
-
`Sign type for cosmos not supported, type: ${signType}`
|
|
192
|
-
);
|
|
193
191
|
}
|
|
192
|
+
throw new SignerError(
|
|
193
|
+
SignerErrorCode.OPERATION_UNSUPPORTED,
|
|
194
|
+
`Sign type for cosmos not supported, type: ${signType}`
|
|
195
|
+
);
|
|
194
196
|
} catch (err) {
|
|
195
|
-
if (SignerError.isSignerError(err))
|
|
196
|
-
|
|
197
|
+
if (SignerError.isSignerError(err)) {
|
|
198
|
+
throw err;
|
|
199
|
+
} else {
|
|
200
|
+
throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, err);
|
|
201
|
+
}
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
204
|
|