Skip to content

Commit

Permalink
Merge pull request #84 from nervosnetwork/release/v0.3.0
Browse files Browse the repository at this point in the history
Release/v0.3.0
  • Loading branch information
ashchan authored May 27, 2021
2 parents ab03771 + fe045f9 commit b7a9cc0
Show file tree
Hide file tree
Showing 30 changed files with 734 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .ckb-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.42.0-rc1
0.42.0
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,35 @@ brew install nervosnetwork/tap/tippy

### Tippy Console and UI

While Tippy runs as a console application, it also provides web UI. By default the dashboard UI will be opened automatically, if not you can access it by visiting [http://localhost:5000/Home](http://localhost:5000/Home) from a browser.
While Tippy runs as a console application, it also provides web UI. By default the dashboard UI will be opened automatically, if not you can access it by visiting [http://localhost:5000/](http://localhost:5000/) from a browser.

### Override the App URL

If you want to access the Web UI and Tippy API from another URL than the default `http://localhost` URL, there are two options.

#### 1. Set Environment Variable `ASPNETCORE_URLS`

On Linux you can set the `ASPNETCORE_URLS` Environment Variable to override the default App URL. For example, launch Tippy this way to use `http://0.0.0.0:5000`:

```shell
ASPNETCORE_URLS="http://0.0.0.0:5000" tippy
```

#### 2. Modify `appsettings.json`

You can also modify `appsettings.json` file to override the default App URL. For example, add the following section to use `http://0.0.0.0:5000`:

```json
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://0.0.0.0:5000"
}
}
}
```

`appsettings.json` locates in `/Applications/Tippy.app/Contents/MacOS/` on macOS and in the root Tippy folder on Windows/Linux. If Tippy is installed with Homebrew on Linux then it locates in `/home/linuxbrew/.linuxbrew/Cellar/tippy-linux/[version]/libexec/`.

### Debugger

Expand Down Expand Up @@ -100,6 +128,10 @@ http://localhost:5000/api

See [CKB JSON-RPC doc](https://docs.nervos.org/docs/reference/rpc) for more information.

### The `send_transaction` API method

If you call CKB's `send_transaction` API method through Tippy API, the transactions will be recorded in Tippy. Go to the `Recorded Transactions` tab to view them.

### Tippy RPCs

#### Method `create_chain`
Expand Down Expand Up @@ -462,7 +494,7 @@ Response
```
4. Open `Tippy.sln` with Visual Studio 2019 (v16.8 or later), Visual Studio 2019 for Mac (v8.8 or later), or Visual Studio Code
5. Select `Tippy` as startup project for the solution, then start debugging it
6. Browse `http://localhost:5000/home` in your browser
6. Browse `http://localhost:5000/` in your browser

### Add Database Migration

Expand Down
6 changes: 3 additions & 3 deletions src/Tippy.Core/Data/TippyDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public TippyDbContext(DbContextOptions<TippyDbContext> options)

public DbSet<Project> Projects { get; set; } = null!;
public DbSet<Token> Tokens { get; set; } = null!;
public DbSet<FailedTransaction> FailedTransactions { get; set; } = null!;
public DbSet<RecordedTransaction> RecordedTransactions { get; set; } = null!;
public DbSet<DeniedTransaction> DeniedTransactions { get; set; } = null!;

protected override void OnModelCreating(ModelBuilder modelBuilder)
Expand All @@ -30,9 +30,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.WithMany(p => p.Tokens)
.OnDelete(DeleteBehavior.Cascade);

modelBuilder.Entity<FailedTransaction>()
modelBuilder.Entity<RecordedTransaction>()
.HasOne(t => t.Project)
.WithMany(p => p.FailedTransactions)
.WithMany(p => p.RecordedTransactions)
.OnDelete(DeleteBehavior.Cascade);

modelBuilder.Entity<DeniedTransaction>()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Tippy.Core.Migrations
{
public partial class RenameFailedTransactionsToRecordedTransactions : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FailedTransactions");

migrationBuilder.CreateTable(
name: "RecordedTransactions",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RawTransaction = table.Column<string>(type: "TEXT", nullable: false),
Error = table.Column<string>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
ProjectId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RecordedTransactions", x => x.Id);
table.ForeignKey(
name: "FK_RecordedTransactions_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
name: "IX_RecordedTransactions_ProjectId",
table: "RecordedTransactions",
column: "ProjectId");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RecordedTransactions");

migrationBuilder.CreateTable(
name: "FailedTransactions",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
Error = table.Column<string>(type: "TEXT", nullable: false),
ProjectId = table.Column<int>(type: "INTEGER", nullable: false),
RawTransaction = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FailedTransactions", x => x.Id);
table.ForeignKey(
name: "FK_FailedTransactions_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
name: "IX_FailedTransactions_ProjectId",
table: "FailedTransactions",
column: "ProjectId");
}
}
}
Loading

0 comments on commit b7a9cc0

Please sign in to comment.