Skip to content

Commit

Permalink
Add Crescendo setup (#178)
Browse files Browse the repository at this point in the history
* Remove sandboxnet and add crescendo

* Remove sandboxnet

* Add isTestnet check

* Fix test

* Add emulator/local tests

---------

Co-authored-by: Chase Fleming <[email protected]>
  • Loading branch information
chasefleming and chasefleming authored Feb 13, 2024
1 parent 313f43d commit 74efef3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fcl.config({
| ----------- | ---------------------------------------------------------------------- |
| Mainnet | `http://localhost:3002/authn` or `http://localhost:3002/mainnet/authn` |
| Testnet | `http://localhost:3002/testnet/authn` |
| Crescendo | `http://localhost:3002/crescendo/authn` |
| Local | `http://localhost:3002/local/authn` |
| Emulator | `http://localhost:3002/emulator/authn` |

Expand All @@ -42,6 +43,7 @@ fcl.config({
| ----------- | ------------------------------------------------------------------------------ |
| Mainnet | `http://localhost:3002/api/authn` or `http://localhost:3002/api/mainnet/authn` |
| Testnet | `http://localhost:3002/api/testnet/authn` |
| Crescendo | `http://localhost:3002/api/crescendo/authn` |
| Local | `http://localhost:3002/api/local/authn` |
| Emulator | `http://localhost:3002/api/emulator/authn` |

Expand Down
21 changes: 1 addition & 20 deletions data/services.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,6 @@
}
}
],
"sandboxnet": [
{
"f_type": "Service",
"f_vsn": "1.0.0",
"type": "authn",
"method": "POP/RPC",
"uid": "dapper-wallet#authn",
"endpoint": "https://sandbox.accounts.meetdapper.com/fcl/authn-restricted",
"optIn": true,
"provider": {
"address": "0x6b0d5e229a66db2d",
"name": "Dapper Wallet",
"icon": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzE1IiBoZWlnaHQ9IjMxNSIgdmlld0JveD0iLTUwIC01MCA0MTUgNDE1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cG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uMDUxIDI1My41NzEgMTU3Ljc5NEMyNTMuNTcxIDEzNS41NDIgMjM1LjUzMyAxMTcuNTA0IDIxMy4yODEgMTE3LjUwNFoiIGZpbGw9IiM3MzIwRDMiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMzQuOTgxIDEyOC44NzZDMTM0Ljk4MSAxMzguNjU2IDEyNy4wNTIgMTQ2LjU4MSAxMTcuMjcxIDE0Ni41ODFDMTA3LjQ5NSAxNDYuNTgxIDk5LjU2NTkgMTM4LjY1NiA5OS41NjU5IDEyOC44NzZDOTkuNTY1OSAxMTkuMDk5IDEwNy40OTUgMTExLjE3IDExNy4yNzEgMTExLjE3QzEyNy4wNTIgMTExLjE3IDEzNC45ODEgMTE5LjA5OSAxMzQuOTgxIDEyOC44NzZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTI1My4wMjEgMTI4Ljg3NkMyNTMuMDIxIDEzOC42NTYgMjQ1LjA5MyAxNDYuNTgxIDIzNS4zMTYgMTQ2LjU4MUMyMjUuNTM1IDE0Ni41ODEgMjE3LjYxIDEzOC42NTYgMjE3LjYxIDEyOC44NzZDMjE3LjYxIDExOS4wOTkgMjI1LjUzNSAxMTEuMTcgMjM1LjMxNiAxMTEuMTdDMjQ1LjA5MyAxMTEuMTcgMjUzLjAyMSAxMTkuMDk5IDI1My4wMjEgMTI4Ljg3NloiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
"description": "The trusted gateway to your digital world.",
"color": "#FF5A9D",
"supportEmail": "[email protected]",
"website": "https://meetdapper.com"
}
}
],
"testnet": [
{
"f_type": "Service",
Expand Down Expand Up @@ -247,6 +227,7 @@
}
}
],
"crescendo": [],
"canarynet": [
{
"f_type": "Service",
Expand Down
16 changes: 13 additions & 3 deletions helpers/__tests__/paths.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ describe('paths helpers: createPathFromArray', () => {
const arrTwo = ['mainnet', 'authn']
const arrThree = ['testnet', 'authn']
const arrFour = ['canarynet', 'authn']
const arrFive = ['sandboxnet', 'authn']
const arrFive = ['crescendo', 'authn']
const arrSix= ['local', 'authn']
const arrSeven = ['emulator', 'authn']

const expectedResponseOne = '/authn'
const expectedResponseTwo = '/mainnet/authn'
const expectedResponseThree = '/testnet/authn'
const expectedResponseFour = '/canarynet/authn'
const expectedResponseFive = '/sandboxnet/authn'
const expectedResponseFive = '/crescendo/authn'
const expectedResponseSix = '/local/authn'
const expectedResponseSeven = '/emulator/authn'

expect(createPathFromArray(arrOne)).toEqual(expectedResponseOne)
expect(createPathFromArray(arrTwo)).toEqual(expectedResponseTwo)
expect(createPathFromArray(arrThree)).toEqual(expectedResponseThree)
expect(createPathFromArray(arrFour)).toEqual(expectedResponseFour)
expect(createPathFromArray(arrFive)).toEqual(expectedResponseFive)
expect(createPathFromArray(arrSix)).toEqual(expectedResponseSix)
expect(createPathFromArray(arrSeven)).toEqual(expectedResponseSeven)
})
})

Expand All @@ -29,14 +35,18 @@ describe('paths helpers: isValidPath', () => {
const pathThree = ['testnet', 'authn']
const pathFour = ['canarynet', 'authn']
const pathFive = ['foo', 'bar']
const pathSix = ['sandboxnet', 'authn']
const pathSix = ['crescendo', 'authn']
const pathSeven = ['local', 'authn']
const pathEight = ['emulator', 'authn']

expect(isValidPath(pathOne)).toBe(true)
expect(isValidPath(pathTwo)).toBe(true)
expect(isValidPath(pathThree)).toBe(true)
expect(isValidPath(pathFour)).toBe(true)
expect(isValidPath(pathFive)).toBe(false)
expect(isValidPath(pathSix)).toBe(true)
expect(isValidPath(pathSeven)).toBe(true)
expect(isValidPath(pathEight)).toBe(true)
expect(isValidPath(null)).toBe(false)
})
})
Expand Down
6 changes: 3 additions & 3 deletions helpers/constants.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Enum from 'enum-xyz'

