Skip to content

Commit

Permalink
Merge branch 'main' into 27-09-24-add-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
hardingjam committed Sep 30, 2024
2 parents 43d6a2a + 94f55fc commit e1c9c90
Show file tree
Hide file tree
Showing 8 changed files with 474 additions and 9 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/rainix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Rainix CI
on: [push]

concurrency:
group: ${{ github.ref }}-rainix
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
standard-tests:
strategy:
matrix:
os: [ubuntu-latest]
task: [rainframe-test]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Run ${{ matrix.task }}
run: nix develop -c ${{ matrix.task }}
14 changes: 8 additions & 6 deletions app/frames/[projectName]/[strategyName]/[deployment]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ const handleRequest = frames(async (ctx) => {
const yamlData = ctx.yamlData;
let currentState: FrameState = ctx.state as unknown as FrameState;

// Handle state restoration after transactions
// Handle state restoration from URL after transactions
if (ctx.url.searchParams.has("currentState")) {
currentState = JSON.parse(
decodeURI(ctx.url.searchParams.get("currentState")!)
);
}

// Add strategy name and description to state from YAML
if (currentState && !currentState.strategyName) {
currentState.strategyName = yamlData.gui.name;
}
if (currentState && !currentState.strategyDescription) {
currentState.strategyDescription = yamlData.gui.description;
}

// Add deployment option to state from URL
if (
currentState &&
!currentState.deploymentOption &&
Expand All @@ -41,10 +46,7 @@ const handleRequest = frames(async (ctx) => {
) || undefined;
}

if (currentState && !currentState.strategyDescription) {
currentState.strategyDescription = yamlData.gui.description;
}

// Get token infos from YAML
if (currentState && !currentState.tokenInfos.length) {
const tokenInfos = await getTokenInfos(yamlData);
currentState.tokenInfos = tokenInfos;
Expand Down Expand Up @@ -85,10 +87,10 @@ const handleRequest = frames(async (ctx) => {
// Generate buttons based on current state
const buttonsData = await generateButtonsData(yamlData, currentState);

// Load font
const dmSansLight = fs.readFile(
path.join(path.resolve(process.cwd(), "public/_fonts"), "DMSans-Light.ttf")
);

const [dmSansLightData] = await Promise.all([dmSansLight]);

return {
Expand Down
26 changes: 23 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,29 @@

outputs = { self, flake-utils, rainix }:
flake-utils.lib.eachDefaultSystem (system:
{
packages = rainix.packages.${system};
devShells = rainix.devShells.${system};
let
pkgs = rainix.pkgs.${system};
in rec {
packages = rec {
rainframe-test = rainix.mkTask.${system} {
name = "rainframe-test";
body = ''
set -euxo pipefail
npm i
'';
};

} // rainix.packages.${system};

devShells.default = pkgs.mkShell {
packages = [
packages.rainframe-test
];

shellHook = rainix.devShells.${system}.default.shellHook;
buildInputs = rainix.devShells.${system}.default.buildInputs;
nativeBuildInputs = rainix.devShells.${system}.default.nativeBuildInputs;
};
}
);
}
48 changes: 48 additions & 0 deletions public/_images/arbitrum-arb-logo-full.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e1c9c90

Please sign in to comment.