SIWECreateMessageArgs.fromSIWEMessageArgs constructor

SIWECreateMessageArgs.fromSIWEMessageArgs(
  1. SIWEMessageArgs params, {
  2. required String address,
  3. required String chainId,
  4. required String nonce,
  5. required CacaoHeader type,
})

Implementation

factory SIWECreateMessageArgs.fromSIWEMessageArgs(
  SIWEMessageArgs params, {
  required String address,
  required String chainId,
  required String nonce,
  required CacaoHeader type,
}) {
  final now = DateTime.now();
  return SIWECreateMessageArgs(
    chainId: chainId,
    nonce: nonce,
    address: address,
    version: '1',
    iat: params.iat ??
        DateTime.utc(
          now.year,
          now.month,
          now.day,
          now.hour,
          now.minute,
          now.second,
          now.millisecond,
        ).toIso8601String(),
    domain: params.domain,
    uri: params.uri,
    type: type,
    nbf: params.nbf,
    exp: params.exp,
    statement: params.statement,
    requestId: params.requestId,
    resources: params.resources,
    expiry: params.expiry,
  );
}