@rango-dev/provider-tron-link 0.0.0-experimental-936229e8-20251208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +209 -0
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/provider-tron-link.build.json +1 -0
- package/dist/signer.d.ts +3 -0
- package/dist/signer.d.ts.map +1 -0
- package/package.json +31 -0
- package/readme.md +1 -0
- package/src/helpers.ts +5 -0
- package/src/index.ts +83 -0
- package/src/signer.ts +12 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# [0.55.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.54.1...provider-tron-link@0.55.0) (2025-12-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## [0.54.1](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.54.0...provider-tron-link@0.54.1) (2025-11-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [0.52.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.51.0...provider-tron-link@0.52.0) (2025-10-29)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [0.51.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.50.0...provider-tron-link@0.51.0) (2025-09-29)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.50.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.49.0...provider-tron-link@0.50.0) (2025-09-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# [0.49.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.48.0...provider-tron-link@0.49.0) (2025-08-19)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [0.48.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.47.0...provider-tron-link@0.48.0) (2025-08-05)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# [0.47.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.46.0...provider-tron-link@0.47.0) (2025-07-22)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Reverts
|
|
33
|
+
|
|
34
|
+
* Revert "chore(release): publish" ([064ce15](https://github.com/rango-exchange/rango-client/commit/064ce157a2f819856f647f83aeb1c0410542e8d7))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [0.45.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.44.1...provider-tron-link@0.45.0) (2025-06-09)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [0.44.1](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.44.0...provider-tron-link@0.44.1) (2025-05-04)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# [0.44.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.43.0...provider-tron-link@0.44.0) (2025-04-30)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* rename pbt to ptb for sui ([3d6d89f](https://github.com/rango-exchange/rango-client/commit/3d6d89f2265766607a15d61e0df92643fb33072b))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* update sui to consider recent api changes ([d764b25](https://github.com/rango-exchange/rango-client/commit/d764b2501df9bb295f63cdbc0b05acd4a3abb4b9))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# [0.43.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.42.0...provider-tron-link@0.43.0) (2025-03-11)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# [0.42.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.41.0...provider-tron-link@0.42.0) (2025-02-23)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# [0.41.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.40.0...provider-tron-link@0.41.0) (2024-12-30)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# [0.40.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.39.0...provider-tron-link@0.40.0) (2024-11-27)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# [0.39.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.38.0...provider-tron-link@0.39.0) (2024-11-12)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# [0.38.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.37.0...provider-tron-link@0.38.0) (2024-10-12)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Bug Fixes
|
|
84
|
+
|
|
85
|
+
* bump sdk and fix type issues ([d442208](https://github.com/rango-exchange/rango-client/commit/d4422083bf5dd27d5f509ce1db7f9560d05428c8))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Performance Improvements
|
|
89
|
+
|
|
90
|
+
* lazy load signer packages ([7b88f18](https://github.com/rango-exchange/rango-client/commit/7b88f1834f7b29b4b81ab6c81a07bb88e8ccf55c))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# [0.37.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.36.0...provider-tron-link@0.37.0) (2024-09-10)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# [0.36.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.35.1...provider-tron-link@0.36.0) (2024-08-11)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## [0.35.1](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.35.0...provider-tron-link@0.35.1) (2024-07-14)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# [0.35.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.33.0...provider-tron-link@0.35.0) (2024-07-09)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# [0.34.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.33.0...provider-tron-link@0.34.0) (2024-06-01)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# [0.33.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.32.0...provider-tron-link@0.33.0) (2024-05-14)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# [0.32.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.31.0...provider-tron-link@0.32.0) (2024-04-24)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# [0.31.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.30.0...provider-tron-link@0.31.0) (2024-04-23)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# [0.30.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.29.0...provider-tron-link@0.30.0) (2024-04-09)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Bug Fixes
|
|
130
|
+
|
|
131
|
+
* fix tron-link wallet connecting error ([ad61471](https://github.com/rango-exchange/rango-client/commit/ad614712d4a22a86164d6decf820fef19ff45f3c))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# [0.29.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.28.0...provider-tron-link@0.29.0) (2024-03-12)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# [0.28.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.27.0...provider-tron-link@0.28.0) (2024-02-20)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# [0.27.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.26.0...provider-tron-link@0.27.0) (2024-02-07)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# [0.26.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.25.0...provider-tron-link@0.26.0) (2024-01-22)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# [0.25.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.23.0...provider-tron-link@0.25.0) (2023-12-24)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Bug Fixes
|
|
155
|
+
|
|
156
|
+
* fix HMR for widget and playground ([8524820](https://github.com/rango-exchange/rango-client/commit/8524820f10cf0b8921f3db0c4f620ff98daa4103))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
# [0.14.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.13.0...provider-tron-link@0.14.0) (2023-08-03)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# [0.13.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.12.0...provider-tron-link@0.13.0) (2023-08-01)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# [0.9.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.8.0...provider-tron-link@0.9.0) (2023-07-31)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# [0.7.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.6.0...provider-tron-link@0.7.0) (2023-07-11)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# [0.6.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.5.0...provider-tron-link@0.6.0) (2023-07-11)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
### Reverts
|
|
180
|
+
|
|
181
|
+
* Revert "support for rango-types cjs format" ([ed4e050](https://github.com/rango-exchange/rango-client/commit/ed4e050bfc0dcde7aeffa6b0d73b02080a5721eb))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
# [0.5.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.4.0...provider-tron-link@0.5.0) (2023-05-31)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
# [0.4.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.3.0...provider-tron-link@0.4.0) (2023-05-31)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
# [0.3.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.2.0...provider-tron-link@0.3.0) (2023-05-30)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
# [0.2.0](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.1.15...provider-tron-link@0.2.0) (2023-05-30)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
## [0.1.14](https://github.com/rango-exchange/rango-client/compare/provider-tron-link@0.1.13...provider-tron-link@0.1.14) (2023-05-15)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
### Bug Fixes
|
|
205
|
+
|
|
206
|
+
* update rango-types and fix notification bugs ([993f185](https://github.com/rango-exchange/rango-client/commit/993f185e0b8c5e5e15a2c65ba2d85d1f9c8daa90))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,QAIvB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CanSwitchNetwork, Connect, Subscribe, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
|
+
import type { BlockchainMeta, SignerFactory } from 'rango-types';
|
|
3
|
+
import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
4
|
+
import { tronLink as tronLink_instance } from './helpers.js';
|
|
5
|
+
export declare const config: {
|
|
6
|
+
type: WalletTypes;
|
|
7
|
+
defaultNetwork: Networks;
|
|
8
|
+
};
|
|
9
|
+
export declare const getInstance: typeof tronLink_instance;
|
|
10
|
+
export declare const connect: Connect;
|
|
11
|
+
export declare const subscribe: Subscribe;
|
|
12
|
+
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
13
|
+
export declare const getSigners: (provider: any) => Promise<SignerFactory>;
|
|
14
|
+
export declare const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAS7D,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF,eAAO,MAAM,WAAW,0BAAoB,CAAC;AAE7C,eAAO,MAAM,OAAO,EAAE,OAerB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAevB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAA8B,CAAC;AAEhE,eAAO,MAAM,UAAU,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC,aAAa,CAAU,CAAC;AAE5E,eAAO,MAAM,aAAa,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,UAiBjE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var c=Object.defineProperty;var o=(e,t)=>c(e,"name",{value:t,configurable:!0});import{Networks as i,WalletTypes as g}from"@rango-dev/wallets-shared";import{tronBlockchain as d}from"rango-types";function a(){let{tronLink:e}=window;return e||null}o(a,"tronLink");import{DefaultTronSigner as l}from"@rango-dev/signer-tron";import{DefaultSignerFactory as m,TransactionType as p}from"rango-types";async function s(e){let t=new m;return t.registerSigner(p.TRON,new l(e)),t}o(s,"getSigners");var f=g.TRON_LINK,E={type:f,defaultNetwork:i.TRON},N=a,O=o(async({instance:e})=>{let t;if(e&&!e.ready){if(t=await e.request({method:"tron_requestAccounts"}),!t)throw new Error("Please unlock your TronLink extension first.");if(t?.code!==200&&t.message)throw new Error(t.message)}let r=e.tronWeb.defaultAddress.base58;return{accounts:r?[r]:[],chainId:i.TRON}},"connect"),F=o(({updateAccounts:e,disconnect:t})=>{window.addEventListener("message",n=>{if(n.data.isTronLink&&n.data.message&&n.data.message.action=="accountsChanged"){let r=n?.data?.message?.data?.address;r?e([r]):t()}})},"subscribe"),I=o(()=>!1,"canSwitchNetworkTo"),R=s,W=o(e=>{let t=d(e);return{name:"TronLink",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/tronlink/icon.svg",installLink:{CHROME:"https://chrome.google.com/webstore/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec",BRAVE:"https://chrome.google.com/webstore/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec",DEFAULT:"https://www.tronlink.org"},color:"#96e7ed",supportedChains:t}},"getWalletInfo");export{I as canSwitchNetworkTo,E as config,O as connect,N as getInstance,R as getSigners,W as getWalletInfo,F as subscribe};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../src/helpers.ts", "../src/signer.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n CanSwitchNetwork,\n Connect,\n Subscribe,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\n\nimport { Networks, WalletTypes } from '@rango-dev/wallets-shared';\nimport { tronBlockchain } from 'rango-types';\n\nimport { tronLink as tronLink_instance } from './helpers.js';\nimport signer from './signer.js';\n\n/*\n * https://docs.tronlink.org/dapp/start-developing\n * https://developers.tron.network/docs/tronlink-events\n */\nconst WALLET = WalletTypes.TRON_LINK;\n\nexport const config = {\n type: WALLET,\n defaultNetwork: Networks.TRON,\n};\n\nexport const getInstance = tronLink_instance;\n\nexport const connect: Connect = async ({ instance }) => {\n let r = undefined;\n const SUCCESS_CODE = 200;\n if (!!instance && !instance.ready) {\n r = await instance.request({ method: 'tron_requestAccounts' });\n if (!r) {\n throw new Error('Please unlock your TronLink extension first.');\n }\n if (r?.code !== SUCCESS_CODE && !!r.message) {\n throw new Error(r.message);\n }\n }\n const address = instance.tronWeb.defaultAddress.base58;\n // TODO check connected network\n return { accounts: address ? [address] : [], chainId: Networks.TRON };\n};\n\nexport const subscribe: Subscribe = ({ updateAccounts, disconnect }) => {\n window.addEventListener('message', (e) => {\n if (\n e.data.isTronLink &&\n e.data.message &&\n e.data.message.action == 'accountsChanged'\n ) {\n const account = e?.data?.message?.data?.address;\n if (account) {\n updateAccounts([account]);\n } else {\n disconnect();\n }\n }\n });\n};\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = () => false;\n\nexport const getSigners: (provider: any) => Promise<SignerFactory> = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const tron = tronBlockchain(allBlockChains);\n return {\n name: 'TronLink',\n img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/tronlink/icon.svg',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec',\n BRAVE:\n 'https://chrome.google.com/webstore/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec',\n DEFAULT: 'https://www.tronlink.org',\n },\n color: '#96e7ed',\n supportedChains: tron,\n };\n};\n", "export function tronLink() {\n const { tronLink } = window;\n if (!!tronLink) return tronLink;\n return null;\n}\n", "import type { SignerFactory } from 'rango-types';\n\nimport { DefaultTronSigner } from '@rango-dev/signer-tron';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default async function getSigners(\n provider: any\n): Promise<SignerFactory> {\n const signers = new DefaultSignerFactory();\n signers.registerSigner(TxType.TRON, new DefaultTronSigner(provider));\n return signers;\n}\n"],
|
|
5
|
+
"mappings": "+EAQA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,4BACtC,OAAS,kBAAAC,MAAsB,cCTxB,SAASC,GAAW,CACzB,GAAM,CAAE,SAAAA,CAAS,EAAI,OACrB,OAAMA,GACC,IACT,CAJgBC,EAAAD,EAAA,YCEhB,OAAS,qBAAAE,MAAyB,yBAClC,OAAS,wBAAAC,EAAsB,mBAAmBC,MAAc,cAEhE,eAAOC,EACLC,EACwB,CACxB,IAAMC,EAAU,IAAIC,EACpB,OAAAD,EAAQ,eAAeE,EAAO,KAAM,IAAIC,EAAkBJ,CAAQ,CAAC,EAC5DC,CACT,CAN8BI,EAAAN,EAAA,cFa9B,IAAMO,EAASC,EAAY,UAEdC,EAAS,CACpB,KAAMF,EACN,eAAgBG,EAAS,IAC3B,EAEaC,EAAcC,EAEdC,EAAmBC,EAAA,MAAO,CAAE,SAAAC,CAAS,IAAM,CACtD,IAAIC,EAEJ,GAAMD,GAAY,CAACA,EAAS,MAAO,CAEjC,GADAC,EAAI,MAAMD,EAAS,QAAQ,CAAE,OAAQ,sBAAuB,CAAC,EACzD,CAACC,EACH,MAAM,IAAI,MAAM,8CAA8C,EAEhE,GAAIA,GAAG,OAAS,KAAkBA,EAAE,QAClC,MAAM,IAAI,MAAMA,EAAE,OAAO,CAE7B,CACA,IAAMC,EAAUF,EAAS,QAAQ,eAAe,OAEhD,MAAO,CAAE,SAAUE,EAAU,CAACA,CAAO,EAAI,CAAC,EAAG,QAASP,EAAS,IAAK,CACtE,EAfgC,WAiBnBQ,EAAuBJ,EAAA,CAAC,CAAE,eAAAK,EAAgB,WAAAC,CAAW,IAAM,CACtE,OAAO,iBAAiB,UAAYC,GAAM,CACxC,GACEA,EAAE,KAAK,YACPA,EAAE,KAAK,SACPA,EAAE,KAAK,QAAQ,QAAU,kBACzB,CACA,IAAMC,EAAUD,GAAG,MAAM,SAAS,MAAM,QACpCC,EACFH,EAAe,CAACG,CAAO,CAAC,EAExBF,EAAW,CAEf,CACF,CAAC,CACH,EAfoC,aAiBvBG,EAAuCT,EAAA,IAAM,GAAN,sBAEvCU,EAAwDA,EAExDC,EAAkEX,EAC7EY,GACG,CACH,IAAMC,EAAOC,EAAeF,CAAc,EAC1C,MAAO,CACL,KAAM,WACN,IAAK,yFACL,YAAa,CACX,OACE,sFACF,MACE,sFACF,QAAS,0BACX,EACA,MAAO,UACP,gBAAiBC,CACnB,CACF,EAjB+E",
|
|
6
|
+
"names": ["Networks", "WalletTypes", "tronBlockchain", "tronLink", "__name", "DefaultTronSigner", "DefaultSignerFactory", "TxType", "getSigners", "provider", "signers", "DefaultSignerFactory", "TxType", "DefaultTronSigner", "__name", "WALLET", "WalletTypes", "config", "Networks", "getInstance", "tronLink", "connect", "__name", "instance", "r", "address", "subscribe", "updateAccounts", "disconnect", "e", "account", "canSwitchNetworkTo", "getSigners", "getWalletInfo", "allBlockChains", "tron", "tronBlockchain"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/helpers.ts":{"bytes":112,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":415,"imports":[{"path":"@rango-dev/signer-tron","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":2412,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/signer.ts","kind":"import-statement","original":"./signer.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4980},"dist/index.js":{"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/signer-tron","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"exports":["canSwitchNetworkTo","config","connect","getInstance","getSigners","getWalletInfo","subscribe"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1170},"src/helpers.ts":{"bytesInOutput":67},"src/signer.ts":{"bytesInOutput":224}},"bytes":1699}}}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAA8B,UAAU,CACtC,QAAQ,EAAE,GAAG,GACZ,OAAO,CAAC,aAAa,CAAC,CAIxB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rango-dev/provider-tron-link",
|
|
3
|
+
"version": "0.0.0-experimental-936229e8-20251208",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"source": "./src/index.ts",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"typings": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"src"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "node ../../scripts/build/command.mjs --path wallets/provider-tron-link",
|
|
18
|
+
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
|
|
19
|
+
"clean": "rimraf dist",
|
|
20
|
+
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
|
|
21
|
+
"lint": "eslint \"**/*.{ts,tsx}\""
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@rango-dev/signer-tron": "^0.39.0",
|
|
25
|
+
"@rango-dev/wallets-shared": "^0.0.0-experimental-936229e8-20251208",
|
|
26
|
+
"rango-types": "^0.1.89"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @rango-dev/provider-tron-link
|
package/src/helpers.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CanSwitchNetwork,
|
|
3
|
+
Connect,
|
|
4
|
+
Subscribe,
|
|
5
|
+
WalletInfo,
|
|
6
|
+
} from '@rango-dev/wallets-shared';
|
|
7
|
+
import type { BlockchainMeta, SignerFactory } from 'rango-types';
|
|
8
|
+
|
|
9
|
+
import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
10
|
+
import { tronBlockchain } from 'rango-types';
|
|
11
|
+
|
|
12
|
+
import { tronLink as tronLink_instance } from './helpers.js';
|
|
13
|
+
import signer from './signer.js';
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* https://docs.tronlink.org/dapp/start-developing
|
|
17
|
+
* https://developers.tron.network/docs/tronlink-events
|
|
18
|
+
*/
|
|
19
|
+
const WALLET = WalletTypes.TRON_LINK;
|
|
20
|
+
|
|
21
|
+
export const config = {
|
|
22
|
+
type: WALLET,
|
|
23
|
+
defaultNetwork: Networks.TRON,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const getInstance = tronLink_instance;
|
|
27
|
+
|
|
28
|
+
export const connect: Connect = async ({ instance }) => {
|
|
29
|
+
let r = undefined;
|
|
30
|
+
const SUCCESS_CODE = 200;
|
|
31
|
+
if (!!instance && !instance.ready) {
|
|
32
|
+
r = await instance.request({ method: 'tron_requestAccounts' });
|
|
33
|
+
if (!r) {
|
|
34
|
+
throw new Error('Please unlock your TronLink extension first.');
|
|
35
|
+
}
|
|
36
|
+
if (r?.code !== SUCCESS_CODE && !!r.message) {
|
|
37
|
+
throw new Error(r.message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const address = instance.tronWeb.defaultAddress.base58;
|
|
41
|
+
// TODO check connected network
|
|
42
|
+
return { accounts: address ? [address] : [], chainId: Networks.TRON };
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const subscribe: Subscribe = ({ updateAccounts, disconnect }) => {
|
|
46
|
+
window.addEventListener('message', (e) => {
|
|
47
|
+
if (
|
|
48
|
+
e.data.isTronLink &&
|
|
49
|
+
e.data.message &&
|
|
50
|
+
e.data.message.action == 'accountsChanged'
|
|
51
|
+
) {
|
|
52
|
+
const account = e?.data?.message?.data?.address;
|
|
53
|
+
if (account) {
|
|
54
|
+
updateAccounts([account]);
|
|
55
|
+
} else {
|
|
56
|
+
disconnect();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const canSwitchNetworkTo: CanSwitchNetwork = () => false;
|
|
63
|
+
|
|
64
|
+
export const getSigners: (provider: any) => Promise<SignerFactory> = signer;
|
|
65
|
+
|
|
66
|
+
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
|
|
67
|
+
allBlockChains
|
|
68
|
+
) => {
|
|
69
|
+
const tron = tronBlockchain(allBlockChains);
|
|
70
|
+
return {
|
|
71
|
+
name: 'TronLink',
|
|
72
|
+
img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/tronlink/icon.svg',
|
|
73
|
+
installLink: {
|
|
74
|
+
CHROME:
|
|
75
|
+
'https://chrome.google.com/webstore/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec',
|
|
76
|
+
BRAVE:
|
|
77
|
+
'https://chrome.google.com/webstore/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec',
|
|
78
|
+
DEFAULT: 'https://www.tronlink.org',
|
|
79
|
+
},
|
|
80
|
+
color: '#96e7ed',
|
|
81
|
+
supportedChains: tron,
|
|
82
|
+
};
|
|
83
|
+
};
|
package/src/signer.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SignerFactory } from 'rango-types';
|
|
2
|
+
|
|
3
|
+
import { DefaultTronSigner } from '@rango-dev/signer-tron';
|
|
4
|
+
import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
|
|
5
|
+
|
|
6
|
+
export default async function getSigners(
|
|
7
|
+
provider: any
|
|
8
|
+
): Promise<SignerFactory> {
|
|
9
|
+
const signers = new DefaultSignerFactory();
|
|
10
|
+
signers.registerSigner(TxType.TRON, new DefaultTronSigner(provider));
|
|
11
|
+
return signers;
|
|
12
|
+
}
|