コード例 #1
0
        public InteropHistory[] GetSwapsForAddress(Address address)
        {
            var list  = _historyMap.Get <Address, StorageList>(address);
            var count = (int)list.Count();

            var result = new InteropHistory[count];

            for (int i = 0; i < count; i++)
            {
                var hash = list.Get <Hash>(i);
                result[i] = _swapMap.Get <Hash, InteropHistory>(hash);
            }

            return(result);
        }
コード例 #2
0
        private void RegisterHistory(Hash swapHash, Hash sourceHash, string sourcePlatform, string sourceChain, Address sourceAddress, Hash destHash, string destPlatform, string destChain, Address destAddress, string symbol, BigInteger value)
        {
            var entry = new InteropHistory()
            {
                sourceAddress  = sourceAddress,
                sourceHash     = sourceHash,
                sourcePlatform = sourcePlatform,
                sourceChain    = sourceChain,
                destAddress    = destAddress,
                destHash       = destHash,
                destPlatform   = destPlatform,
                destChain      = destChain,
                symbol         = symbol,
                value          = value,
            };

            _swapMap.Set <Hash, InteropHistory>(swapHash, entry);

            AppendToHistoryMap(swapHash, sourceAddress);
            AppendToHistoryMap(swapHash, destAddress);
        }