File tree Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 1
1
import BN from 'bn.js' ;
2
2
import * as encUtils from 'enc-utils' ;
3
- import { Signer } from 'ethers' ;
3
+ import { Signer , toUtf8Bytes } from 'ethers' ;
4
4
5
5
type SignatureOptions = {
6
6
r : BN ;
@@ -42,7 +42,9 @@ export async function signRaw(
42
42
payload : string ,
43
43
signer : Signer ,
44
44
) : Promise < string > {
45
- const signature = deserializeSignature ( await signer . signMessage ( payload ) ) ;
45
+ console . log ( 'signRaw.payload' , { payload } ) ;
46
+ console . log ( 'signRaw.toUtf8Bytes' , { toUtf8Bytes : toUtf8Bytes ( payload ) . toString ( ) } ) ;
47
+ const signature = deserializeSignature ( await signer . signMessage ( toUtf8Bytes ( payload ) ) ) ;
46
48
return serializeEthSignature ( signature ) ;
47
49
}
48
50
Original file line number Diff line number Diff line change 1
1
import { StarkSigner } from '@imtbl/x-client' ;
2
+ import { toUtf8Bytes } from 'ethers' ;
2
3
import {
3
4
COMMUNICATION_TYPE ,
4
5
ResponseEventType ,
@@ -28,6 +29,9 @@ export class ImxSigner implements StarkSigner {
28
29
}
29
30
30
31
public signMessage ( rawMessage : string ) : Promise < string > {
32
+ console . log ( 'signMessage.rawMessage' , { rawMessage } ) ;
33
+ console . log ( 'signMessage.toUtf8Bytes.toString()' , { toUtf8Bytes : toUtf8Bytes ( rawMessage ) . toString ( ) } ) ;
34
+
31
35
return new Promise ( ( resolve , reject ) => {
32
36
const listener = ( event : MessageEvent ) => {
33
37
messageResponseListener < SignMessageResponse > (
Original file line number Diff line number Diff line change 1
1
import { Environment } from '@imtbl/config' ;
2
- import { BrowserProvider , toUtf8Bytes } from 'ethers' ;
2
+ import {
3
+ BrowserProvider ,
4
+ getBytes ,
5
+ toUtf8Bytes ,
6
+ toUtf8String ,
7
+ } from 'ethers' ;
3
8
import {
4
9
ConnectRequest ,
5
10
ConnectResponse ,
@@ -25,6 +30,13 @@ export async function connect(
25
30
) : Promise < ImxSigner > {
26
31
const l1Signer = await l1Provider . getSigner ( ) ;
27
32
const address = await l1Signer . getAddress ( ) ;
33
+
34
+ console . log ( 'DEFAULT_CONNECTION_MESSAGE' , { message : DEFAULT_CONNECTION_MESSAGE } ) ;
35
+ console . log ( 'toUtf8Bytes.toString()' , { toUtf8Bytes : toUtf8Bytes ( DEFAULT_CONNECTION_MESSAGE ) . toString ( ) } ) ;
36
+
37
+ console . log ( 'toUtf8String 1' , { toUtf8String : toUtf8String ( toUtf8Bytes ( DEFAULT_CONNECTION_MESSAGE ) ) } ) ;
38
+ console . log ( 'toUtf8String 2' , { toUtf8String : toUtf8String ( getBytes ( toUtf8Bytes ( DEFAULT_CONNECTION_MESSAGE ) ) ) } ) ;
39
+
28
40
const signature = await l1Signer . signMessage ( toUtf8Bytes ( DEFAULT_CONNECTION_MESSAGE ) ) ;
29
41
const iframe = await getOrSetupIFrame ( env ) ;
30
42
Original file line number Diff line number Diff line change @@ -27,9 +27,15 @@ export class MetaMaskIMXProvider extends GenericIMXProvider {
27
27
metaMaskProvider ,
28
28
config . baseConfig . environment ,
29
29
) ;
30
+
31
+ const signer = await metaMaskProvider . getSigner ( ) ;
32
+
33
+ console . log ( 'metaMaskProvider.getSigner().getAddress()' , await signer . getAddress ( ) ) ;
34
+ console . log ( 'imxSigner.getAddress()' , this . imxSigner . getAddress ( ) ) ;
35
+
30
36
return new MetaMaskIMXProvider (
31
37
config ,
32
- await metaMaskProvider . getSigner ( ) ,
38
+ signer ,
33
39
this . imxSigner ,
34
40
) ;
35
41
} ,
You can’t perform that action at this time.
0 commit comments