The allowedMethods params represents which contracts calls the user will authorize the dapp to send on his behalf.
Expiry is a security measure. After the expiry date, the session becomes invalid.
3. Creating a Session
// Compute the typed data to be signed
const sessionRequest = createSessionRequest({
sessionParams,
chainId
})
// wallet is a StarknetWindowObject. There are others ways to sign typed data.
// You could use the starknet-react hook useSignTypedData
const authorisationSignature = await wallet.request({
type: "wallet_signTypedData",
params: sessionRequest.sessionTypedData
})
// Build session request
const session = await createSession({
sessionRequest, // SessionRequest
address, // Account address
chainId, // StarknetChainId
authorisationSignature // Signature
})
// Create session account. This is the account that will be used to execute transactions.
const sessionAccount = await buildSessionAccount({
useCacheAuthorisation: false, // optional and defaulted to false, will be added in future developments
session,
sessionKey,
provider: new RpcProvider({
nodeUrl: "<https://starknet-sepolia.public.blastapi.io/rpc/v0_7>",
chainId: constants.StarknetChainId.SN_SEPOLIA
}),
argentSessionServiceBaseUrl: ARGENT_SESSION_SERVICE_BASE_URL // Optional: defaulted to mainnet url. This is basically the backend api.
})