@exodus/web3-ethereum-utils 0.1.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/lib/addresses.d.ts +1 -0
- package/lib/addresses.js +3 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/signatures.d.ts +4 -0
- package/lib/signatures.js +14 -0
- package/lib/types.d.ts +10 -0
- package/lib/types.js +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function condenseAddress(address: string): string;
|
package/lib/addresses.js
ADDED
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { TransactionObj } from './types.js';
|
|
3
|
+
export declare function signMessage(message: string, privateKey: Buffer): Promise<string>;
|
|
4
|
+
export declare function signTransaction(transactionObj: TransactionObj, privateKey: Buffer): Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Common from '@exodus/ethereumjs-common';
|
|
2
|
+
import { Transaction } from '@exodus/ethereumjs-tx';
|
|
3
|
+
import { personalSign } from '@exodus/eth-sig-util';
|
|
4
|
+
export async function signMessage(message, privateKey) {
|
|
5
|
+
return personalSign(privateKey, { data: message });
|
|
6
|
+
}
|
|
7
|
+
export async function signTransaction(transactionObj, privateKey) {
|
|
8
|
+
// TODO: Do we need to support EIP-1559 transactions?
|
|
9
|
+
const { chainId, gas, ...rest } = transactionObj;
|
|
10
|
+
const transaction = Transaction.fromTxData({ ...rest, gasLimit: gas }, { common: Common.custom({ chainId }) });
|
|
11
|
+
const signedTransaction = transaction.sign(privateKey);
|
|
12
|
+
const rawTransaction = signedTransaction.serialize();
|
|
13
|
+
return rawTransaction;
|
|
14
|
+
}
|
package/lib/types.d.ts
ADDED
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@exodus/web3-ethereum-utils",
|
|
3
|
+
"description": "Web3 Ethereum utils.",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"module": "lib/index.js",
|
|
8
|
+
"types": "lib/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./lib/index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"react-native": "./lib/index.js",
|
|
14
|
+
"files": [
|
|
15
|
+
"lib/**/*.d.ts",
|
|
16
|
+
"lib/**/*.mjs",
|
|
17
|
+
"lib/**/*.js"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "restricted"
|
|
21
|
+
},
|
|
22
|
+
"repository": "https://github.com/ExodusMovement/exodus-web3/tree/master/libs/ethereum-utils",
|
|
23
|
+
"license": "UNLICENSED",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"clean": "rimraf lib",
|
|
26
|
+
"build": "yarn clean && tsc"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@exodus/eth-sig-util": "^2.5.2-exodus1",
|
|
30
|
+
"@exodus/ethereumjs-common": "^2.4.0-exodus.6",
|
|
31
|
+
"@exodus/ethereumjs-tx": "^3.3.0-exodus.6"
|
|
32
|
+
},
|
|
33
|
+
"gitHead": "9168fe0694755e291c94ee5bb73dfe7978d406bc"
|
|
34
|
+
}
|