Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a464a56
add hyperspace config
lalexgap Feb 27, 2023
2036979
fix up ts config files
lalexgap Feb 27, 2023
648bbcd
cors workaround for localhost
lalexgap Feb 27, 2023
62be2aa
upgrade ethers and client-schema
lalexgap Feb 27, 2023
c7b7a3b
switch to type 2 transactions
lalexgap Feb 27, 2023
76e8810
handle hyperspace chain id
lalexgap Feb 27, 2023
74cf9b1
new version of ethers doesnt like 0x0
lalexgap Feb 27, 2023
2bfaa24
check chainId instead of network version
lalexgap Feb 27, 2023
e8c41d6
remove preinstall
lalexgap Feb 27, 2023
edf412b
hyperspace versions
lalexgap Feb 27, 2023
72744d6
add prod env vars
lalexgap Feb 27, 2023
06e4e3e
larger cache size to avoid warning
lalexgap Feb 27, 2023
c2b6998
use heroku url for tracker
lalexgap Feb 27, 2023
951a7bf
correct explorer link for hyperspace
lalexgap Feb 28, 2023
de88b28
ignore mesages with data = ""
geoknee Feb 28, 2023
f4e9884
Merge pull request #5 from statechannels/ignore-empty-string
geoknee Feb 28, 2023
ba7472a
bump version number
geoknee Feb 28, 2023
de96e9d
remove typo
geoknee Feb 28, 2023
fabdefe
support for mockingInfuraProvider for hyperspace
lalexgap Feb 28, 2023
7a1090a
Update UI to show TFIL not ETH
geoknee Mar 1, 2023
9c4ed25
Revert "Update UI to show TFIL not ETH"
geoknee Mar 1, 2023
56b0149
CHANGE ETH TO FIL
geoknee Mar 1, 2023
8abf2ba
Apply suggestions from code review
geoknee Mar 1, 2023
28b1449
Apply suggestions from code review
geoknee Mar 1, 2023
475c12a
Merge pull request #7 from statechannels/fil-ui
geoknee Mar 1, 2023
4ab05d4
update to new firebase
lalexgap Mar 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .env.local-hyperspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
## all
NODE_ENV = 'production'
LOG_DESTINATION = 'console'
LOG_LEVEL = 'info'
# e2e-tests
BROWSER_LOG_DESTINATION = 'browser.log'
HEADLESS = 'false'
USE_DAPPETEER = 'true'
WEB3TORRENT_URL = 'http://localhost:3000'
CLOSE_BROWSERS = 'true'

## web3torrent, xstate-wallet, rps, simple-hub
CHAIN_NETWORK_ID = '3141'

## simple-hub, e2e
INFURA_API_KEY = ''
RPC_ENDPOINT = https://api.hyperspace.node.glif.io/rpc/v1

## simple-hub, rps
FIREBASE_API_KEY = 'AIzaSyAOvhDzJir_El3O6SJ2xQlrpOisnObq6zw'
FIREBASE_PREFIX = 'netlify-hyperspace'
FIREBASE_PROJECT = 'web3torrent-default-rtdb'

## rps, xstate-wallet, ttt
TARGET_NETWORK = 'hyperspace'

## web3torrent, rps, ttt
WALLET_URL = 'http://localhost:3055'

## simple-hub, xstate-wallet
CONSENSUS_APP_ADDRESS = '0xeB1170bf49fac482fA296C98Ac04024e8a2d6519'

NITRO_ADJUDICATOR_ADDRESS = '0xaA512d99EC808FBf49b1e6491A251f2E75f913Ad'
ETH_ASSET_HOLDER_ADDRESS = '0x6abaBB7e642C794264DAa2a1477B48521AaE1553'

TRIVIAL_APP_ADDRESS = '0x95900b17Bd2CE12431C99A886FfDC5a451C14344'

## simple-hub
FIREBASE_URL = https://${FIREBASE_PROJECT}.firebaseio.com/
# This is a funded address on goerli for the hub. This is NOT the production address/key
HUB_CHAIN_PK = '0xBB72BD0824663E0B52FA3523ACED0F866550BBC1FD600D7F2DA9C45CAC509AE7'
HUB_PARTICIPANT_ID = 'firebase:simple-hub'

## xstate-wallet
# This is a funded address on goerli for the hub. This is NOT the production address/key
HUB_DESTINATION = '0x000000000000000000000000c4FB59b7fb0D8001Bda6DEA539117664573006c9'
USE_INDEXED_DB = 'true'