const { AUTHN, CANARYNET, TESTNET, SANDBOXNET, MAINNET, LOCAL, EMULATOR } = Enum.String({ casing: 'lowercase' })
const { AUTHN, CANARYNET, TESTNET, CRESCENDO, MAINNET, LOCAL, EMULATOR } = Enum.String({ casing: 'lowercase' })

export const NETWORKS = {
CANARYNET, // canarynet
TESTNET,
SANDBOXNET,
CRESCENDO,
MAINNET,
LOCAL,
EMULATOR
Expand All @@ -31,7 +31,7 @@ export const PATHS = {
MAINNET: '/authn',
MAINNET_EXPLICIT: '/mainnet/authn',
TESTNET: '/testnet/authn',
SANDBOXNET: '/sandboxnet/authn',
CRESCENDO: '/crescendo/authn',
CANARYNET: '/canarynet/authn',
LOCAL: '/local/authn',
EMULATOR: '/emulator/authn',
Expand Down
2 changes: 1 addition & 1 deletion helpers/networks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NETWORKS } from './constants'

export const isTestnet = () => {
return window.location.pathname.split('/').includes(NETWORKS.TESTNET)
return window.location.pathname.split('/').includes(NETWORKS.TESTNET) || window.location.pathname.split('/').includes(NETWORKS.CRESCENDO)
}
4 changes: 4 additions & 0 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default function Home() {
<strong>Testnet:</strong>{' '}
https://fcl-discovery.onflow.org/api/testnet/authn
</div>
<div>
<strong>Crescendo:</strong>{' '}
https://fcl-discovery.onflow.org/api/crescendo/authn
</div>
<div>
<strong>Local:</strong>{' '}
https://fcl-discovery.onflow.org/api/local/authn
Expand Down

0 comments on commit 74efef3

Please sign in to comment.