This repository was archived by the owner on Jan 22, 2025. It is now read-only.
File tree 3 files changed +7
-7
lines changed
3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1
- import * as nacl from 'tweetnacl' ;
1
+ import nacl from 'tweetnacl' ;
2
2
import type { SignKeyPair as KeyPair } from 'tweetnacl' ;
3
3
import type { Buffer } from 'buffer' ;
4
4
Original file line number Diff line number Diff line change 1
- import * as nacl from 'tweetnacl' ;
1
+ import nacl from 'tweetnacl' ;
2
2
3
3
import { PublicKey } from './publickey' ;
4
4
Original file line number Diff line number Diff line change 1
1
import { Buffer } from 'buffer' ;
2
2
import * as BufferLayout from '@solana/buffer-layout' ;
3
3
import secp256k1 from 'secp256k1' ;
4
- import { keccak_256 } from 'js-sha3' ;
4
+ import sha3 from 'js-sha3' ;
5
5
6
6
import { PublicKey } from './publickey' ;
7
7
import { TransactionInstruction } from './transaction' ;
@@ -86,9 +86,9 @@ export class Secp256k1Program {
86
86
) ;
87
87
88
88
try {
89
- return Buffer . from ( keccak_256 . update ( toBuffer ( publicKey ) ) . digest ( ) ) . slice (
90
- - ETHEREUM_ADDRESS_BYTES ,
91
- ) ;
89
+ return Buffer . from (
90
+ sha3 . keccak_256 . update ( toBuffer ( publicKey ) ) . digest ( ) ,
91
+ ) . slice ( - ETHEREUM_ADDRESS_BYTES ) ;
92
92
} catch ( error ) {
93
93
throw new Error ( `Error constructing Ethereum address: ${ error } ` ) ;
94
94
}
@@ -197,7 +197,7 @@ export class Secp256k1Program {
197
197
const privateKey = toBuffer ( pkey ) ;
198
198
const publicKey = publicKeyCreate ( privateKey , false ) . slice ( 1 ) ; // throw away leading byte
199
199
const messageHash = Buffer . from (
200
- keccak_256 . update ( toBuffer ( message ) ) . digest ( ) ,
200
+ sha3 . keccak_256 . update ( toBuffer ( message ) ) . digest ( ) ,
201
201
) ;
202
202
const { signature, recid : recoveryId } = ecdsaSign ( messageHash , privateKey ) ;
203
203
You can’t perform that action at this time.
0 commit comments