Skip to content

FirmaChain/firmachain-wallet-connect-relay

Repository files navigation

firmachain-wallet-connect-relay

Overview

The FirmaChain Wallet Connect Relay is a service that securely connects DApps supporting the FirmaChain network with the FirmaStation mobile wallet.


Features

FirmaChain Wallet Connect Relay allows users of the FirmaStation mobile wallet to connect to DApps that support the FirmaChain network. Users can establish a connection by scanning a QR code generated in the DApp with FirmaStation. Users can then approve or reject transactions on FirmaStation.


Build Instructions

# Clone the repository
$ git clone https://github.com/FirmaChain/walletconnect-relay.git

# Move to project directory
$ cd walletconnect-relay

# Install required packages
$ npm install

# Copy .env file
cp .env.sample .env

Secret Key Generation

To generate a secret key, run the following command. This command generates salt and iv values.

# Secret Key generation
$ npm run new-word

# The expected result of the command execution is as follows:
{
  salt: '905df7b2c4c78aea018e4fb1317c0d0c',
  iv: 'd3f0fc49370716802768954840f14501'
}

Copy .env sample

After copying env.sample to .env, assign appropriate values to the following variables.

  • NODE_ENV: Specifies development or production mode (e.g., development | production).

  • PORT: Specifies the port on which the server will run (eg., 3000).

  • ORIGIN: Decides whether to perform a check on the CORS policy. If ORIGIN is set to 'true', only requests coming from origins registered on the whitelist are allowed (e.g., true | false).

  • CREDENTIALS: Decides whether to allow credentials in CORS settings. If set to 'true', the Access-Control-Allow-Credentials header is set to 'true', allowing cookies and other credentials for requests (e.g., true | false).

  • SECRET_KEY: A random string that plays an important role in encryption and decryption. This key is used to encrypt plaintext data or to convert cipher text back to its original plaintext data (e.g., examplesecretkey).

  • SALT: Use the result value that came out after executing the npm run new-word command (e.g., '905df7b2c4c78aea018e4fb1317c0d0c').

  • IV: Use the result value that came out after executing the npm run new-word command (e.g., 'd3f0fc49370716802768954840f14501').

  • REDIS: Specifies the connection information necessary to connect to the Redis database (e.g., redis://127.0.0.1:6379).

  • REQUEST_EXPIRE_SECOND: Specifies the time until a request expires, in seconds (e.g., 120).


New test project

Run the npm run new-project command to create a new project and register the new project to communicate with Wallet Connect Relay.

npm run new-project

input your project name : test-project
input your project description : firmachain-wallet-connect-relay project
input your project site URL : https://domain.org
input your project icon URL : https://domain.org/white_logo.png
input your project sign callback URL : https://domain.org/callback
input your project verify request URL : https://domain.org/verify
{
  name: 'test-project',
  description: 'firmachain-wallet-connect-relay project',
  url: 'https://domain.org',
  icon: 'https://domain.org/white_logo.png',
  callback: 'https://domain.org/callback',
  verifyRequest: 'https://domain.org/verify'
}
==========================================================================================================================
PROJECT ID : 87f6def8-4a0a-4112-b02f-a12987b052ab
PROJECT SECRET KEY : MjdwTWxRWnk4VW9XSzBOdUE5QlRxVDFkVDlleWtLcFZ6WGJZUENNYktlU1lFMlhXS0VPMjNMWjlNLzRZcTh3Lw==
==========================================================================================================================

Testing

Here's how to check the connection with Wallet Connect Relay after creating a new project.

Config for test (/test/axios.ts)

cp ./test/axios.sample.ts ./test/axios.ts
vim ./test/axios.ts

Edit test project ID

import axios from 'axios';

// your axios config
axios.defaults.baseURL = 'http://localhost:5050';

// input your test project id
const TEST_PROJECT_ID = '87f6def8-4a0a-4112-b02f-a12987b052ab';

export { axios, TEST_PROJECT_ID };

Run & test

npm run dev

npm run test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published