public override void Decode(byte[] byteArray, ref int p) { var start = p; Weight = new U64(); Weight.Decode(byteArray, ref p); DispatchClass = new EnumType <DispatchClass>(); DispatchClass.Decode(byteArray, ref p); Pays = new EnumType <Pays>(); Pays.Decode(byteArray, ref p); _size = p - start; }
public async Task CheckRaisedOwnedMogwaisCountAsync() { var wallet = new Wallet(); await wallet.StartAsync(); Assert.True(wallet.IsConnected); wallet.Load("dev_wallet"); Assert.True(wallet.IsCreated); await wallet.UnlockAsync("aA1234dd"); Assert.True(wallet.IsUnlocked); ulong test = 0; Action <string, StorageChangeSet> callOwnedMogwaisCount = (subscriptionId, eventObject) => { Console.WriteLine($"Subscription[{subscriptionId}]: {eventObject}"); if (eventObject.Changes != null) { var p = 0; var u64 = new U64(); u64.Decode(Utils.HexToByteArray(eventObject.Changes[0][1]), ref p); test = u64.Value; } }; await wallet.Client.SubscribeStorageKeyAsync("DotMogModule", "OwnedMogwaisCount", new[] { Utils.Bytes2HexString(wallet.Account.Bytes) }, callOwnedMogwaisCount); Thread.Sleep(1000); Assert.AreEqual(1, test); }
public override void Decode(byte[] byteArray, ref int p) { var start = p; Id = new Hash(); Id.Decode(byteArray, ref p); Begin = new BlockNumber(); Begin.Decode(byteArray, ref p); Duration = new U16(); Duration.Decode(byteArray, ref p); EventType = new EnumType <GameEventType>(); EventType.Decode(byteArray, ref p); Hashes = new Vec <Hash>(); Hashes.Decode(byteArray, ref p); Value = new U64(); Value.Decode(byteArray, ref p); _size = p - start; }
public override void Decode(byte[] byteArray, ref int p) { var start = p; CollectionNumbersLimit = new U32(); CollectionNumbersLimit.Decode(byteArray, ref p); AccountTokenOwnershipLimit = new U32(); AccountTokenOwnershipLimit.Decode(byteArray, ref p); CollectionAdminsLimit = new U64(); CollectionAdminsLimit.Decode(byteArray, ref p); CustomDataLimit = new U32(); CustomDataLimit.Decode(byteArray, ref p); NftSponsorTimeout = new U32(); NftSponsorTimeout.Decode(byteArray, ref p); FungibleSponsorTimeout = new U32(); FungibleSponsorTimeout.Decode(byteArray, ref p); RefungibleSponsorTimeout = new U32(); RefungibleSponsorTimeout.Decode(byteArray, ref p); OffchainSchemaLimit = new U32(); OffchainSchemaLimit.Decode(byteArray, ref p); VariableOnChainSchemaLimit = new U32(); VariableOnChainSchemaLimit.Decode(byteArray, ref p); ConstOnChainSchemaLimit = new U32(); ConstOnChainSchemaLimit.Decode(byteArray, ref p); _size = p - start; }
private static async Task AllMogwaisCountSubscriptionAsync(string[] args) { using var client = new SubstrateClient(new Uri(Websocketurl)); client.RegisterTypeConverter(new GenericTypeConverter <MogwaiStruct>()); await client.ConnectAsync(CancellationToken.None); var subscriptionId = await client.SubscribeStorageKeyAsync("DotMogModule", "AllMogwaisCount", null, (id, storageChangeSet) => { foreach (var change in storageChangeSet.Changes) { var p = 0; var u64 = new U64(); u64.Decode(Utils.HexToByteArray(change[1]), ref p); var result = u64.Value; Console.WriteLine($"AllMogwaisCount = {result}"); } }, CancellationToken.None); Thread.Sleep(60000); var reqResultUnsubscribe = await client.State.UnsubscribeStorageAsync(subscriptionId, CancellationToken.None); }