Skip to content

Commit

Permalink
Merge pull request #16 from LedgerHQ/develop
Browse files Browse the repository at this point in the history
Deploy upgraded app with ExchangeSDK to prod
  • Loading branch information
adammino-ledger authored Sep 9, 2024
2 parents c8022fa + 6a27ff9 commit c919670
Show file tree
Hide file tree
Showing 33 changed files with 4,416 additions and 3,071 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

32 changes: 1 addition & 31 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"prettier",
"import",
"@typescript-eslint",
"react-hooks",
"react"
],
"extends": [
"airbnb-typescript/base",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"no-console": "warn",
"prettier/prettier": "error",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-empty-interface": "warn"
}
"extends": ["next/core-web-vitals", "prettier"]
}
18 changes: 10 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# yalc
.yalc
yalc.lock

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# yalc
.yalc
yalc.lock

# testing
/coverage
Expand All @@ -29,17 +30,18 @@ yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env*.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

# Optional npm cache directory
.npm
# typescript
*.tsbuildinfo
next-env.d.ts

# Optional eslint cache
.eslintcache
.vscode
.vscode
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# Platform app Coinify

This is a Live App integrating the Coinify widget used to buy and sell crypto in the Ledger Live context. As of today it is not yet integrated in the Ledger Live platform.

This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

# Getting Started
## Getting Started

First, run the development server:

```bash
npm run dev
# or

yarn dev

```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

Expand All @@ -33,6 +31,27 @@ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

# How to develop

Use the `manifest-dev.json` file to load it in Ledger Live as a live-app.

## Use sandbox environment

In the "manifest.json" file, set the `url` parameter with a `env` query parameter set to "sandbox".

Example: `"url": "http://localhost:3000?env=sandbox"`

## URL params can change the UI landing page

For exampleoing through the sell flow on ledger live will land you directly on the sell page. Example sell params

```
?mode=offRamp
```

##Testing
You will need a bitcoin_test and come funds to test the flow end to end.

# Todo

- Polish UI: for now it is the bare minimum and not styled
Expand Down
9 changes: 9 additions & 0 deletions instrumentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
await import("./sentry.server.config");
}