## web3torrent
FUNDING_STRATEGY = 'Virtual'
SINGLE_ASSET_PAYMENT_CONTRACT_ADDRESS = '0x4964f1aE3Ca9Ea0a1e7EF873a379768dBc74F034'
SKIP_PREFLIGHT_CHECK = 'true'
TRACKER_URL = 'localhost:8000'
TRACKER_URL_HTTP_PROTOCOL = 'http'
GENERATE_SOURCEMAP = 'true'

## rps
RPS_CONTRACT_ADDRESS = '0x'

## web3torrent-tracker
TRACKER_PORT = 80

## ttt
TTT_CONTRACT_ADDRESS = '0x'
FIREBASE_PROJECT_TTT = 'tic-tac-toe-production'


ADD_LOGS = true
68 changes: 68 additions & 0 deletions .env.production-hyperspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
## all
NODE_ENV = 'production'
LOG_DESTINATION = 'console'
LOG_LEVEL = 'info'
# e2e-tests
BROWSER_LOG_DESTINATION = 'browser.log'
HEADLESS = 'false'
USE_DAPPETEER = 'true'
WEB3TORRENT_URL = 'https://hyperspace-torrent.statechannels.org'
CLOSE_BROWSERS = 'true'

## web3torrent, xstate-wallet, rps, simple-hub
CHAIN_NETWORK_ID = '3141'

## simple-hub, e2e
INFURA_API_KEY = ''
RPC_ENDPOINT = https://api.hyperspace.node.glif.io/rpc/v1

## simple-hub, rps
FIREBASE_API_KEY = 'AIzaSyAOvhDzJir_El3O6SJ2xQlrpOisnObq6zw'
FIREBASE_PREFIX = 'netlify-hyperspace'
FIREBASE_PROJECT = 'web3torrent-default-rtdb'

## rps, xstate-wallet, ttt
TARGET_NETWORK = 'hyperspace'

## web3torrent, rps, ttt
WALLET_URL = 'https://hyperspace-wallet.statechannels.org/'

## simple-hub, xstate-wallet
CONSENSUS_APP_ADDRESS = '0xeB1170bf49fac482fA296C98Ac04024e8a2d6519'

NITRO_ADJUDICATOR_ADDRESS = '0xaA512d99EC808FBf49b1e6491A251f2E75f913Ad'
ETH_ASSET_HOLDER_ADDRESS = '0x6abaBB7e642C794264DAa2a1477B48521AaE1553'

TRIVIAL_APP_ADDRESS = '0x95900b17Bd2CE12431C99A886FfDC5a451C14344'

## simple-hub
FIREBASE_URL = https://${FIREBASE_PROJECT}.firebaseio.com/
# This is a funded address on goerli for the hub. This is NOT the production address/key
HUB_CHAIN_PK = '0xBB72BD0824663E0B52FA3523ACED0F866550BBC1FD600D7F2DA9C45CAC509AE7'
HUB_PARTICIPANT_ID = 'firebase:simple-hub'

## xstate-wallet
# This is a funded address on goerli for the hub. This is NOT the production address/key
HUB_DESTINATION = '0x000000000000000000000000c4FB59b7fb0D8001Bda6DEA539117664573006c9'
USE_INDEXED_DB = 'true'

## web3torrent
FUNDING_STRATEGY = 'Virtual'
SINGLE_ASSET_PAYMENT_CONTRACT_ADDRESS = '0x4964f1aE3Ca9Ea0a1e7EF873a379768dBc74F034'
SKIP_PREFLIGHT_CHECK = 'true'
TRACKER_URL = 'web3torrent-tracker-hyperspace.herokuapp.com'
TRACKER_URL_HTTP_PROTOCOL = 'https'
GENERATE_SOURCEMAP = 'true'

## rps
RPS_CONTRACT_ADDRESS = '0x'

## web3torrent-tracker
TRACKER_PORT = 80

## ttt
TTT_CONTRACT_ADDRESS = '0x'
FIREBASE_PROJECT_TTT = 'tic-tac-toe-production'


