@rango-dev/provider-walletconnect-2 0.26.3-next.1 → 0.27.1-next.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/CHANGELOG.md +9 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/provider-walletconnect-2.build.json +1 -1
- package/dist/signers/evm.d.ts +0 -1
- package/dist/signers/evm.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/signers/evm.ts +12 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/constants.ts":{"bytes":2718,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true}],"format":"esm"},"src/session.ts":{"bytes":10497,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/utils","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":6372,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/modal","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/session.ts","kind":"import-statement","original":"./session"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/helper.ts":{"bytes":2088,"imports":[{"path":"@keplr-wallet/cosmos","kind":"import-statement","external":true},{"path":"@keplr-wallet/simple-fetch","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/mock.ts":{"bytes":102937,"imports":[],"format":"esm"},"src/signers/cosmos.ts":{"bytes":7359,"imports":[{"path":"@cosmjs/launchpad","kind":"import-statement","external":true},{"path":"@keplr-wallet/cosmos","kind":"import-statement","external":true},{"path":"@rango-dev/signer-cosmos","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"cosmos-wallet","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/signers/helper.ts","kind":"import-statement","original":"./helper"},{"path":"src/signers/mock.ts","kind":"import-statement","original":"./mock"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/evm.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/constants.ts":{"bytes":2718,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true}],"format":"esm"},"src/session.ts":{"bytes":10497,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/utils","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":6372,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/modal","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/session.ts","kind":"import-statement","original":"./session"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/helper.ts":{"bytes":2088,"imports":[{"path":"@keplr-wallet/cosmos","kind":"import-statement","external":true},{"path":"@keplr-wallet/simple-fetch","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/mock.ts":{"bytes":102937,"imports":[],"format":"esm"},"src/signers/cosmos.ts":{"bytes":7359,"imports":[{"path":"@cosmjs/launchpad","kind":"import-statement","external":true},{"path":"@keplr-wallet/cosmos","kind":"import-statement","external":true},{"path":"@rango-dev/signer-cosmos","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"cosmos-wallet","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/signers/helper.ts","kind":"import-statement","original":"./helper"},{"path":"src/signers/mock.ts","kind":"import-statement","original":"./mock"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/evm.ts":{"bytes":4511,"imports":[{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"@walletconnect/encoding","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/solana.ts":{"bytes":4693,"imports":[{"path":"@rango-dev/signer-solana","kind":"import-statement","external":true},{"path":"@solana/web3.js","kind":"import-statement","external":true},{"path":"bs58","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":861,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/signers/cosmos.ts","kind":"import-statement","original":"./signers/cosmos"},{"path":"src/signers/evm.ts","kind":"import-statement","original":"./signers/evm"},{"path":"src/signers/solana.ts","kind":"import-statement","original":"./signers/solana"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":6645,"imports":[{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/sign-client","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"src/session.ts","kind":"import-statement","original":"./session"},{"path":"src/signer.ts","kind":"import-statement","original":"./signer"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":214575},"dist/index.js":{"imports":[{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/sign-client","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/modal","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@walletconnect/utils","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@cosmjs/launchpad","kind":"import-statement","external":true},{"path":"@keplr-wallet/cosmos","kind":"import-statement","external":true},{"path":"@rango-dev/signer-cosmos","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"cosmos-wallet","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@keplr-wallet/cosmos","kind":"import-statement","external":true},{"path":"@keplr-wallet/simple-fetch","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"@walletconnect/encoding","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"@rango-dev/signer-solana","kind":"import-statement","external":true},{"path":"@solana/web3.js","kind":"import-statement","external":true},{"path":"bs58","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"exports":["canSwitchNetworkTo","config","connect","disconnect","getInstance","getSigners","getWalletInfo","init","subscribe","switchNetwork"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":2485},"src/constants.ts":{"bytesInOutput":521},"src/helpers.ts":{"bytesInOutput":2191},"src/session.ts":{"bytesInOutput":3084},"src/signer.ts":{"bytesInOutput":367},"src/signers/cosmos.ts":{"bytesInOutput":3227},"src/signers/helper.ts":{"bytesInOutput":1056},"src/signers/mock.ts":{"bytesInOutput":68018},"src/signers/evm.ts":{"bytesInOutput":1786},"src/signers/solana.ts":{"bytesInOutput":1839}},"bytes":84869}}}
|
package/dist/signers/evm.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ declare class EVMSigner implements GenericSigner<EvmTransaction> {
|
|
|
6
6
|
private client;
|
|
7
7
|
private session;
|
|
8
8
|
constructor(client: SignClient, session: SessionTypes.Struct);
|
|
9
|
-
static buildTx(evmTx: EvmTransaction, disableV2?: boolean): {};
|
|
10
9
|
signMessage(msg: string, address: string, chainId: string | null): Promise<string>;
|
|
11
10
|
signAndSendTx(tx: EvmTransaction, address: string, chainId: string | null): Promise<{
|
|
12
11
|
hash: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../src/signers/evm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,cAAM,SAAU,YAAW,aAAa,CAAC,cAAc,CAAC;IACtD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAsB;gBAEzB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../src/signers/evm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,cAAM,SAAU,YAAW,aAAa,CAAC,cAAc,CAAC;IACtD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAsB;gBAEzB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM;IAK/C,WAAW,CACtB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,MAAM,CAAC;IAqCZ,aAAa,CACjB,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAqC5B,OAAO,CAAC,iCAAiC;CAwD1C;AAED,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-walletconnect-2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"@cosmjs/launchpad": "^0.27.1",
|
|
25
25
|
"@keplr-wallet/cosmos": "^0.9.12",
|
|
26
26
|
"@keplr-wallet/simple-fetch": "^0.12.14",
|
|
27
|
-
"@rango-dev/logging-core": "^0.
|
|
28
|
-
"@rango-dev/signer-cosmos": "^0.26.0",
|
|
29
|
-
"@rango-dev/signer-evm": "^0.27.
|
|
30
|
-
"@rango-dev/signer-solana": "^0.
|
|
31
|
-
"@rango-dev/wallets-shared": "^0.
|
|
27
|
+
"@rango-dev/logging-core": "^0.4.0",
|
|
28
|
+
"@rango-dev/signer-cosmos": "^0.26.1-next.0",
|
|
29
|
+
"@rango-dev/signer-evm": "^0.27.2-next.0",
|
|
30
|
+
"@rango-dev/signer-solana": "^0.29.1-next.0",
|
|
31
|
+
"@rango-dev/wallets-shared": "^0.34.1-next.0",
|
|
32
32
|
"@solana/web3.js": "^1.91.4",
|
|
33
33
|
"@walletconnect/encoding": "^1.0.2",
|
|
34
34
|
"@walletconnect/modal": "^2.6.2",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"bs58": "^5.0.0",
|
|
38
38
|
"caip": "^1.1.0",
|
|
39
39
|
"cosmos-wallet": "^1.2.0",
|
|
40
|
-
"rango-types": "^0.1.
|
|
40
|
+
"rango-types": "^0.1.69"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@walletconnect/types": "^2.11.2"
|
|
@@ -45,4 +45,4 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
}
|
package/src/signers/evm.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { SignClient } from '@walletconnect/sign-client/dist/types/client';
|
|
|
2
2
|
import type { SessionTypes } from '@walletconnect/types';
|
|
3
3
|
import type { EvmTransaction } from 'rango-types/lib/api/main';
|
|
4
4
|
|
|
5
|
-
import { cleanEvmError } from '@rango-dev/signer-evm';
|
|
5
|
+
import { cleanEvmError, DefaultEvmSigner } from '@rango-dev/signer-evm';
|
|
6
6
|
import * as encoding from '@walletconnect/encoding';
|
|
7
7
|
import { AccountId, ChainId } from 'caip';
|
|
8
8
|
import { type GenericSigner } from 'rango-types';
|
|
@@ -20,42 +20,6 @@ class EVMSigner implements GenericSigner<EvmTransaction> {
|
|
|
20
20
|
this.session = session;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
static buildTx(evmTx: EvmTransaction, disableV2 = false) {
|
|
24
|
-
let tx = {};
|
|
25
|
-
if (evmTx.from) {
|
|
26
|
-
tx = { ...tx, from: evmTx.from };
|
|
27
|
-
}
|
|
28
|
-
if (evmTx.to) {
|
|
29
|
-
tx = { ...tx, to: evmTx.to };
|
|
30
|
-
}
|
|
31
|
-
if (evmTx.data) {
|
|
32
|
-
tx = { ...tx, data: evmTx.data };
|
|
33
|
-
}
|
|
34
|
-
if (evmTx.value) {
|
|
35
|
-
tx = { ...tx, value: evmTx.value };
|
|
36
|
-
}
|
|
37
|
-
if (evmTx.nonce) {
|
|
38
|
-
tx = { ...tx, nonce: evmTx.nonce };
|
|
39
|
-
}
|
|
40
|
-
if (evmTx.gasLimit) {
|
|
41
|
-
tx = { ...tx, gasLimit: evmTx.gasLimit };
|
|
42
|
-
}
|
|
43
|
-
if (evmTx.gasPrice) {
|
|
44
|
-
const shift = 16;
|
|
45
|
-
tx = {
|
|
46
|
-
...tx,
|
|
47
|
-
gasPrice: '0x' + parseInt(evmTx.gasPrice).toString(shift),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (evmTx.maxFeePerGas && !disableV2) {
|
|
51
|
-
tx = { ...tx, maxFeePerGas: evmTx.maxFeePerGas };
|
|
52
|
-
}
|
|
53
|
-
if (evmTx.maxPriorityFeePerGas && !disableV2) {
|
|
54
|
-
tx = { ...tx, maxPriorityFeePerGas: evmTx.maxPriorityFeePerGas };
|
|
55
|
-
}
|
|
56
|
-
return tx;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
23
|
public async signMessage(
|
|
60
24
|
msg: string,
|
|
61
25
|
address: string,
|
|
@@ -107,7 +71,7 @@ class EVMSigner implements GenericSigner<EvmTransaction> {
|
|
|
107
71
|
chainId,
|
|
108
72
|
});
|
|
109
73
|
try {
|
|
110
|
-
const transaction =
|
|
74
|
+
const transaction = DefaultEvmSigner.buildTx(tx);
|
|
111
75
|
const hash: string = await this.client.request({
|
|
112
76
|
topic: this.session.topic,
|
|
113
77
|
chainId: requestedFor.caipChainId,
|
|
@@ -125,8 +89,16 @@ class EVMSigner implements GenericSigner<EvmTransaction> {
|
|
|
125
89
|
return {
|
|
126
90
|
hash,
|
|
127
91
|
};
|
|
128
|
-
} catch (error) {
|
|
129
|
-
|
|
92
|
+
} catch (error: any) {
|
|
93
|
+
const modifiedError = cleanEvmError(error);
|
|
94
|
+
const session = this.session;
|
|
95
|
+
const context = {
|
|
96
|
+
namspaces: session?.namespaces,
|
|
97
|
+
peering: session?.peer?.metadata,
|
|
98
|
+
code: error?.code,
|
|
99
|
+
};
|
|
100
|
+
modifiedError.context = context;
|
|
101
|
+
throw modifiedError;
|
|
130
102
|
}
|
|
131
103
|
}
|
|
132
104
|
|