Skip to content

Commit

Permalink
trezor: Use connect v9.
Browse files Browse the repository at this point in the history
Temporarily copy separately built iframe files.
  • Loading branch information
JoeGruffins committed Sep 28, 2023
1 parent 360ce75 commit 06989f5
Show file tree
Hide file tree
Showing 37 changed files with 12,956 additions and 249 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
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/
Expand Down
1 change: 0 additions & 1 deletion .gitignore
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
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/bin
/node_modules
/app/dist
/app/dist-trezor
/app/trezor-prebuild/build
/app/middleware/ln/*_pb.js
/app/middleware/ln/google/api/*_pb.js
/app/middleware/walletrpc/*_pb.js
Expand Down
20 changes: 15 additions & 5 deletions app/actions/TrezorActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import {
SIGNMESSAGE_SUCCESS
} from "./ControlActions";
import { getAmountFromTxInputs, getTxFromInputs } from "./TransactionActions";

const session = require("trezor-connect").default;
const session = require("@trezor/connect-web").default;
const {
TRANSPORT_EVENT,
UI,
UI_EVENT,
DEVICE_EVENT
} = require("trezor-connect");
} = require("@trezor/connect-web");
const CHANGE = "device-changed";
const DISCONNECT = "device-disconnect";
const CONNECT = "device-connect";
Expand Down Expand Up @@ -61,11 +60,10 @@ export const initTransport = async (session, debug) => {
await session
.init({
connectSrc: "./",
env: "web",
transports: ["BridgeTransport"],
lazyLoad: false,
popup: false,
transportReconnect: false,
webusb: false,
manifest: {
email: "joegruffins@gmail.com",
appUrl: "https://github.com/decred/decrediton"
Expand Down Expand Up @@ -288,6 +286,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
}
}
}
});
Expand Down
24 changes: 0 additions & 24 deletions app/trezor-iframe.development.html

This file was deleted.

7 changes: 7 additions & 0 deletions app/trezor-prebuild/README.md
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.

Current build is at commit 109db0a3f6fc6fc5cdb24098ee50480692c92dbf

TODO: Build this with webpack.
41 changes: 41 additions & 0 deletions app/trezor-prebuild/build/data/bridge/releases.json
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"
}
]
75 changes: 75 additions & 0 deletions app/trezor-prebuild/build/data/coins-eth.json
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"
}
]

0 comments on commit 06989f5

Please sign in to comment.