Skip to content

Commit

Permalink
Updated to websockets 1.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
spoto committed Oct 12, 2024
1 parent dfa73aa commit ed1e3a8
Show file tree
Hide file tree
Showing 43 changed files with 185 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.Base64ConversionException;
import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionRequests;
import io.hotmoka.node.api.requests.ConstructorCallTransactionRequest;
import io.hotmoka.node.messages.AddConstructorCallTransactionMessages;
import io.hotmoka.node.messages.api.AddConstructorCallTransactionMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddConstructorCallTransactionMessage}.
Expand All @@ -37,12 +36,12 @@ protected AddConstructorCallTransactionMessageJson(AddConstructorCallTransaction
}

@Override
public AddConstructorCallTransactionMessage unmap() throws IllegalArgumentException, HexConversionException, Base64ConversionException {
public AddConstructorCallTransactionMessage unmap() throws InconsistentJsonException {
var unmappedRequest = request.unmap();
if (unmappedRequest instanceof ConstructorCallTransactionRequest cctr)
return AddConstructorCallTransactionMessages.of(cctr, getId());
else
throw new IllegalArgumentException("The argument of the addConstructorCallTransactionRequest() method must be a ConstructorCallTransactionRequest");
throw new InconsistentJsonException("The argument of the addConstructorCallTransactionRequest() method must be a ConstructorCallTransactionRequest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.StorageValues;
import io.hotmoka.node.api.values.StorageReference;
import io.hotmoka.node.messages.AddConstructorCallTransactionResultMessages;
import io.hotmoka.node.messages.api.AddConstructorCallTransactionResultMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddConstructorCallTransactionResultMessage}.
Expand All @@ -36,12 +36,12 @@ protected AddConstructorCallTransactionResultMessageJson(AddConstructorCallTrans
}

@Override
public AddConstructorCallTransactionResultMessage unmap() throws IllegalArgumentException, HexConversionException {
public AddConstructorCallTransactionResultMessage unmap() throws InconsistentJsonException {
var unmappedResult = result.unmap();
if (unmappedResult instanceof StorageReference sr)
return AddConstructorCallTransactionResultMessages.of(sr, getId());
else
throw new IllegalArgumentException("The argument of addConstructorCallTransaction() must be a StorageReference");
throw new InconsistentJsonException("The argument of addConstructorCallTransaction() must be a StorageReference");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.Base64ConversionException;
import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionRequests;
import io.hotmoka.node.api.requests.GameteCreationTransactionRequest;
import io.hotmoka.node.messages.AddGameteCreationTransactionMessages;
import io.hotmoka.node.messages.api.AddGameteCreationTransactionMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddGameteCreationTransactionMessage}.
Expand All @@ -37,12 +36,12 @@ protected AddGameteCreationTransactionMessageJson(AddGameteCreationTransactionMe
}

@Override
public AddGameteCreationTransactionMessage unmap() throws IllegalArgumentException, HexConversionException, Base64ConversionException {
public AddGameteCreationTransactionMessage unmap() throws InconsistentJsonException {
var unmappedRequest = request.unmap();
if (unmappedRequest instanceof GameteCreationTransactionRequest gctr)
return AddGameteCreationTransactionMessages.of(gctr, getId());
else
throw new IllegalArgumentException("The argument of the addGameteCreationTransactionRequest() method must be a GameteCreationTransactionRequest");
throw new InconsistentJsonException("The argument of the addGameteCreationTransactionRequest() method must be a GameteCreationTransactionRequest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.StorageValues;
import io.hotmoka.node.api.values.StorageReference;
import io.hotmoka.node.messages.AddGameteCreationTransactionResultMessages;
import io.hotmoka.node.messages.api.AddGameteCreationTransactionResultMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of a {@link AddGameteCreationTransactionResultMessage}.
Expand All @@ -36,12 +36,12 @@ protected AddGameteCreationTransactionResultMessageJson(AddGameteCreationTransac
}

@Override
public AddGameteCreationTransactionResultMessage unmap() throws IllegalArgumentException, HexConversionException {
public AddGameteCreationTransactionResultMessage unmap() throws InconsistentJsonException {
var unmappedResult = result.unmap();
if (unmappedResult instanceof StorageReference sr)
return AddGameteCreationTransactionResultMessages.of(sr, getId());
else
throw new IllegalArgumentException("The return value of the addGameteCreationTramsaction() method must be a StorageReference");
throw new InconsistentJsonException("The return value of the addGameteCreationTramsaction() method must be a StorageReference");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.Base64ConversionException;
import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionRequests;
import io.hotmoka.node.api.requests.InitializationTransactionRequest;
import io.hotmoka.node.messages.AddInitializationTransactionMessages;
import io.hotmoka.node.messages.api.AddInitializationTransactionMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddInitializationTransactionMessage}.
Expand All @@ -37,12 +36,12 @@ protected AddInitializationTransactionMessageJson(AddInitializationTransactionMe
}

@Override
public AddInitializationTransactionMessage unmap() throws IllegalArgumentException, HexConversionException, Base64ConversionException {
public AddInitializationTransactionMessage unmap() throws InconsistentJsonException {
var unmappedRequest = request.unmap();
if (unmappedRequest instanceof InitializationTransactionRequest itr)
return AddInitializationTransactionMessages.of(itr, getId());
else
throw new IllegalArgumentException("The argument of the addInitializationTransactionRequest() method must be an InitializationTransactionRequest");
throw new InconsistentJsonException("The argument of the addInitializationTransactionRequest() method must be an InitializationTransactionRequest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.Base64ConversionException;
import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionRequests;
import io.hotmoka.node.api.requests.InstanceMethodCallTransactionRequest;
import io.hotmoka.node.messages.AddInstanceMethodCallTransactionMessages;
import io.hotmoka.node.messages.api.AddInstanceMethodCallTransactionMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddInstanceMethodCallTransactionMessage}.
Expand All @@ -37,12 +36,12 @@ protected AddInstanceMethodCallTransactionMessageJson(AddInstanceMethodCallTrans
}

@Override
public AddInstanceMethodCallTransactionMessage unmap() throws IllegalArgumentException, HexConversionException, Base64ConversionException {
public AddInstanceMethodCallTransactionMessage unmap() throws InconsistentJsonException {
var unmappedRequest = request.unmap();
if (unmappedRequest instanceof InstanceMethodCallTransactionRequest imctr)
return AddInstanceMethodCallTransactionMessages.of(imctr, getId());
else
throw new IllegalArgumentException("The argument of the addInstanceMethodCallTransactionRequest() method must be an InstanceMethodCallTransactionRequest");
throw new InconsistentJsonException("The argument of the addInstanceMethodCallTransactionRequest() method must be an InstanceMethodCallTransactionRequest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import java.util.Optional;

import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.StorageValues;
import io.hotmoka.node.messages.AddInstanceMethodCallTransactionResultMessages;
import io.hotmoka.node.messages.api.AddInstanceMethodCallTransactionResultMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of a {@link AddInstanceMethodCallTransactionResultMessage}.
Expand All @@ -37,7 +37,7 @@ protected AddInstanceMethodCallTransactionResultMessageJson(AddInstanceMethodCal
}

@Override
public AddInstanceMethodCallTransactionResultMessage unmap() throws IllegalArgumentException, HexConversionException {
public AddInstanceMethodCallTransactionResultMessage unmap() throws InconsistentJsonException {
return AddInstanceMethodCallTransactionResultMessages.of(result == null ? Optional.empty() : Optional.of(result.unmap()), getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.Base64ConversionException;
import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionRequests;
import io.hotmoka.node.api.requests.JarStoreInitialTransactionRequest;
import io.hotmoka.node.messages.AddJarStoreInitialTransactionMessages;
import io.hotmoka.node.messages.api.AddJarStoreInitialTransactionMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddJarStoreInitialTransactionMessage}.
Expand All @@ -37,12 +36,12 @@ protected AddJarStoreInitialTransactionMessageJson(AddJarStoreInitialTransaction
}

@Override
public AddJarStoreInitialTransactionMessage unmap() throws IllegalArgumentException, HexConversionException, Base64ConversionException {
public AddJarStoreInitialTransactionMessage unmap() throws InconsistentJsonException {
var unmappedRequest = request.unmap();
if (unmappedRequest instanceof JarStoreInitialTransactionRequest jstr)
return AddJarStoreInitialTransactionMessages.of(jstr, getId());
else
throw new IllegalArgumentException("The argument of the addJarStoreInitialTransactionRequest() method must be a JarStoreInitialTransactionRequest");
throw new InconsistentJsonException("The argument of the addJarStoreInitialTransactionRequest() method must be a JarStoreInitialTransactionRequest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionReferences;
import io.hotmoka.node.messages.AddJarStoreInitialTransactionResultMessages;
import io.hotmoka.node.messages.api.AddJarStoreInitialTransactionResultMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of a {@link AddJarStoreInitialTransactionResultMessage}.
Expand All @@ -35,7 +35,7 @@ protected AddJarStoreInitialTransactionResultMessageJson(AddJarStoreInitialTrans
}

@Override
public AddJarStoreInitialTransactionResultMessage unmap() throws HexConversionException {
public AddJarStoreInitialTransactionResultMessage unmap() throws InconsistentJsonException {
return AddJarStoreInitialTransactionResultMessages.of(result.unmap(), getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.Base64ConversionException;
import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionRequests;
import io.hotmoka.node.api.requests.JarStoreTransactionRequest;
import io.hotmoka.node.messages.AddJarStoreTransactionMessages;
import io.hotmoka.node.messages.api.AddJarStoreTransactionMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddJarStoreTransactionMessage}.
Expand All @@ -37,12 +36,12 @@ protected AddJarStoreTransactionMessageJson(AddJarStoreTransactionMessage messag
}

@Override
public AddJarStoreTransactionMessage unmap() throws IllegalArgumentException, HexConversionException, Base64ConversionException {
public AddJarStoreTransactionMessage unmap() throws InconsistentJsonException {
var unmappedRequest = request.unmap();
if (unmappedRequest instanceof JarStoreTransactionRequest jstr)
return AddJarStoreTransactionMessages.of(jstr, getId());
else
throw new IllegalArgumentException("The argument of the addJarStoreTransactionRequest() method must be a JarStoreTransactionRequest");
throw new InconsistentJsonException("The argument of the addJarStoreTransactionRequest() method must be a JarStoreTransactionRequest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionReferences;
import io.hotmoka.node.messages.AddJarStoreTransactionResultMessages;
import io.hotmoka.node.messages.api.AddJarStoreTransactionResultMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of a {@link AddJarStoreTransactionResultMessage}.
Expand All @@ -35,7 +35,7 @@ protected AddJarStoreTransactionResultMessageJson(AddJarStoreTransactionResultMe
}

@Override
public AddJarStoreTransactionResultMessage unmap() throws HexConversionException {
public AddJarStoreTransactionResultMessage unmap() throws InconsistentJsonException {
return AddJarStoreTransactionResultMessages.of(result.unmap(), getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.Base64ConversionException;
import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.TransactionRequests;
import io.hotmoka.node.api.requests.StaticMethodCallTransactionRequest;
import io.hotmoka.node.messages.AddStaticMethodCallTransactionMessages;
import io.hotmoka.node.messages.api.AddStaticMethodCallTransactionMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of an {@link AddStaticMethodCallTransactionMessage}.
Expand All @@ -37,12 +36,12 @@ protected AddStaticMethodCallTransactionMessageJson(AddStaticMethodCallTransacti
}

@Override
public AddStaticMethodCallTransactionMessage unmap() throws IllegalArgumentException, HexConversionException, Base64ConversionException {
public AddStaticMethodCallTransactionMessage unmap() throws InconsistentJsonException {
var unmappedRequest = request.unmap();
if (unmappedRequest instanceof StaticMethodCallTransactionRequest smctr)
return AddStaticMethodCallTransactionMessages.of(smctr, getId());
else
throw new IllegalArgumentException("The argument of the addStaticMethodCallTransactionRequest() method must be a StaticMethodCallTransactionRequest");
throw new InconsistentJsonException("The argument of the addStaticMethodCallTransactionRequest() method must be a StaticMethodCallTransactionRequest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import java.util.Optional;

import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.StorageValues;
import io.hotmoka.node.messages.AddStaticMethodCallTransactionResultMessages;
import io.hotmoka.node.messages.api.AddStaticMethodCallTransactionResultMessage;
import io.hotmoka.websockets.beans.AbstractRpcMessageJsonRepresentation;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;

/**
* The JSON representation of a {@link AddStaticMethodCallTransactionResultMessage}.
Expand All @@ -37,7 +37,7 @@ protected AddStaticMethodCallTransactionResultMessageJson(AddStaticMethodCallTra
}

@Override
public AddStaticMethodCallTransactionResultMessage unmap() throws IllegalArgumentException, HexConversionException {
public AddStaticMethodCallTransactionResultMessage unmap() throws InconsistentJsonException {
return AddStaticMethodCallTransactionResultMessages.of(result == null ? Optional.empty() : Optional.of(result.unmap()), getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package io.hotmoka.node.messages.internal.gson;

import io.hotmoka.crypto.HexConversionException;
import io.hotmoka.node.StorageValues;
import io.hotmoka.node.api.values.StorageReference;
import io.hotmoka.node.messages.EventMessages;
import io.hotmoka.node.messages.api.EventMessage;
import io.hotmoka.websockets.beans.api.InconsistentJsonException;
import io.hotmoka.websockets.beans.api.JsonRepresentation;

/**
Expand All @@ -36,16 +36,16 @@ protected EventMessageJson(EventMessage message) {
}

@Override
public EventMessage unmap() throws IllegalArgumentException, HexConversionException {
public EventMessage unmap() throws InconsistentJsonException {
var unmappedEvent = event.unmap();
if (unmappedEvent instanceof StorageReference event) {
var unmappedCreator = creator.unmap();
if (unmappedCreator instanceof StorageReference creator)
return EventMessages.of(creator, event);
else
throw new IllegalArgumentException("The creator of an event message must be a storage reference");
throw new InconsistentJsonException("The creator of an event message must be a storage reference");
}
else
throw new IllegalArgumentException("The event in an event message must be a storage reference");
throw new InconsistentJsonException("The event in an event message must be a storage reference");
}
}
Loading

0 comments on commit ed1e3a8

Please sign in to comment.