private static MockCellDep[] GetMockCellDep(Client client, CellDep cellDep) { TransactionWithStatus?txWithStatus = client.GetTransaction(cellDep.OutPoint.TxHash); if (txWithStatus == null) { throw new Exception($"Cannot find cell dep: {{ tx_hash: {cellDep.OutPoint.TxHash}, index: {cellDep.OutPoint.Index} }}!"); } int index = (int)TypesConvert.HexToUInt32(cellDep.OutPoint.Index); string data = txWithStatus.Transaction.OutputsData[index]; Output output = txWithStatus.Transaction.Outputs[index]; List <MockCellDep> mockCellDeps = new(); mockCellDeps.Add(new MockCellDep() { CellDep = cellDep, Output = output, Data = data, }); if (cellDep.DepType == "dep_group") { CellDep[] cellDeps = UnpackDepGroup(data); foreach (CellDep dep in cellDeps) { mockCellDeps.AddRange(GetMockCellDep(client, dep)); } } return(mockCellDeps.ToArray()); }
public CellDepSerializer(CellDep cellDep) : base(new BaseSerializer[] { new OutPointSerializer(cellDep.OutPoint), new ByteSerializer((byte)(cellDep.DepType == "code" ? 0x0 : 0x1)) }) { }