ADD_LOGS = true
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"lint:check": "lerna run lint:check --no-sort --no-bail -- --max-warnings=0",
"lint:write": "lerna run lint:write --no-sort --no-bail",
"postinstall": "patch-package",
"preinstall": "npx typesync",
"prepare": "lerna run --concurrency 8 --stream prepare",
"publish": "lerna publish --yes from-package patch",
"release:netlify": "lerna run release:netlify --stream -- --auth $NETLIFY_ACCESS_TOKEN --message $(git rev-parse --short HEAD) $([ $(git rev-parse --abbrev-ref HEAD) = master ] && echo --prod)",
Expand Down
6 changes: 3 additions & 3 deletions packages/channel-client/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@statechannels/channel-client",
"description": "Browser-compatible JS client implementing the State Channels Client API",
"version": "0.3.0",
"version": "0.3.0-hyperspace",
"author": "snario <liam@l4v.io>",
"dependencies": {
"@statechannels/client-api-schema": "^0.3.0",
"@statechannels/iframe-channel-provider": "^0.3.0",
"@statechannels/client-api-schema": "0.3.0",
"@statechannels/iframe-channel-provider": "0.3.0",
"ethers": "4.0.45",
"eventemitter3": "4.0.0",
"loglevel": "1.6.8"
Expand Down
3 changes: 1 addition & 2 deletions packages/channel-client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"target": "es2015",
"esModuleInterop": true,
"types": ["react", "jest", "node"]
},
"references": [{"path": "../iframe-channel-provider"}, {"path": "../client-api-schema"}]
}
}
2 changes: 1 addition & 1 deletion packages/iframe-channel-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@statechannels/iframe-channel-provider",
"version": "0.3.0",
"version": "0.3.0-hyperspace-patch-0",
"browser": "dist/iframe-channel-provider.js",
"browserslist": {
"production": [
Expand Down
1 change: 1 addition & 0 deletions packages/iframe-channel-provider/src/channel-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export class IFrameChannelProvider implements IFrameChannelProviderInterface {

protected async onMessage(event: MessageEvent) {
let message;
if (event.data == '') return;
if (isJsonRpcNotification(event.data)) {
message = parseNotification(event.data); // Narrows type, throws if it does not fit the schema
const notificationMethod = message.method;
Expand Down
4 changes: 4 additions & 0 deletions packages/iframe-channel-provider/src/postmessage-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export class PostMessageService {
this.attempts += 1;

logger.info({message}, 'Sending message (attempt %s)', this.attempts);
// TODO: This lets us get around CORS restrictions when using different ports on localhost
if (corsUrl.startsWith('http://localhost')) {
corsUrl = '*';
}
Comment on lines +43 to +46
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you explain this a little more?

target.postMessage(message, corsUrl);
logger.info({message}, 'Sent message:');

Expand Down
2 changes: 1 addition & 1 deletion packages/xstate-wallet/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ module.exports = function(webpackEnv) {
isEnvProduction &&
new WorkboxWebpackPlugin.GenerateSW({
clientsClaim: true,
maximumFileSizeToCacheInBytes: 6000000,
maximumFileSizeToCacheInBytes: 10000000,
exclude: [/\.map$/, /asset-manifest\.json$/],
navigateFallback: publicUrl + '/index.html',
navigateFallbackDenylist: [
Expand Down
8 changes: 4 additions & 4 deletions packages/xstate-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@statechannels/xstate-wallet",
"description": "State channel wallet using xstate.",
"version": "0.3.0",
"version": "0.3.0-hyperspace",
"author": "Alex Gap",
"babel": {
"presets": [
Expand All @@ -25,7 +25,7 @@
"@rimble/connection-banner": "1.2.3",
"@rimble/utils": "1.2.3",
"@sentry/browser": "5.15.5",
"@statechannels/client-api-schema": "^0.3.0",
"@statechannels/client-api-schema": "0.3.0",
"@statechannels/nitro-protocol": "^0.3.0",
"@statechannels/wallet-core": "^0.3.0",
"@statechannels/wire-format": "^0.3.0",
Expand All @@ -38,13 +38,14 @@
"babel-preset-react-app": "9.1.0",
"css-loader": "3.4.2",
"dexie": "3.0.0",
"ethers": "5.0.7",
"ethers": "5.5.0",
"eventemitter3": "4.0.0",
"file-loader": "5.0.2",
"filter-async-rxjs-pipe": "0.1.5",
"fork-ts-checker-webpack-plugin": "1.5.0",
"git-revision-webpack-plugin": "3.0.6",
"guid-typescript": "1.0.9",
"webpack-dev-server": "^3.11.0",
"html-webpack-plugin": "4.0.0-beta.5",
"jsonrpc-lite": "2.1.0",
"mini-css-extract-plugin": "0.9.0",
Expand Down Expand Up @@ -72,7 +73,6 @@
"url-loader": "3.0.0",
"url-parse": "1.4.7",
"webpack": "4.41.5",
"webpack-dev-server": "^3.11.0",
"webpack-manifest-plugin": "2.2.0",
"webpack-merge": "4.2.2",
"workbox-webpack-plugin": "5.0.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/xstate-wallet/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ void (async () => {
});

process.env.TARGET_NETWORK = getNetworkName(process.env.CHAIN_NETWORK_ID);

// TODO: Devtools doesn't support hyperspace yet
if (Number(process.env.CHAIN_NETWORK_ID) === 3141) {
process.env.TARGET_NETWORK = 'hyperspace';
console.log("Using 'hyperspace' as the target network");
}
Comment on lines +56 to +60
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How much work to fixup devtools? We make this change in many places...

if (process.env.TARGET_NETWORK === 'development') {
// Add contract addresses to process.env if running ganache
const {deployer} = await await setupGanache(process.env.XSTATE_WALLET_DEPLOYER_ACCOUNT_INDEX);
Expand Down
9 changes: 3 additions & 6 deletions packages/xstate-wallet/src/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export class ChainWatcher implements Chain {

const response = await this.signer.sendTransaction({
...convertNitroTransactionRequest(transactionRequest),
gasPrice: GAS_PRICE
maxPriorityFeePerGas: GAS_PRICE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: Is this a good way to migrate the transaction type? Here's a good reference https://www.liquity.org/blog/how-eip-1559-changes-the-transaction-fees-of-ethereum .

GAS_PRICE is defined on L244 with some reference to Goerli network.

In the short term, we can do whatever seems to work. But we should have an eye on things like this which may break once deployed to Filecoin mainnet.

I think one alternative is to query the chain first to get a maxPriorityFeePerGas.

});
return response.hash;
}
Expand All @@ -369,7 +369,7 @@ export class ChainWatcher implements Chain {
};
const response = await this.signer.sendTransaction({
...convertNitroTransactionRequest(transactionRequest),
gasPrice: GAS_PRICE
maxPriorityFeePerGas: GAS_PRICE
});
const tx = await response.wait();
return tx.transactionHash;
Expand Down Expand Up @@ -497,10 +497,7 @@ export class ChainWatcher implements Chain {
function convertNitroTransactionRequest(nitroTransactionRequest): TransactionRequest {
return {
...nitroTransactionRequest,
gasLimit: nitroTransactionRequest.gasLimit
? BN.from(nitroTransactionRequest.gasLimit)
: undefined,
gasPrice: nitroTransactionRequest.gasPrice
maxPriorityFeePerGas: nitroTransactionRequest.gasPrice
? BN.from(nitroTransactionRequest.gasPrice)
: undefined,
nonce: nitroTransactionRequest.nonce ? BN.from(nitroTransactionRequest.nonce) : undefined,
Expand Down
6 changes: 4 additions & 2 deletions packages/xstate-wallet/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AddressZero} from '@ethersproject/constants';
import {Destination} from '@statechannels/wallet-core';
import { AddressZero } from '@ethersproject/constants';
import { Destination } from '@statechannels/wallet-core';

// TODO: Use getEnvBool from devtools once working
function getBool(val: string | undefined): boolean {
Expand Down Expand Up @@ -71,3 +71,5 @@ export const HUB = {
export const TARGET_NETWORK = process.env.TARGET_NETWORK || 'development';
export const FAUCET_LINK =
TARGET_NETWORK === 'goerli' ? 'https://goerli-faucet.slock.it/' : 'https://faucet.ropsten.be/';

export const RPC_ENDPOINT = process.env.RPC_ENDPOINT;
8 changes: 4 additions & 4 deletions packages/xstate-wallet/src/integration-tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export function generatePlayerUpdate(
jsonrpc: '2.0',
params: {
channelId,
appData: '0x0',
appData: '0x00',
allocations: [
{
token: hexZeroPad('0x0', 32),
Expand Down Expand Up @@ -231,7 +231,7 @@ export function generateCreateChannelRequest(
}
],
appDefinition: '0x430869383d611bBB1ce7Ca207024E7901bC26b40',
appData: '0x0',
appData: '0x00',
fundingStrategy: 'Direct'
}
};
Expand Down Expand Up @@ -264,7 +264,7 @@ export function generateCloseAndWithdrawRequest(
id: 88888888,
method: 'CloseAndWithdraw',
params: {
hubParticipantId: hub.participantId
}
playerParticipantId: player.participantId,
hub: hub,}
};
}
Loading