@rango-dev/signer-evm 0.5.0 → 0.5.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/helper.d.ts +2 -2
- package/dist/helper.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/signer.d.ts +2 -2
- package/dist/signer.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/helper.ts +7 -2
- package/src/signer.ts +18 -8
package/dist/helper.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SignerError } from 'rango-types';
|
|
2
|
-
export declare const cleanEvmError: (error: any) =>
|
|
1
|
+
import type { SignerError as SignerErrorType } from 'rango-types';
|
|
2
|
+
export declare const cleanEvmError: (error: any) => SignerErrorType;
|
|
3
3
|
//# sourceMappingURL=helper.d.ts.map
|
package/dist/helper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,aAAa,CAAC;AAGlE,eAAO,MAAM,aAAa,UAAW,GAAG,KAAG,eAsB1C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var E=Object.defineProperty;var
|
|
1
|
+
var E=Object.defineProperty;var c=(t,r)=>E(t,"name",{value:r,configurable:!0});import{providers as m}from"ethers";import{SignerError as w,SignerErrorCode as f}from"rango-types";var p=c(t=>{let r;if(t&&Object.prototype.hasOwnProperty.call(t,"message")&&Object.prototype.hasOwnProperty.call(t,"code")&&Object.prototype.hasOwnProperty.call(t,"reason"))r=`Error sending the tx (code: ${t.code})`;else if(t&&Object.prototype.hasOwnProperty.call(t,"code")&&Object.prototype.hasOwnProperty.call(t,"message")&&t?.code===-32603)return new w(f.SEND_TX_ERROR,void 0,t.message);return new w(f.SEND_TX_ERROR,r,t)},"cleanEvmError");import{SignerError as g,SignerErrorCode as d}from"rango-types";var o=class{constructor(r){this.provider=new m.Web3Provider(r),this.signer=this.provider.getSigner()}async signMessage(r){try{return await this.signer.signMessage(r)}catch(e){throw new g(d.SIGN_TX_ERROR,void 0,e)}}async signAndSendTx(r,e,s){try{let a=o.buildTx(r),i=await this.signer.getChainId(),n=await this.signer.getAddress();if(s&&i&&i.toString().toLowerCase()!==s?.toLowerCase())throw new g(d.UNEXPECTED_BEHAVIOUR,`Signer chainId: '${i}' doesn't match with required chainId: '${s}' for tx.`);if(n&&e&&n.toLowerCase()!==e.toLowerCase())throw new g(d.UNEXPECTED_BEHAVIOUR,`Signer address: '${n.toLowerCase()}' doesn't match with required address: '${e.toLowerCase()}' for tx.`);let h=await this.signer.sendTransaction(a);return{hash:h.hash,response:h}}catch(a){throw p(a)}}async wait(r,e,s,a){try{if(s)return await s?.wait(a),{hash:r};if(!this.provider)return{hash:r};let i=await this.provider.getTransaction(r);if(!i)throw Error(`Transaction hash '${r}' not found in blockchain.`);return await i.wait(a),{hash:r}}catch(i){let n=i;if(n?.code==="TRANSACTION_REPLACED"&&n?.replacement)return{hash:n?.replacement?.hash,response:n?.replacement};throw p(n)}}static buildTx(r){let e={};return r.from&&(e={...e,from:r.from}),r.to&&(e={...e,to:r.to}),r.data&&(e={...e,data:r.data}),r.value&&(e={...e,value:r.value}),r.nonce&&(e={...e,nonce:r.nonce}),r.gasLimit&&(e={...e,gasLimit:r.gasLimit}),r.gasPrice&&(e={...e,gasPrice:"0x"+parseInt(r.gasPrice).toString(16)}),r.maxFeePerGas&&(e={...e,maxFeePerGas:r.maxFeePerGas}),r.maxPriorityFeePerGas&&(e={...e,maxPriorityFeePerGas:r.maxPriorityFeePerGas}),e}};c(o,"DefaultEvmSigner");export{o as DefaultEvmSigner};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/signer.ts", "../src/helper.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "+
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import {\n TransactionRequest,\n TransactionResponse,\n} from '@ethersproject/abstract-provider';\nimport type { GenericSigner } from 'rango-types';\nimport { EvmTransaction } from 'rango-types/lib/api/main';\nimport { providers } from 'ethers';\nimport { cleanEvmError } from './helper';\nimport { SignerError, SignerErrorCode } from 'rango-types';\n\nexport class DefaultEvmSigner implements GenericSigner<EvmTransaction> {\n private signer: providers.JsonRpcSigner;\n private provider: providers.Web3Provider;\n\n constructor(provider: providers.ExternalProvider) {\n this.provider = new providers.Web3Provider(provider);\n this.signer = this.provider.getSigner();\n }\n\n async signMessage(msg: string): Promise<string> {\n try {\n return await this.signer.signMessage(msg);\n } catch (error) {\n throw new SignerError(SignerErrorCode.SIGN_TX_ERROR, undefined, error);\n }\n }\n\n async signAndSendTx(\n tx: EvmTransaction,\n address: string,\n chainId: string | null\n ): Promise<{ hash: string; response: TransactionResponse }> {\n try {\n const transaction = DefaultEvmSigner.buildTx(tx);\n const signerChainId = await this.signer.getChainId();\n const signerAddress = await this.signer.getAddress();\n if (\n !!chainId &&\n !!signerChainId &&\n signerChainId.toString().toLowerCase() !== chainId?.toLowerCase()\n ) {\n throw new SignerError(\n SignerErrorCode.UNEXPECTED_BEHAVIOUR,\n `Signer chainId: '${signerChainId}' doesn't match with required chainId: '${chainId}' for tx.`\n );\n }\n if (\n !!signerAddress &&\n !!address &&\n signerAddress.toLowerCase() !== address.toLowerCase()\n ) {\n throw new SignerError(\n SignerErrorCode.UNEXPECTED_BEHAVIOUR,\n `Signer address: '${signerAddress.toLowerCase()}' doesn't match with required address: '${address.toLowerCase()}' for tx.`\n );\n }\n const response = await this.signer.sendTransaction(transaction);\n return { hash: response.hash, response };\n } catch (error) {\n throw cleanEvmError(error);\n }\n }\n\n async wait(\n txHash: string,\n _chainId: string,\n txResponse?: TransactionResponse,\n confirmations?: number | undefined\n ): Promise<{ hash: string; response?: TransactionResponse }> {\n try {\n if (txResponse) {\n await txResponse?.wait(confirmations);\n return { hash: txHash };\n }\n if (!this.provider) return { hash: txHash }; // wallet not connected yet\n const tx = await this.provider.getTransaction(txHash);\n if (!tx)\n throw Error(`Transaction hash '${txHash}' not found in blockchain.`);\n await tx.wait(confirmations);\n return { hash: txHash };\n } catch (err) {\n const error = err as any; // TODO find a proper type\n if (error?.code === 'TRANSACTION_REPLACED' && error?.replacement)\n return { hash: error?.replacement?.hash, response: error?.replacement };\n throw cleanEvmError(error);\n }\n }\n\n static buildTx(evmTx: EvmTransaction): TransactionRequest {\n let tx: TransactionRequest = {};\n if (evmTx.from) tx = { ...tx, from: evmTx.from };\n if (evmTx.to) tx = { ...tx, to: evmTx.to };\n if (evmTx.data) tx = { ...tx, data: evmTx.data };\n if (evmTx.value) tx = { ...tx, value: evmTx.value };\n if (evmTx.nonce) tx = { ...tx, nonce: evmTx.nonce };\n if (evmTx.gasLimit) tx = { ...tx, gasLimit: evmTx.gasLimit };\n if (evmTx.gasPrice)\n tx = {\n ...tx,\n gasPrice: '0x' + parseInt(evmTx.gasPrice).toString(16),\n };\n if (evmTx.maxFeePerGas) tx = { ...tx, maxFeePerGas: evmTx.maxFeePerGas };\n if (evmTx.maxPriorityFeePerGas)\n tx = { ...tx, maxPriorityFeePerGas: evmTx.maxPriorityFeePerGas };\n return tx;\n }\n}\n", "import type { SignerError as SignerErrorType } from 'rango-types';\nimport { SignerError, SignerErrorCode } from 'rango-types';\n\nexport const cleanEvmError = (error: any): SignerErrorType => {\n let message = undefined;\n if (\n error &&\n Object.prototype.hasOwnProperty.call(error, 'message') &&\n Object.prototype.hasOwnProperty.call(error, 'code') &&\n Object.prototype.hasOwnProperty.call(error, 'reason')\n ) {\n message = `Error sending the tx (code: ${(error as any).code})`;\n } else if (\n error &&\n Object.prototype.hasOwnProperty.call(error, 'code') &&\n Object.prototype.hasOwnProperty.call(error, 'message') &&\n (error as any)?.code === -32603\n ) {\n return new SignerError(\n SignerErrorCode.SEND_TX_ERROR,\n undefined,\n (error as any).message\n );\n }\n return new SignerError(SignerErrorCode.SEND_TX_ERROR, message, error);\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["providers", "SignerError", "SignerErrorCode", "cleanEvmError", "__name", "error", "message", "SignerError", "SignerErrorCode", "SignerError", "SignerErrorCode", "DefaultEvmSigner", "provider", "providers", "msg", "error", "SignerError", "SignerErrorCode", "tx", "address", "chainId", "transaction", "signerChainId", "signerAddress", "response", "cleanEvmError", "txHash", "_chainId", "txResponse", "confirmations", "err", "evmTx", "__name"]
|
|
7
7
|
}
|
package/dist/signer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransactionRequest, TransactionResponse } from '@ethersproject/abstract-provider';
|
|
2
|
-
import { GenericSigner } from 'rango-types';
|
|
2
|
+
import type { GenericSigner } from 'rango-types';
|
|
3
3
|
import { EvmTransaction } from 'rango-types/lib/api/main';
|
|
4
4
|
import { providers } from 'ethers';
|
|
5
5
|
export declare class DefaultEvmSigner implements GenericSigner<EvmTransaction> {
|
|
@@ -11,7 +11,7 @@ export declare class DefaultEvmSigner implements GenericSigner<EvmTransaction> {
|
|
|
11
11
|
hash: string;
|
|
12
12
|
response: TransactionResponse;
|
|
13
13
|
}>;
|
|
14
|
-
wait(txHash: string, txResponse?: TransactionResponse, confirmations?: number | undefined): Promise<{
|
|
14
|
+
wait(txHash: string, _chainId: string, txResponse?: TransactionResponse, confirmations?: number | undefined): Promise<{
|
|
15
15
|
hash: string;
|
|
16
16
|
response?: TransactionResponse;
|
|
17
17
|
}>;
|
package/dist/signer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAInC,qBAAa,gBAAiB,YAAW,aAAa,CAAC,cAAc,CAAC;IACpE,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,QAAQ,CAAyB;gBAE7B,QAAQ,EAAE,SAAS,CAAC,gBAAgB;IAK1C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQzC,aAAa,CACjB,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAgCrD,IAAI,CACR,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,mBAAmB,EAChC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,GACjC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAoB5D,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,cAAc,GAAG,kBAAkB;CAkB1D"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/signer-evm",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"module": "dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js"
|
|
10
|
+
},
|
|
7
11
|
"typings": "dist/index.d.ts",
|
|
8
12
|
"files": [
|
|
9
13
|
"dist",
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
"dependencies": {
|
|
19
23
|
"@ethersproject/abstract-provider": "^5.7.0",
|
|
20
24
|
"ethers": "^5.7.2",
|
|
21
|
-
"rango-types": "^0.1.
|
|
25
|
+
"rango-types": "^0.1.39"
|
|
22
26
|
},
|
|
23
27
|
"publishConfig": {
|
|
24
28
|
"access": "public"
|
package/src/helper.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { SignerError as SignerErrorType } from 'rango-types';
|
|
1
2
|
import { SignerError, SignerErrorCode } from 'rango-types';
|
|
2
3
|
|
|
3
|
-
export const cleanEvmError = (error: any):
|
|
4
|
+
export const cleanEvmError = (error: any): SignerErrorType => {
|
|
4
5
|
let message = undefined;
|
|
5
6
|
if (
|
|
6
7
|
error &&
|
|
@@ -15,7 +16,11 @@ export const cleanEvmError = (error: any): SignerError => {
|
|
|
15
16
|
Object.prototype.hasOwnProperty.call(error, 'message') &&
|
|
16
17
|
(error as any)?.code === -32603
|
|
17
18
|
) {
|
|
18
|
-
return new SignerError(
|
|
19
|
+
return new SignerError(
|
|
20
|
+
SignerErrorCode.SEND_TX_ERROR,
|
|
21
|
+
undefined,
|
|
22
|
+
(error as any).message
|
|
23
|
+
);
|
|
19
24
|
}
|
|
20
25
|
return new SignerError(SignerErrorCode.SEND_TX_ERROR, message, error);
|
|
21
26
|
};
|
package/src/signer.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
TransactionRequest,
|
|
3
|
+
TransactionResponse,
|
|
4
|
+
} from '@ethersproject/abstract-provider';
|
|
5
|
+
import type { GenericSigner } from 'rango-types';
|
|
3
6
|
import { EvmTransaction } from 'rango-types/lib/api/main';
|
|
4
7
|
import { providers } from 'ethers';
|
|
5
8
|
import { cleanEvmError } from './helper';
|
|
9
|
+
import { SignerError, SignerErrorCode } from 'rango-types';
|
|
6
10
|
|
|
7
11
|
export class DefaultEvmSigner implements GenericSigner<EvmTransaction> {
|
|
8
12
|
private signer: providers.JsonRpcSigner;
|
|
@@ -24,7 +28,7 @@ export class DefaultEvmSigner implements GenericSigner<EvmTransaction> {
|
|
|
24
28
|
async signAndSendTx(
|
|
25
29
|
tx: EvmTransaction,
|
|
26
30
|
address: string,
|
|
27
|
-
chainId: string | null
|
|
31
|
+
chainId: string | null
|
|
28
32
|
): Promise<{ hash: string; response: TransactionResponse }> {
|
|
29
33
|
try {
|
|
30
34
|
const transaction = DefaultEvmSigner.buildTx(tx);
|
|
@@ -37,13 +41,17 @@ export class DefaultEvmSigner implements GenericSigner<EvmTransaction> {
|
|
|
37
41
|
) {
|
|
38
42
|
throw new SignerError(
|
|
39
43
|
SignerErrorCode.UNEXPECTED_BEHAVIOUR,
|
|
40
|
-
`Signer chainId: '${signerChainId}' doesn't match with required chainId: '${chainId}' for tx
|
|
44
|
+
`Signer chainId: '${signerChainId}' doesn't match with required chainId: '${chainId}' for tx.`
|
|
41
45
|
);
|
|
42
46
|
}
|
|
43
|
-
if (
|
|
47
|
+
if (
|
|
48
|
+
!!signerAddress &&
|
|
49
|
+
!!address &&
|
|
50
|
+
signerAddress.toLowerCase() !== address.toLowerCase()
|
|
51
|
+
) {
|
|
44
52
|
throw new SignerError(
|
|
45
53
|
SignerErrorCode.UNEXPECTED_BEHAVIOUR,
|
|
46
|
-
`Signer address: '${signerAddress.toLowerCase()}' doesn't match with required address: '${address.toLowerCase()}' for tx
|
|
54
|
+
`Signer address: '${signerAddress.toLowerCase()}' doesn't match with required address: '${address.toLowerCase()}' for tx.`
|
|
47
55
|
);
|
|
48
56
|
}
|
|
49
57
|
const response = await this.signer.sendTransaction(transaction);
|
|
@@ -55,8 +63,9 @@ export class DefaultEvmSigner implements GenericSigner<EvmTransaction> {
|
|
|
55
63
|
|
|
56
64
|
async wait(
|
|
57
65
|
txHash: string,
|
|
66
|
+
_chainId: string,
|
|
58
67
|
txResponse?: TransactionResponse,
|
|
59
|
-
confirmations?: number | undefined
|
|
68
|
+
confirmations?: number | undefined
|
|
60
69
|
): Promise<{ hash: string; response?: TransactionResponse }> {
|
|
61
70
|
try {
|
|
62
71
|
if (txResponse) {
|
|
@@ -65,7 +74,8 @@ export class DefaultEvmSigner implements GenericSigner<EvmTransaction> {
|
|
|
65
74
|
}
|
|
66
75
|
if (!this.provider) return { hash: txHash }; // wallet not connected yet
|
|
67
76
|
const tx = await this.provider.getTransaction(txHash);
|
|
68
|
-
if (!tx)
|
|
77
|
+
if (!tx)
|
|
78
|
+
throw Error(`Transaction hash '${txHash}' not found in blockchain.`);
|
|
69
79
|
await tx.wait(confirmations);
|
|
70
80
|
return { hash: txHash };
|
|
71
81
|
} catch (err) {
|