@rango-dev/provider-walletconnect-2 0.14.1-next.1 → 0.14.1-next.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.
@@ -6,6 +6,7 @@ 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): {};
9
10
  signMessage(msg: string, address: string, chainId: string | null): Promise<string>;
10
11
  signAndSendTx(tx: EvmTransaction, address: string, chainId: string | null): Promise<{
11
12
  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;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;IAsB5B,OAAO,CAAC,iCAAiC;CAwD1C;AAED,eAAe,SAAS,CAAC"}
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;IAK5D,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,UAAQ;IAoC1C,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;IAuB5B,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.14.1-next.1",
3
+ "version": "0.14.1-next.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -20,6 +20,42 @@ 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
+
23
59
  public async signMessage(
24
60
  msg: string,
25
61
  address: string,
@@ -71,12 +107,13 @@ class EVMSigner implements GenericSigner<EvmTransaction> {
71
107
  chainId,
72
108
  });
73
109
  try {
110
+ const transaction = EVMSigner.buildTx(tx);
74
111
  const hash: string = await this.client.request({
75
112
  topic: this.session.topic,
76
113
  chainId: requestedFor.caipChainId,
77
114
  request: {
78
115
  method: EthereumRPCMethods.SEND_TRANSACTION,
79
- params: [tx],
116
+ params: [transaction],
80
117
  },
81
118
  });
82
119
  return {