Skip to content

Commit 6b4e94d

Browse files
Release/v1.2.10 (#61)
* chore(dev-demo): use vite v6 and update @rollup/plugin-commonjs * feat(dev-demo): update dev-demo * chore: set minimatch version * chore: update package version * docs(tomo): update README.md * chore(demos): remove dependencies * docs: update README.md in root and adapters * feat(dev-demo): add multi-sign demo * feat(dev-demo): add ledger dependency and remove multiSign usage * chore: add github issue template * feat(dev-demo): disable dark mode --------- Co-authored-by: iweb3Nomad <166782285+iweb3Nomad@users.noreply.github.com>
1 parent 02a8b65 commit 6b4e94d

File tree

22 files changed

+618
-323
lines changed

22 files changed

+618
-323
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: true
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "\U0001F680 Support new Wallet"
2+
description: Request support to a new wallet
3+
labels: ['enhancement']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to fill out this support request! We're thrilled to have another wallet supporting TRON.
9+
- type: input
10+
id: wallet-name
11+
attributes:
12+
label: Describe the name of wallet
13+
placeholder: Wallet name
14+
validations:
15+
required: true
16+
- type: input
17+
id: website
18+
attributes:
19+
label: Wallet website
20+
description: Please input the official website of the wallet.
21+
placeholder: The url of website
22+
validations:
23+
required: true
24+
- type: checkboxes
25+
id: platforms
26+
attributes:
27+
label: Supported platforms
28+
description: Describe platforms supported by the wallet.
29+
options:
30+
- label: Android
31+
- label: IOS
32+
- label: Chrome Extension
33+
validations:
34+
required: true
35+
- type: dropdown
36+
id: listed
37+
attributes:
38+
label: "Is the wallet listed on TRON Wallets ?"
39+
description: Wallets listed on [TRON Wallets](https://tron.network/wallet) will receive better attention and attract more users.
40+
options:
41+
- Not yet
42+
- Listed
43+
default: 0
44+
- type: dropdown
45+
id: role
46+
attributes:
47+
label: "Are you developer of the wallet or a web3 user ?"
48+
description: If you are a developer, please [contact the TRON team](mailto:application@tron.network) for wallet listing and boost its visibility.
49+
options:
50+
- Developer
51+
- Web3 user
52+
default: 0

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ This repository contains wallet adapters and components for Tron DApps. With out
3737
| [Trust](https://trustwallet.com) | Android | Not Support |
3838
| | IOS | Not Support |
3939
| | Browser Extension | >= 1.0.0 |
40+
| [Tomo](https://tomo.inc/) | Android | 4.2.0 |
41+
| | IOS | 4.2.0 |
42+
| | Browser Extension | Not Support |
4043

4144
> **Note**: In case wallet developers intend to release breaking changes, you can [open an issue here](https://github.com/tronweb3/tronwallet-adapter/issues/new) to inform us, thus enabling us to update the new protocols accordingly.
4245
@@ -200,6 +203,7 @@ tronwallet-adapter
200203
| | ├─foxwallet # adapter for FoxWallet
201204
| | ├─bybit # adapter for Bybit Wallet
202205
| | ├─trust # adapter for Trust Wallet
206+
| | ├─tomowallet # adapter for Tomo Wallet
203207
| ├─react
204208
| | ├─react-hooks # react hooks to manage wallet state
205209
| | ├─react-ui # react ui components to select/connect wallets
@@ -236,6 +240,7 @@ You can use the `@tronweb3/tronwallet-adapters` package, or add the individual w
236240
| [`@tronweb3/tronwallet-adapter-foxwallet`](https://www.npmjs.com/package/@tronweb3/tronwallet-adapter-foxwallet) | Adapter for FoxWallet App(IOS and Android) |
237241
| [`@tronweb3/tronwallet-adapter-bybit`](https://www.npmjs.com/package/@tronweb3/tronwallet-adapter-bybit) | Adapter for Bybit Wallet App(IOS and Android) and Extension |
238242
| [`@tronweb3/tronwallet-adapter-trust`](https://www.npmjs.com/package/@tronweb3/tronwallet-adapter-trust) | Adapter for TrustWallet Extension |
243+
| [`@tronweb3/tronwallet-adapter-tomowallet`](https://www.npmjs.com/package/@tronweb3/tronwallet-adapter-tomowallet) | Adapter for Tomo Wallet App(IOS and Android) |
239244

240245
### React Components
241246

@@ -272,6 +277,7 @@ This package contains all wallet adapters for Tron including:
272277
- [Fox Wallet](https://foxwallet.com/)
273278
- [Bybit Wallet](https://www.bybit.com/web3)
274279
- [Trust](https://trustwallet.com)
280+
- [Tomo](https://tomo.inc/)
275281

276282
Code example:
277283

demos/dev-demo/package.json

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dev-demo",
33
"private": true,
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"type": "module",
66
"scripts": {
77
"dev": "vite --force",
@@ -21,16 +21,9 @@
2121
"@noble/secp256k1": "1.7.1",
2222
"@tronweb3/abstract-adapter-evm": "latest",
2323
"@tronweb3/tronwallet-abstract-adapter": "latest",
24-
"@tronweb3/tronwallet-adapter-bitkeep": "latest",
25-
"@tronweb3/tronwallet-adapter-imtoken": "latest",
26-
"@tronweb3/tronwallet-adapter-ledger": "latest",
27-
"@tronweb3/tronwallet-adapter-metamask": "latest",
28-
"@tronweb3/tronwallet-adapter-okxwallet": "latest",
29-
"@tronweb3/tronwallet-adapter-react-hooks": "latest",
30-
"@tronweb3/tronwallet-adapter-react-ui": "latest",
31-
"@tronweb3/tronwallet-adapter-tokenpocket": "latest",
32-
"@tronweb3/tronwallet-adapter-tronlink-evm": "latest",
33-
"@tronweb3/tronwallet-adapter-trust": "latest",
24+
"@tronweb3/tronwallet-adapter-ledger": "^1.1.11",
25+
"@tronweb3/tronwallet-adapter-react-hooks": "^1.1.10",
26+
"@tronweb3/tronwallet-adapter-react-ui": "^1.1.11",
3427
"@tronweb3/tronwallet-adapters": "latest",
3528
"events": "^3.3.0",
3629
"ganache": "^7.9.0",
@@ -48,7 +41,7 @@
4841
"@vitejs/plugin-react": "^4.2.1",
4942
"dotenv": "^16.3.1",
5043
"typescript": "^5.5.4",
51-
"vite": "latest",
44+
"vite": "^6.3.5",
5245
"vite-plugin-node-polyfills": "0.17.0"
5346
},
5447
"overrides": {

demos/dev-demo/src/TronLinkAdapterDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export function Detail(props: { children: ReactNode }) {
192192
return <div style={{ margin: 15 }}>{props.children}</div>;
193193
}
194194

195-
function MultiSignDemo(props: { address: string; adapter: Adapter }) {
195+
export function MultiSignDemo(props: { address: string; adapter: Adapter }) {
196196
const [address1, setAddress1] = useState('');
197197
const [open, setOpen] = useState(false);
198198

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import type { Adapter, Transaction } from "@tronweb3/tronwallet-abstract-adapter";
2+
import { useState } from "react";
3+
import { tronWeb } from "../tronweb";
4+
5+
const receiver = 'TMDKznuDWaZwfZHcM61FVFstyYNmK6Njk1';
6+
7+
// update permissionId with yourself permissionId
8+
const permissionId = 2;
9+
// update the first private key with your private key
10+
const privateKey1 = '';
11+
// update the second private key with your private key
12+
const privateKey2 = '';
13+
export function MultiSignUsage({ adapter }: {adapter: Adapter}) {
14+
const [ transaction, setTransaction] = useState<Transaction>();
15+
16+
async function createTransaction() {
17+
const transaction = await tronWeb.transactionBuilder.sendTrx(receiver, tronWeb.toSun(0.000001) as unknown as number, adapter.address!, { permissionId });
18+
setTransaction(transaction);
19+
console.log('Created transaction:', transaction);
20+
alert('success Created')
21+
}
22+
23+
async function signWithAddress1() {
24+
const signedTransaction = await adapter.multiSign(transaction, privateKey1, permissionId);
25+
setTransaction(signedTransaction);
26+
console.log('signedTransaction:', signedTransaction);
27+
alert('success signed')
28+
}
29+
30+
async function signWithAddress2() {
31+
const signedTransaction = await adapter.multiSign(transaction, privateKey2, permissionId);
32+
setTransaction(signedTransaction);
33+
console.log('signedTransaction:', signedTransaction);
34+
alert('success signed')
35+
}
36+
37+
async function broadcast() {
38+
const result = await tronWeb.trx.sendRawTransaction(transaction as any);
39+
console.log('broadcast result:', result);
40+
alert('success broadcast')
41+
}
42+
43+
44+
async function getAccounts() {
45+
const accounts = await tronWeb.trx.getAccount(adapter.address!);
46+
console.log('accounts:', accounts);
47+
}
48+
49+
async function getWeight() {
50+
const signWeight = await tronWeb.trx.getSignWeight(transaction as any);
51+
console.log('signWeight:', signWeight);
52+
}
53+
54+
return <div>
55+
<button onClick={createTransaction}>Create Transaction</button>
56+
<button onClick={signWithAddress1}>sign With Address1</button>
57+
<button onClick={signWithAddress2}>sign With Address2</button>
58+
<button onClick={broadcast}>Broadcast</button>
59+
60+
{/* <button onClick={getAccounts}>getAccount</button>
61+
<button onClick={getWeight}>getWeight</button> */}
62+
</div>
63+
}

demos/dev-demo/src/components/SignUsage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Grid, Input, Link, Snackbar, Stack, styled, Typography } from "@mui/material";
1+
import { Box, Input, Link, Snackbar, Stack, styled, Typography } from "@mui/material";
22
import { Button } from "./common";
33
import { useMemo, useState } from "react";
44
import SuccessIcon from "./SuccessIcon";
@@ -80,7 +80,7 @@ const InformAlertText = styled(Typography)({
8080
});
8181

8282
// Replace with another address. Don't transfer any assets to this address.
83-
const receiver = 'TM6nL4t3PVeFHcYgePusVX3dhk4zSCEd1s';
83+
const receiver = 'TMDKznuDWaZwfZHcM61FVFstyYNmK6Njk1';
8484

8585
export default function SignUsage() {
8686
const { connectionState, adapter } = useWallet();

demos/dev-demo/src/components/WalletProvider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface WalletContextType {
3838
disconnect?: () => Promise<void>;
3939
}
4040
const Context = createContext<WalletContextType>({
41-
selectedAdapterName: TomoWalletAdapterName,
41+
selectedAdapterName: TronLinkAdapterName,
4242
setSelectedAdapterName: () => {
4343
//
4444
},
@@ -70,7 +70,7 @@ export default function WalletProvider({ children }: PropsWithChildren) {
7070
];
7171
}, []);
7272
const walletName = decodeURIComponent(new URLSearchParams(location.search).get('wallet') || '');
73-
const [selectedAdapterName, _setSelectedAdapterName] = useState(walletName as AdapterName || TomoWalletAdapterName);
73+
const [selectedAdapterName, _setSelectedAdapterName] = useState(walletName as AdapterName || TronLinkAdapterName);
7474

7575
const setSelectedAdapterName = useCallback((selectedAdapterName: AdapterName) => {
7676
_setSelectedAdapterName(selectedAdapterName);

demos/dev-demo/src/theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { red } from '@mui/material/colors';
44
// Create a theme instance.
55
const theme = createTheme({
66
palette: {
7+
mode: 'light',
78
primary: {
89
main: '#556cd6',
910
},

demos/dev-demo/src/tronweb.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { TronWeb } from 'tronweb';
33

44
export const tronWeb = new TronWeb({
5-
// fullHost: 'https://api.nileex.io',
6-
fullHost: 'https://api.trongrid.io',
5+
fullHost: 'https://api.nileex.io',
6+
// fullHost: 'https://api.trongrid.io',
77
privateKey: '',
88
});

0 commit comments

Comments
 (0)