-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add 16 avatars in full resolution * add service account avatar, resize avatars to 500px * add naive account indexing * reorganize go code, add address index util * rename interactions to go-bindings module, retrieve account index from the client-side * show account avatar on details screen * fix empty interaction parsing
- Loading branch information
1 parent
00c8fd3
commit 9ccb447
Showing
47 changed files
with
943 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,4 @@ src/app/homepage/pages/**/*.html | |
*.sqlite | ||
|
||
openapi.json | ||
src/interactions/bin | ||
src/go-bindings/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { | ||
GetParsedInteractionRequest, | ||
GetParsedInteractionResponse, | ||
GetAddressIndexRequest, | ||
GetAddressIndexResponse, | ||
} from "@flowser/shared"; | ||
import { Body, Controller, Post } from "@nestjs/common"; | ||
import { GoBindingsService } from "./go-bindings.service"; | ||
|
||
@Controller("go-bindings") | ||
export class GoBindingsController { | ||
constructor(private readonly service: GoBindingsService) {} | ||
|
||
@Post("get-parsed-interaction") | ||
async getParsedInteraction(@Body() body: unknown) { | ||
const request = GetParsedInteractionRequest.fromJSON(body); | ||
const response = await this.service.getParsedInteraction(request); | ||
return GetParsedInteractionResponse.toJSON(response); | ||
} | ||
|
||
@Post("get-address-index") | ||
async getAddressIndex(@Body() body: unknown) { | ||
const request = GetAddressIndexRequest.fromJSON(body); | ||
const response = await this.service.getAddressIndex(request); | ||
return GetAddressIndexResponse.toJSON(response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { GoBindingsService } from './go-bindings.service'; | ||
import { GoBindingsController } from './go-bindings.controller'; | ||
|
||
@Module({ | ||
providers: [GoBindingsService], | ||
controllers: [GoBindingsController], | ||
exports: [GoBindingsService] | ||
}) | ||
export class GoBindingsModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { GoBindingsService } from "./go-bindings.service"; | ||
|
||
describe("InteractionsService", () => { | ||
let service: GoBindingsService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [GoBindingsService], | ||
}).compile(); | ||
|
||
service = module.get<GoBindingsService>(GoBindingsService); | ||
}); | ||
|
||
it("should be defined", () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
import { | ||
GetParsedInteractionRequest, | ||
GetParsedInteractionResponse, | ||
GetAddressIndexRequest, | ||
GetAddressIndexResponse, | ||
} from "@flowser/shared"; | ||
import { spawn } from "node:child_process"; | ||
import * as path from "path"; | ||
|
||
type ExecuteGoBinRequest = { | ||
command: string; | ||
arguments: string[]; | ||
stdIn?: string; | ||
}; | ||
|
||
type ExecuteGoBinResponse = { | ||
raw: string; | ||
}; | ||
|
||
@Injectable() | ||
export class GoBindingsService { | ||
public async getParsedInteraction( | ||
request: GetParsedInteractionRequest | ||
): Promise<GetParsedInteractionResponse> { | ||
const response = await this.execute({ | ||
command: "get-parsed-interaction", | ||
arguments: [], | ||
stdIn: request.sourceCode, | ||
}); | ||
|
||
return GetParsedInteractionResponse.fromJSON(JSON.parse(response.raw)); | ||
} | ||
|
||
public async getAddressIndex( | ||
request: GetAddressIndexRequest | ||
): Promise<GetAddressIndexResponse> { | ||
const response = await this.execute({ | ||
command: "get-address-index", | ||
arguments: [request.chainId, request.hexAddress], | ||
}); | ||
|
||
return { index: Number(response.raw) }; | ||
} | ||
|
||
private execute(request: ExecuteGoBinRequest): Promise<ExecuteGoBinResponse> { | ||
return new Promise((resolve, reject) => { | ||
const childProcess = spawn(path.join(__dirname, "bin/internal"), [ | ||
request.command, | ||
...request.arguments, | ||
]); | ||
|
||
let rawResponse = ""; | ||
childProcess.stdout.on("data", (data) => { | ||
rawResponse += data.toString(); | ||
}); | ||
|
||
if (request.stdIn !== undefined) { | ||
childProcess.stdin.write(request.stdIn); | ||
// Write null char to signal the end of input. | ||
childProcess.stdin.write(new Uint8Array([0])); | ||
} | ||
|
||
childProcess.on("close", (code) => { | ||
if (code !== 0) { | ||
reject(`Interaction parser exited with code: ${code}`); | ||
} else { | ||
resolve({ raw: rawResponse }); | ||
} | ||
}); | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Toy Faces Library - 3D Avatars | ||
------------------------ | ||
from amritpaldesign.com | ||
|
||
Licenses Explained: https://amritpaldesign.com/licenses | ||
|
||
Thanks for your support ;) | ||
-------------------------- | ||
|
||
Please contact me if you have any questions via [email protected] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.