Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokenDecimals is causing errors when connecting to certain parachains #76

Open
RostislavLitovkin opened this issue Feb 2, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RostislavLitovkin
Copy link
Contributor

Newtonsoft.Json.JsonSerializationException: Deserializing JSON-RPC result to type Properties failed with JsonReaderException: Error reading integer. Unexpected token: StartArray. Path 'result.tokenDecimals'.
 ---> Newtonsoft.Json.JsonReaderException: Error reading integer. Unexpected token: StartArray. Path 'result.tokenDecimals'.
   at Newtonsoft.Json.JsonReader.ReadAsInt32()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject[T](JsonSerializer jsonSerializer)
   at StreamJsonRpc.JsonMessageFormatter.JsonRpcResult.GetResult[T]()
   --- End of inner exception stack trace ---
   at StreamJsonRpc.JsonMessageFormatter.JsonRpcResult.GetResult[T]()
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at Substrate.NetApi.SubstrateClient.InvokeAsync[T](String method, Object parameters, CancellationToken token)
   at Substrate.NetApi.Modules.System.PropertiesAsync(CancellationToken token)
   at Substrate.NetApi.SubstrateClient.ConnectAsync(Boolean useMetaData, Boolean standardSubstrate, CancellationToken token)
   at Substrate.NetApi.SubstrateClient.ConnectAsync(Boolean useMetaData, CancellationToken token)
   at Substrate.NetApi.SubstrateClient.ConnectAsync()
   at PlutoWallet.Model.AjunaExt.SubstrateClientExt.ConnectAsync() in /Users/rostislavlitovkin/Programming/PlutoWallet/PlutoWallet.Model/AjunaExt/SubstrateClientExt.cs:line 83
   at PlutoWalletTests.AssetsTests.Setup() in /Users/rostislavlitovkin/Programming/PlutoWallet/PlutoWalletTests/AssetsTests.cs:line 27

I am getting the following error when Connecting to Bifrost wss://bifrost-polkadot.api.onfinality.io/public-ws rpc:

try
{
    var endpoint = PlutoWallet.Constants.Endpoints.GetEndpointDictionary["bifrost"];

    //string bestWebSecket = await WebSocketModel.GetFastestWebSocketAsync(endpoint.URLs);

    client = new SubstrateClientExt(
        endpoint, // This is my modification, can be ignored
        new Uri("wss://bifrost-polkadot.api.onfinality.io/public-ws"),
        Substrate.NetApi.Model.Extrinsics.ChargeTransactionPayment.Default());

    await client.ConnectAsync();
}
catch (Exception ex)
{
    // Prints the error written at the top
    Console.WriteLine(ex);
}
@darkfriend77
Copy link
Member

{"jsonrpc":"2.0","result":{"ss58Format":6,"tokenDecimals":[12],"tokenSymbol":["BNC"]},"id":1}

{"jsonrpc": "2.0", "result": {"ss58Format": 1337,"tokenDecimals": 12,"tokenSymbol": "BAJU"},"id": 1}

Might need to move it to a object, instead of a typed return value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants