1import { ITxData } from '@walletconnect/types';
2import { Transaction } from '@ethereumjs/tx';
3import { stripHexPrefix } from './utils/address';
4import { FakeSignResult } from './txn';
6type SignWalletConnectTransactionArgs = {
9 txnSigner: (args: ITxData) => Promise<string>;
10 txnSender: (args: ITxData) => Promise<string>;
13const walletConnectSignTransaction = async ({
18}: SignWalletConnectTransactionArgs) => {
19 let wcFormattedTx = txn.toJSON();
20 wcFormattedTx.from = from;
21 wcFormattedTx.gas = wcFormattedTx.gasLimit;
25 signature = await txnSigner(wcFormattedTx);
27 if (e.message === 'METHOD_NOT_SUPPORTED') {
28 console.log('connected wc wallet does not support tx signing.');
29 return new FakeSignResult(
31 walletConnectSendTransaction(txnSender)
37 const serializedTx = Buffer.from(stripHexPrefix(signature), 'hex');
38 const signedTx = Transaction.fromSerializedTx(serializedTx);
43const walletConnectSendTransaction = (
44 txnSender: (tx: any) => Promise<string>
45) => (_web3, txn): Promise<string> => txnSender(txn);
47export { walletConnectSignTransaction };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list