@@ -48,48 +48,97 @@ describe("ArgentSessionService", () => {
4848 it ( "should sign the transactions and session and return a argent service signature response" , async ( ) => {
4949 const cacheAuthorisation = false
5050
51+ const contractAddress = stark . randomAddress ( )
52+
5153 const sessionRequest = {
5254 expires_at : 1234567890 ,
5355 allowed_methods : [
5456 {
55- "Contract Address" : stark . randomAddress ( ) ,
57+ "Contract Address" : contractAddress ,
5658 selector : "set_number_double" ,
5759 } ,
5860 ] ,
5961 metadata : JSON . stringify ( {
6062 projectID : "test" ,
6163 txFees : [
62- { tokenAddress : stark . randomAddress ( ) , maxAmount : "1000000000000" } ,
64+ { tokenAddress : contractAddress , maxAmount : "1000000000000" } ,
6365 ] ,
6466 } ) ,
6567 session_key_guid :
6668 "0x116dcea0b31d06f721c156324cd8de3652bf8953cd5ba055f74db21b1134ec9" ,
69+ sessionTypedData : undefined as any ,
70+ offchainSession : {
71+ expires_at : 1234567890 ,
72+ allowed_methods : [
73+ {
74+ "Contract Address" : contractAddress ,
75+ selector : "set_number_double" ,
76+ } ,
77+ ] ,
78+ metadata : JSON . stringify ( {
79+ projectID : "test" ,
80+ txFees : [
81+ {
82+ tokenAddress : stark . randomAddress ( ) ,
83+ maxAmount : "1000000000000" ,
84+ } ,
85+ ] ,
86+ } ) ,
87+ session_key_guid :
88+ "0x116dcea0b31d06f721c156324cd8de3652bf8953cd5ba055f74db21b1134ec9" ,
89+ } ,
90+ sessionKey : {
91+ publicKey : "" ,
92+ privateKey : "" ,
93+ } ,
6794 }
6895
6996 const sessionTypedData = getSessionTypedData (
7097 sessionRequest ,
7198 constants . StarknetChainId . SN_SEPOLIA ,
7299 )
73100
101+ sessionRequest . sessionTypedData = sessionTypedData
102+
74103 const sessionPrivateKey = ec . starkCurve . utils . randomPrivateKey ( )
75104 const sessionPublicKey = ec . starkCurve . getStarkKey ( sessionPrivateKey )
76105 const sessionKey : SessionKey = {
77- privateKey : sessionPrivateKey ,
106+ privateKey : sessionPrivateKey . toString ( ) ,
78107 publicKey : sessionPublicKey ,
79108 }
80109
110+ sessionRequest . sessionKey = sessionKey
111+
81112 const response : ArgentServiceSignatureResponse =
82113 await argentSignTxAndSession ( {
83114 argentSessionServiceBaseUrl : "http://localhost:3000" ,
84115 authorisationSignature : [ "123" , "456" ] ,
85116 sessionKey,
86117 calls : [ ] ,
87118 transactionsDetail : {
119+ tip : 1000n ,
120+ paymasterData : [ ] ,
121+ accountDeploymentData : [ ] ,
122+ nonceDataAvailabilityMode : "L2" ,
123+ feeDataAvailabilityMode : "L2" ,
124+ resourceBounds : {
125+ l1_data_gas : {
126+ max_amount : 300000n ,
127+ max_price_per_unit : 10n ,
128+ } ,
129+ l1_gas : {
130+ max_amount : 300000n ,
131+ max_price_per_unit : 10n ,
132+ } ,
133+ l2_gas : {
134+ max_amount : 300000n ,
135+ max_price_per_unit : 10n ,
136+ } ,
137+ } ,
88138 cairoVersion : "1" ,
89139 chainId : constants . StarknetChainId . SN_SEPOLIA ,
90- maxFee : 1000n ,
91140 nonce : 1 ,
92- version : "0x2 " ,
141+ version : "0x3 " ,
93142 walletAddress : stark . randomAddress ( ) ,
94143 } ,
95144 sessionTypedData,
@@ -162,7 +211,7 @@ describe("ArgentSessionService", () => {
162211 const sessionPrivateKey = ec . starkCurve . utils . randomPrivateKey ( )
163212 const sessionPublicKey = ec . starkCurve . getStarkKey ( sessionPrivateKey )
164213 const sessionKey : SessionKey = {
165- privateKey : sessionPrivateKey ,
214+ privateKey : sessionPrivateKey . toString ( ) ,
166215 publicKey : sessionPublicKey ,
167216 }
168217
0 commit comments