-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporarily copy separately built iframe files.
- Loading branch information
1 parent
391d8a5
commit d9d973d
Showing
24 changed files
with
12,938 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
*~ | ||
app/dist/ | ||
app/dist-trezor/ | ||
app/trezor-prebuild/build/ | ||
app/main.js | ||
app/main.js.map | ||
app/i18n/lib/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
*~ | ||
app/dist/ | ||
app/dist-trezor/ | ||
app/main.js | ||
app/main.js.map | ||
app/main.js.LICENSE.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,13 @@ import { | |
SIGNMESSAGE_SUCCESS | ||
} from "./ControlActions"; | ||
import { getAmountFromTxInputs, getTxFromInputs } from "./TransactionActions"; | ||
|
||
const session = require("trezor-connect").default; | ||
const { | ||
import { | ||
TRANSPORT_EVENT, | ||
UI, | ||
UI_EVENT, | ||
DEVICE_EVENT | ||
} = require("trezor-connect"); | ||
} from "@trezor/connect-web"; | ||
const session = require("@trezor/connect-web").default; | ||
const CHANGE = "device-changed"; | ||
const DISCONNECT = "device-disconnect"; | ||
const CONNECT = "device-connect"; | ||
|
@@ -40,32 +39,24 @@ const TRANSPORT_ERROR = "transport-error"; | |
const TRANSPORT_START = "transport-start"; | ||
const BOOTLOADER_MODE = "bootloader"; | ||
|
||
let setListeners = false; | ||
|
||
export const TRZ_WALLET_CLOSED = "TRZ_WALLET_CLOSED"; | ||
export const TRZ_TREZOR_ENABLED = "TRZ_TREZOR_ENABLED"; | ||
|
||
// enableTrezor attepts to start a connection with connect if none exist and | ||
// connect to a trezor device. | ||
export const enableTrezor = () => (dispatch, getState) => { | ||
dispatch({ type: TRZ_TREZOR_ENABLED }); | ||
|
||
if (!setListeners) { | ||
setDeviceListeners(dispatch, getState); | ||
setListeners = true; | ||
} | ||
connect()(dispatch, getState); | ||
}; | ||
|
||
export const initTransport = async (session, debug) => { | ||
await session | ||
.init({ | ||
connectSrc: "./", | ||
env: "web", | ||
transports: ["BridgeTransport"], | ||
lazyLoad: false, | ||
popup: false, | ||
transportReconnect: false, | ||
webusb: false, | ||
manifest: { | ||
email: "[email protected]", | ||
appUrl: "https://github.com/decred/decrediton" | ||
|
@@ -82,6 +73,8 @@ export const TRZ_CONNECT_FAILED = "TRZ_CONNECT_FAILED"; | |
export const TRZ_CONNECT_SUCCESS = "TRZ_CONNECT_SUCCESS"; | ||
|
||
export const connect = () => async (dispatch, getState) => { | ||
// connected refers to the transport being up and is connected to | ||
// TRZ_DEVICETRANSPORT_START and TRZ_DEVICETRANSPORT_LOST. | ||
const { | ||
trezor: { connected, connectAttempt } | ||
} = getState(); | ||
|
@@ -90,6 +83,9 @@ export const connect = () => async (dispatch, getState) => { | |
|
||
wallet.allowExternalRequest(EXTERNALREQUEST_TREZOR_BRIDGE); | ||
|
||
// If there was a previous connection, dispose will reset it. | ||
await session.dispose(); | ||
setDeviceListeners(dispatch, getState); | ||
const debug = getState().trezor.debug; | ||
await initTransport(session, debug).catch((error) => { | ||
dispatch({ error, type: TRZ_CONNECT_FAILED }); | ||
|
@@ -288,6 +284,18 @@ function setDeviceListeners(dispatch, getState) { | |
|
||
case UI.FIRMWARE_PROGRESS: { | ||
console.log("Trezor update progress: " + event.payload.progress + "%"); | ||
break; | ||
} | ||
|
||
case UI.SELECT_DEVICE: { | ||
if (event.payload.devices.length > 0) { | ||
session.uiResponse({ | ||
type: UI.RECEIVE_DEVICE, | ||
payload: event.payload.devices[0] | ||
}); | ||
} else { | ||
// no devices connected, waiting for connection | ||
} | ||
} | ||
} | ||
}); | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This is used to contact trezor-bridge on a separate iframe in the wallet. | ||
|
||
It is created by following the instructions at https://github.com/trezor/trezor-suite and is the package in packages/connect-iframe. All binaries have been removed with `$ find ./ -type f -iname "*.bin" -exec rm {} \;`. | ||
|
||
Current build is at commit 109db0a3f6fc6fc5cdb24098ee50480692c92dbf | ||
|
||
TODO: Build this with webpack. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[ | ||
{ | ||
"version": [2, 0, 27], | ||
"directory": "bridge/{version}/", | ||
"packages": [ | ||
{ | ||
"platform": ["deb64"], | ||
"name": "Linux 64-bit (deb)", | ||
"url": "trezor-bridge_{version}_amd64.deb" | ||
}, | ||
{ | ||
"platform": ["rpm64"], | ||
"name": "Linux 64-bit (rpm)", | ||
"url": "trezor-bridge-{version}-1.x86_64.rpm" | ||
}, | ||
{ | ||
"platform": ["deb32"], | ||
"name": "Linux 32-bit (deb)", | ||
"url": "trezor-bridge_{version}_i386.deb" | ||
}, | ||
{ | ||
"platform": ["rpm32"], | ||
"name": "Linux 32-bit (rpm)", | ||
"url": "trezor-bridge-{version}-1.i386.rpm" | ||
}, | ||
{ | ||
"platform": ["mac"], | ||
"name": "macOS", | ||
"url": "trezor-bridge-{version}.pkg", | ||
"signature": "trezor-bridge-{version}.pkg.asc" | ||
}, | ||
{ | ||
"platform": ["win32", "win64"], | ||
"name": "Windows", | ||
"url": "trezor-bridge-{version}-win32-install.exe", | ||
"signature": "trezor-bridge-{version}-win32-install.exe.asc" | ||
} | ||
], | ||
"changelog": "* Fix Certificate issue on Windows" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
[ | ||
{ | ||
"blockchain_link": { | ||
"type": "blockbook", | ||
"url": ["https://eth1.trezor.io", "https://eth2.trezor.io"] | ||
}, | ||
"chain": "eth", | ||
"chain_id": 1, | ||
"name": "Ethereum", | ||
"shortcut": "ETH", | ||
"slip44": 60, | ||
"support": { | ||
"connect": true, | ||
"suite": true, | ||
"trezor1": "1.6.2", | ||
"trezor2": "2.0.7" | ||
}, | ||
"url": "https://ethereum.org" | ||
}, | ||
{ | ||
"blockchain_link": { | ||
"type": "blockbook", | ||
"url": ["https://sepolia1.trezor.io"] | ||
}, | ||
"chain": "sep", | ||
"chain_id": 11155111, | ||
"name": "Sepolia", | ||
"rskip60": false, | ||
"shortcut": "tSEP", | ||
"slip44": 1, | ||
"support": { | ||
"connect": true, | ||
"suite": false, | ||
"trezor1": "1.11.2", | ||
"trezor2": "2.5.2" | ||
}, | ||
"url": "https://sepolia.otterscan.io" | ||
}, | ||
{ | ||
"blockchain_link": { | ||
"type": "blockbook", | ||
"url": ["https://goerli1.trezor.io", "https://goerli2.trezor.io"] | ||
}, | ||
"chain": "gor", | ||
"chain_id": 5, | ||
"name": "G\u00f6rli", | ||
"shortcut": "tGOR", | ||
"slip44": 1, | ||
"support": { | ||
"connect": true, | ||
"suite": false, | ||
"trezor1": "1.11.2", | ||
"trezor2": "2.5.2" | ||
}, | ||
"url": "https://goerli.net/#about" | ||
}, | ||
{ | ||
"blockchain_link": { | ||
"type": "blockbook", | ||
"url": ["https://etc1.trezor.io", "https://etc2.trezor.io"] | ||
}, | ||
"chain": "etc", | ||
"chain_id": 61, | ||
"name": "Ethereum Classic", | ||
"shortcut": "ETC", | ||
"slip44": 61, | ||
"support": { | ||
"connect": true, | ||
"suite": true, | ||
"trezor1": "1.6.2", | ||
"trezor2": "2.0.7" | ||
}, | ||
"url": "https://ethereumclassic.org" | ||
} | ||
] |
Oops, something went wrong.