if (process.env.NEXT_RUNTIME === "edge") {
await import("./sentry.edge.config");
}
}
67 changes: 67 additions & 0 deletions manifest-dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"id": "coinify",
"name": "Coinify",
"private": true,
"url": "http://localhost:3000?env=sandbox",
"homepageUrl": "https://www.coinify.com/",
"icon": "https://cdn.live.ledger.com/icons/platform/coinify.png",
"platforms": ["android", "desktop", "ios"],
"apiVersion": "^2.0.0",
"manifestVersion": "2",
"branch": "stable",
"categories": ["buy", "sell"],
"currencies": "*",
"content": {
"shortDescription": {
"ar": "طريقة سريعة وبسيطة وآمنة لشراء الأصول المشفرة.",
"de": "Eine schnelle, einfache und sichere Möglichkeit, Kryptos zu kaufen.",
"en": "A fast, simple, and secure way to buy crypto.",
"es": "Una forma rápida, sencilla y segura de comprar cripto.",
"fr": "Un moyen rapide, simple et sécurisé d’acheter des cryptos.",
"ja": "暗号資産を迅速・簡単・安全に購入する方法。",
"ko": "신속하고 간편하며 안전한 암호화폐 구매 방법",
"pt": "Uma maneira rápida, simples e segura de comprar cripto.",
"ru": "Быстрый, простой и безопасный способ покупки криптовалют.",
"tr": "Kripto para satın almak için hızlı, basit ve güvenli bir yol.",
"zh": "简单、快捷、安全的加密货币购买方式。"
},
"description": {
"ar": "Coinify هي منصة على الإنترنت آمنة تقدم طريقةً سهلةً لشراء وبيع العملات الافتراضية.",
"de": "Coinify ist eine sichere Online-Plattform, die einen einfachen Weg zum Kauf und Verkauf von virtuellen Währungen bietet.",
"en": "Coinify is a secure online platform that offers an easy way to buy and sell virtual currencies.",
"es": "Coinify es una plataforma online segura que ofrece una manera fácil de comprar y vender divisas virtuales.",
"fr": "Coinify est une plateforme en ligne sécurisée qui permet d’acheter et de vendre facilement des monnaies virtuelles.",
"ja": "Coinifyは、暗号資産を安全かつ簡単に売買できるオンラインプラットフォームです。",
"ko": "Coinify는 쉽고 간단한 가상화폐 매매 서비스를 제공하는 안전한 온라인 플랫폼입니다.",
"pt": "A Coinify é uma plataforma online segura que oferece uma maneira fácil de comprar e vender moedas virtuais.",
"ru": "Coinify — безопасная онлайн-платформа для лёгких покупок и продаж виртуальных валют.",
"tr": "Coinify, sanal para alıp satmanın kolay bir yolunu sunan güvenli bir çevrim içi platformdur.",
"zh": "Coinify 是一个安全的在线平台,可以轻松买卖虚拟货币。"
}
},
"permissions": [
"account.list",
"account.receive",
"account.request",
"currency.list",
"device.close",
"device.exchange",
"device.transport",
"message.sign",
"transaction.sign",
"transaction.signAndBroadcast",
"storage.set",
"storage.get",
"bitcoin.getXPub",
"wallet.capabilities",
"wallet.userId",
"wallet.info",
"exchange.start",
"exchange.complete",
"custom.exchange.start",
"custom.exchange.complete",
"custom.exchange.error"
],
"domains": ["http://", "https://"],
"visibility": "complete"
}
67 changes: 67 additions & 0 deletions manifest-staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"id": "coinify",
"name": "Coinify",
"private": true,
"url": "https://platform-app-coinify-staging.vercel.app/?env=sandbox",
"homepageUrl": "https://www.coinify.com/",
"icon": "https://cdn.live.ledger.com/icons/platform/coinify.png",
"platforms": ["android", "desktop", "ios"],
"apiVersion": "^2.0.0",
"manifestVersion": "2",
"branch": "stable",
"categories": ["buy", "sell"],
"currencies": "*",
"content": {
"shortDescription": {
"ar": "طريقة سريعة وبسيطة وآمنة لشراء الأصول المشفرة.",
"de": "Eine schnelle, einfache und sichere Möglichkeit, Kryptos zu kaufen.",
"en": "A fast, simple, and secure way to buy crypto.",
"es": "Una forma rápida, sencilla y segura de comprar cripto.",
"fr": "Un moyen rapide, simple et sécurisé d’acheter des cryptos.",
"ja": "暗号資産を迅速・簡単・安全に購入する方法。",
"ko": "신속하고 간편하며 안전한 암호화폐 구매 방법",
"pt": "Uma maneira rápida, simples e segura de comprar cripto.",
"ru": "Быстрый, простой и безопасный способ покупки криптовалют.",
"tr": "Kripto para satın almak için hızlı, basit ve güvenli bir yol.",
"zh": "简单、快捷、安全的加密货币购买方式。"
},
"description": {
"ar": "Coinify هي منصة على الإنترنت آمنة تقدم طريقةً سهلةً لشراء وبيع العملات الافتراضية.",
"de": "Coinify ist eine sichere Online-Plattform, die einen einfachen Weg zum Kauf und Verkauf von virtuellen Währungen bietet.",
"en": "Coinify is a secure online platform that offers an easy way to buy and sell virtual currencies.",
"es": "Coinify es una plataforma online segura que ofrece una manera fácil de comprar y vender divisas virtuales.",
"fr": "Coinify est une plateforme en ligne sécurisée qui permet d’acheter et de vendre facilement des monnaies virtuelles.",
"ja": "Coinifyは、暗号資産を安全かつ簡単に売買できるオンラインプラットフォームです。",
"ko": "Coinify는 쉽고 간단한 가상화폐 매매 서비스를 제공하는 안전한 온라인 플랫폼입니다.",
"pt": "A Coinify é uma plataforma online segura que oferece uma maneira fácil de comprar e vender moedas virtuais.",
"ru": "Coinify — безопасная онлайн-платформа для лёгких покупок и продаж виртуальных валют.",
"tr": "Coinify, sanal para alıp satmanın kolay bir yolunu sunan güvenli bir çevrim içi platformdur.",
"zh": "Coinify 是一个安全的在线平台,可以轻松买卖虚拟货币。"
}
},
"permissions": [
"account.list",
"account.receive",
"account.request",
"currency.list",
"device.close",
"device.exchange",
"device.transport",
"message.sign",
"transaction.sign",
"transaction.signAndBroadcast",
"storage.set",
"storage.get",
"bitcoin.getXPub",
"wallet.capabilities",
"wallet.userId",
"wallet.info",
"exchange.start",
"exchange.complete",
"custom.exchange.start",
"custom.exchange.complete",
"custom.exchange.error"
],
"domains": ["http://", "https://"],
"visibility": "complete"
}
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
24 changes: 0 additions & 24 deletions next.config.js

This file was deleted.

69 changes: 69 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { withSentryConfig } from "@sentry/nextjs";

/** @type {import('next').NextConfig} */
const nextConfig = {
compiler: {
styledComponents: true,
},
async headers() {
return [
{
// matching all API routes
source: "/:path*",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "*" },
{
key: "Access-Control-Allow-Methods",
value: "GET,OPTIONS,PATCH,DELETE,POST,PUT",
},
{
key: "Access-Control-Allow-Headers",
value:
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
},
],
},
];
},
};

const mergedConfig = withSentryConfig(
nextConfig,
{
org: "ledger",
project: "platform-app-coinify",
authToken: process.env.SENTRY_AUTH_TOKEN,
silent: false,
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,

// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
// tunnelRoute: "/monitoring",

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,

// Enables automatic instrumentation of Vercel Cron Monitors.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
// automaticVercelMonitors: true,
}
);

export default mergedConfig;
Loading

0 comments on commit c919670

Please sign in to comment.