Skip to content

Commit

Permalink
Merge pull request #3 from gregsantos/wc
Browse files Browse the repository at this point in the history
Adds support for WalletConnect using fcl-wc
  • Loading branch information
gregsantos authored Sep 18, 2022
2 parents 8b2c7e0 + 8d808cf commit 03e0958
Show file tree
Hide file tree
Showing 7 changed files with 2,840 additions and 195 deletions.
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#1f6fd0",
"activityBar.background": "#1f6fd0",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#ee90bb",
"activityBarBadge.foreground": "#15202b",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#1f6fd0",
"statusBar.background": "#1857a4",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#1f6fd0",
"statusBarItem.remoteBackground": "#1857a4",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#1857a4",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#1857a499",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#1857a4"
}
19 changes: 19 additions & 0 deletions constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const LILICO_MOBILE_SERVICE = {
f_type: "Service",
f_vsn: "1.0.0",
type: "authn",
method: "WC/RPC",
// this should be the wallets universal link and is used match with existing pairing
uid: "https://link.lilico.app/wc",
endpoint: "flow_authn",
provider: {
address: "0x9a4a5f2e7de57741",
name: "Lilico Mobile",
icon: "/images/lilico.png",
description:
"A Mobile crypto wallet on Flow built for explorers, collectors, and gamers.",
color: "#FC814A",
supportEmail: "hi@lilico.app",
website: "https://link.lilico.app/wc",
},
}
34 changes: 16 additions & 18 deletions flow/config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import * as fcl from "@onflow/fcl"
import getConfig from "next/config"

const USE_LOCAL = true
const USE_LOCAL = false
const resolver = async () => ({
appIdentifier: "Awesome App (v0.0)",
nonce: "3037366134636339643564623330316636626239323161663465346131393662",
})
const { publicRuntimeConfig } = getConfig()

const FCL_CRYPTO_CONTRACT_ADDR =
process.env.NEXT_PUBLIC_FCL_CRYPTO_CONTRACT ||
publicRuntimeConfig.fclCryptoContract

const isServerSide = () => typeof window === "undefined"
const LOCAL_STORAGE = {
Expand All @@ -28,38 +22,42 @@ fcl
.put("app.detail.icon", "https://placekitten.com/g/200/200")
.put("service.OpenID.scopes", "email")
.put("fcl.accountProof.resolver", resolver)
.put(
"discovery.authn.endpoint",
"https://fcl-discovery.onflow.org/api/testnet/authn"
)
// storage override
//.put("fcl.storage", LOCAL_STORAGE)
//.put("discovery.wallet.method", "POP/RPC")

if (USE_LOCAL) {
// prettier-ignore
fcl
.config()
.put("flow.network", "local")
.put("accessNode.api", "http://localhost:8888")
// dev-wallet
.put("discovery.wallet", "http://localhost:8701/fcl/authn")
// local discovery
//.put("discovery.wallet", "http://localhost:3002/testnet/authn")
//.put("discovery.authn.endpoint", "http://localhost:3002/api/testnet/authn")
} else {
// prettier-ignore
fcl
.config()
.put("logger.level", 2)
// testnet
.put("flow.network", "testnet")
.put("accessNode.api", "https://rest-testnet.onflow.org") // grpc: https://access-testnet.onflow.org
.put("discovery.wallet", "https://fcl-discovery.onflow.org/testnet/authn")
// .put("discovery.wallet", "http://localhost:3000/testnet/authn")
// .put("discovery.authn.include", ["0x82ec283f88a62e65"])
.put(
"discovery.authn.endpoint",
"https://fcl-discovery.onflow.org/api/testnet/authn"
)
.put("discovery.authn.include", [
"0x82ec283f88a62e65", // Dapper
"0x9d2e44203cb13051", // Ledger
])
// mainnet
// .put("flow.network", "mainnet")
// .put("accessNode.api", "https://rest-mainnet.onflow.org")
// .put("discovery.wallet", "https://fcl-discovery.onflow.org/authn")
// Discovery API
// .put("discovery.authn.include", ["0x82ec283f88a62e65"])
// .put("discovery.authn.endpoint","https://fcl-discovery.onflow.org/api/testnet/authn")
// .put("discovery.authn.endpoint","https://fcl-discovery.onflow.org/api/mainnet/authn")
// .put("discovery.authn.include", ["0xead892083b3e2c6c", "0xe5cd26afebe62781",])
// Dapper Wallet
// .put("discovery.wallet","https://staging.accounts.meetdapper.com/fcl/authn-restricted")
// .put("discovery.wallet.method", "POP/RPC")
Expand Down
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const nextConfig = {
env: {
FCL_CRYPTO_CONTRACT: process.env.FCL_CRYPTO_CONTRACT,
},
images: {
domains: ["avatars.githubusercontent.com"],
},
}

module.exports = nextConfig
Loading

1 comment on commit 03e0958

@vercel
Copy link

@vercel vercel bot commented on 03e0958 Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.