@rango-dev/provider-tron-link 0.1.11-next.69 → 0.1.11-next.70
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/dist/index.d.ts +3 -2
- package/dist/provider-tron-link.cjs.development.js +6 -6
- package/dist/provider-tron-link.cjs.development.js.map +1 -1
- package/dist/provider-tron-link.cjs.production.min.js +1 -1
- package/dist/provider-tron-link.cjs.production.min.js.map +1 -1
- package/dist/provider-tron-link.esm.js +6 -6
- package/dist/provider-tron-link.esm.js.map +1 -1
- package/dist/signer.d.ts +2 -2
- package/package.json +5 -6
- package/src/index.ts +2 -4
- package/src/signer.ts +6 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Subscribe } from '@rango-dev/wallets-shared';
|
|
2
|
-
import { Network, WalletType, CanSwitchNetwork, Connect,
|
|
2
|
+
import { Network, WalletType, CanSwitchNetwork, Connect, WalletInfo } from '@rango-dev/wallets-shared';
|
|
3
3
|
import { tronLink as tronLink_instance } from './helpers';
|
|
4
|
+
import { SignerFactory, BlockchainMeta } from 'rango-types';
|
|
4
5
|
export declare const config: {
|
|
5
6
|
type: WalletType;
|
|
6
7
|
defaultNetwork: Network;
|
|
@@ -9,5 +10,5 @@ export declare const getInstance: typeof tronLink_instance;
|
|
|
9
10
|
export declare const connect: Connect;
|
|
10
11
|
export declare const subscribe: Subscribe;
|
|
11
12
|
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
12
|
-
export declare const getSigners: (provider: any) =>
|
|
13
|
+
export declare const getSigners: (provider: any) => SignerFactory;
|
|
13
14
|
export declare const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var walletsShared = require('@rango-dev/wallets-shared');
|
|
6
|
+
var signerTron = require('@rango-dev/signer-tron');
|
|
7
|
+
var rangoTypes = require('rango-types');
|
|
6
8
|
|
|
7
9
|
function _regeneratorRuntime() {
|
|
8
10
|
_regeneratorRuntime = function () {
|
|
@@ -344,11 +346,9 @@ function tronLink() {
|
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
function getSigners(provider) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
supportTron: true
|
|
351
|
-
});
|
|
349
|
+
var signers = new rangoTypes.SignerFactory();
|
|
350
|
+
signers.registerSigner(rangoTypes.TransactionType.TRON, new signerTron.DefaultTronSigner(provider));
|
|
351
|
+
return signers;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
// https://docs.tronlink.org/dapp/start-developing
|
|
@@ -436,7 +436,7 @@ var canSwitchNetworkTo = function canSwitchNetworkTo() {
|
|
|
436
436
|
};
|
|
437
437
|
var getSigners$1 = getSigners;
|
|
438
438
|
var getWalletInfo = function getWalletInfo(allBlockChains) {
|
|
439
|
-
var tron =
|
|
439
|
+
var tron = rangoTypes.tronBlockchain(allBlockChains);
|
|
440
440
|
return {
|
|
441
441
|
name: 'TronLink',
|
|
442
442
|
img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/tronlink.png',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-tron-link.cjs.development.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function tronLink() {\n const { tronLink } = window;\n if (!!tronLink) return tronLink;\n return null;\n}\n","import {
|
|
1
|
+
{"version":3,"file":"provider-tron-link.cjs.development.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function tronLink() {\n const { tronLink } = window;\n if (!!tronLink) return tronLink;\n return null;\n}\n","import { DefaultTronSigner } from '@rango-dev/signer-tron';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const signers = new SignerFactory();\n signers.registerSigner(TxType.TRON, new DefaultTronSigner(provider));\n return signers;\n}\n","import { Subscribe } from '@rango-dev/wallets-shared';\nimport {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { tronLink as tronLink_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, BlockchainMeta, tronBlockchain } from 'rango-types';\n\n// https://docs.tronlink.org/dapp/start-developing\n// https://developers.tron.network/docs/tronlink-events\nconst WALLET = WalletType.TRON_LINK;\n\nexport const config = {\n type: WALLET,\n defaultNetwork: Network.TRON,\n};\n\nexport const getInstance = tronLink_instance;\n\nexport const connect: Connect = async ({ instance }) => {\n let r = undefined;\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 === 200) {\n } else if (!!r?.code && !!r.message) {\n throw new Error(r.message);\n }\n }\n const address = instance.tronWeb.address.fromHex(\n (await instance.tronWeb.trx.getAccount()).address.toString()\n );\n // TODO check connected network\n return { accounts: !!address ? [address] : [], chainId: Network.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) => 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/rango-types/main/assets/icons/wallets/tronlink.png',\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"],"names":["tronLink","_window","window","getSigners","provider","signers","SignerFactory","registerSigner","TxType","TRON","DefaultTronSigner","WALLET","WalletType","TRON_LINK","config","type","defaultNetwork","Network","getInstance","tronLink_instance","connect","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","instance","r","_r","address","wrap","_callee$","_context","prev","next","undefined","ready","request","method","sent","Error","code","message","t0","tronWeb","trx","getAccount","t1","toString","fromHex","call","abrupt","accounts","chainId","stop","_x","apply","arguments","subscribe","_ref3","updateAccounts","disconnect","addEventListener","e","data","isTronLink","action","_e$data","_e$data$message","_e$data$message$data","account","canSwitchNetworkTo","signer","getWalletInfo","allBlockChains","tron","tronBlockchain","name","img","installLink","CHROME","BRAVE","DEFAULT","color","supportedChains"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAgBA,QAAQA;EACtB,IAAAC,OAAA,GAAqBC,MAAM;IAAnBF,QAAQ,GAAAC,OAAA,CAARD,QAAQ;EAChB,IAAI,CAAC,CAACA,QAAQ,EAAE,OAAOA,QAAQ;EAC/B,OAAO,IAAI;AACb;;SCDwBG,UAAUA,CAACC,QAAa;EAC9C,IAAMC,OAAO,GAAG,IAAIC,w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,GAADJ,CAAC,CAAEC,IAAI,sBAAAI,eAAA,GAAPD,OAAA,CAASzB,OAAO,sBAAA2B,oBAAA,GAAhBD,eAAA,CAAkBJ,IAAI,qBAAtBK,oBAAA,CAAwBxC,OAAO;MAC/C,IAAI,CAAC,CAACyC,OAAO,EAAE;QACbV,cAAc,CAAC,CAACU,OAAO,CAAC,CAAC;OAC1B,MAAM;QACLT,UAAU,EAAE;;;GAGjB,CAAC;AACJ,CAAC;AAED,IAAaU,kBAAkB,GAAqB,SAAvCA,kBAAkBA;EAAA,OAA2B,KAAK;AAAA;AAE/D,IAAarE,YAAU,GAAqCsE;AAE5D,IAAaC,aAAa,GAAqD,SAAlEA,aAAaA,CACxBC,cAAc;EAEd,IAAMC,IAAI,GAAGC,yBAAc,CAACF,cAAc,CAAC;EAC3C,OAAO;IACLG,IAAI,EAAE,UAAU;IAChBC,GAAG,EAAE,qGAAqG;IAC1GC,WAAW,EAAE;MACXC,MAAM,EACJ,qFAAqF;MACvFC,KAAK,EACH,qFAAqF;MACvFC,OAAO,EAAE;KACV;IACDC,KAAK,EAAE,SAAS;IAChBC,eAAe,EAAET;GAClB;AACH,CAAC;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@rango-dev/wallets-shared");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@rango-dev/wallets-shared"),e=require("@rango-dev/signer-tron"),r=require("rango-types");function n(){n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new _(n||[]);return o(i,"_invoke",{value:L(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function d(){}function v(){}var g={};s(g,a,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(j([])));m&&m!==e&&r.call(m,a)&&(g=m);var w=v.prototype=p.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;o(this,"_invoke",{value:function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}})}function L(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=k(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:T}}function T(){return{value:void 0,done:!0}}return d.prototype=v,o(w,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:d,configurable:!0}),d.displayName=s(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(b.prototype),s(b.prototype,c,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),s(w,u,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=j,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}var a={type:t.WalletType.TRON_LINK,defaultNetwork:t.Network.TRON},c=function(){var e=i(n().mark((function e(r){var o,i,a,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=void 0,!(o=r.instance)||o.ready){e.next=13;break}return e.next=5,o.request({method:"tron_requestAccounts"});case 5:if(i=e.sent){e.next=8;break}throw new Error("Please unlock your TronLink extension first.");case 8:if(200!==i.code){e.next=11;break}e.next=13;break;case 11:if(null==(a=i)||!a.code||!i.message){e.next=13;break}throw new Error(i.message);case 13:return e.t0=o.tronWeb.address,e.next=16,o.tronWeb.trx.getAccount();case 16:return e.t1=e.sent.address.toString(),c=e.t0.fromHex.call(e.t0,e.t1),e.abrupt("return",{accounts:c?[c]:[],chainId:t.Network.TRON});case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();exports.canSwitchNetworkTo=function(){return!1},exports.config=a,exports.connect=c,exports.getInstance=function(){return window.tronLink||null},exports.getSigners=function(t){var n=new r.SignerFactory;return n.registerSigner(r.TransactionType.TRON,new e.DefaultTronSigner(t)),n},exports.getWalletInfo=function(t){return{name:"TronLink",img:"https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/tronlink.png",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:r.tronBlockchain(t)}},exports.subscribe=function(t){var e=t.updateAccounts,r=t.disconnect;window.addEventListener("message",(function(t){if(t.data.isTronLink&&t.data.message&&"accountsChanged"==t.data.message.action){var n,o,i,a=null==t||null==(n=t.data)||null==(o=n.message)||null==(i=o.data)?void 0:i.address;a?e([a]):r()}}))};
|
|
2
2
|
//# sourceMappingURL=provider-tron-link.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-tron-link.cjs.production.min.js","sources":["../src/index.ts","../src/helpers.ts","../src/signer.ts"],"sourcesContent":["import { Subscribe } from '@rango-dev/wallets-shared';\nimport {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n
|
|
1
|
+
{"version":3,"file":"provider-tron-link.cjs.production.min.js","sources":["../src/index.ts","../src/helpers.ts","../src/signer.ts"],"sourcesContent":["import { Subscribe } from '@rango-dev/wallets-shared';\nimport {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { tronLink as tronLink_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, BlockchainMeta, tronBlockchain } from 'rango-types';\n\n// https://docs.tronlink.org/dapp/start-developing\n// https://developers.tron.network/docs/tronlink-events\nconst WALLET = WalletType.TRON_LINK;\n\nexport const config = {\n type: WALLET,\n defaultNetwork: Network.TRON,\n};\n\nexport const getInstance = tronLink_instance;\n\nexport const connect: Connect = async ({ instance }) => {\n let r = undefined;\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 === 200) {\n } else if (!!r?.code && !!r.message) {\n throw new Error(r.message);\n }\n }\n const address = instance.tronWeb.address.fromHex(\n (await instance.tronWeb.trx.getAccount()).address.toString()\n );\n // TODO check connected network\n return { accounts: !!address ? [address] : [], chainId: Network.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) => 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/rango-types/main/assets/icons/wallets/tronlink.png',\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 { DefaultTronSigner } from '@rango-dev/signer-tron';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const signers = new SignerFactory();\n signers.registerSigner(TxType.TRON, new DefaultTronSigner(provider));\n return signers;\n}\n"],"names":["config","type","WalletType","TRON_LINK","defaultNetwork","Network","TRON","connect","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","instance","r","_r","address","wrap","_context","prev","next","undefined","ready","request","method","sent","Error","code","message","t0","tronWeb","trx","getAccount","t1","toString","fromHex","call","abrupt","accounts","chainId","stop","_x","apply","arguments","window","tronLink","provider","signers","SignerFactory","registerSigner","TxType","DefaultTronSigner","allBlockChains","name","img","installLink","CHROME","BRAVE","DEFAULT","color","supportedChains","tronBlockchain","_ref3","updateAccounts","disconnect","addEventListener","e","data","isTronLink","action","_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GA,MAAO,CACLC,KAAM,WACNC,IAAK,sGACLC,YAAa,CACXC,OACE,sFACFC,MACE,sFACFC,QAAS,4BAEXC,MAAO,UACPC,gBAZWC,iBAAeT,uBAxBM,SAAdU,OAAiBC,EAAcD,EAAdC,eAAgBC,EAAUF,EAAVE,WACrDpB,OAAOqB,iBAAiB,WAAW,SAACC,GAClC,GACEA,EAAEC,KAAKC,YACPF,EAAEC,KAAKvC,SACkB,mBAAzBsC,EAAEC,KAAKvC,QAAQyC,OACf,CAAA,IAAAC,EAAAC,EAAAC,EACMC,QAAUP,UAACI,EAADJ,EAAGC,cAAII,EAAPD,EAAS1C,iBAAO4C,EAAhBD,EAAkBJ,aAAlBK,EAAwBxD,QAClCyD,EACJV,EAAe,CAACU,IAEhBT"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { DefaultTronSigner } from '@rango-dev/signer-tron';
|
|
3
|
+
import { SignerFactory, TransactionType, tronBlockchain } from 'rango-types';
|
|
2
4
|
|
|
3
5
|
function _regeneratorRuntime() {
|
|
4
6
|
_regeneratorRuntime = function () {
|
|
@@ -340,11 +342,9 @@ function tronLink() {
|
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
function getSigners(provider) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
supportTron: true
|
|
347
|
-
});
|
|
345
|
+
var signers = new SignerFactory();
|
|
346
|
+
signers.registerSigner(TransactionType.TRON, new DefaultTronSigner(provider));
|
|
347
|
+
return signers;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
// https://docs.tronlink.org/dapp/start-developing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-tron-link.esm.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function tronLink() {\n const { tronLink } = window;\n if (!!tronLink) return tronLink;\n return null;\n}\n","import {
|
|
1
|
+
{"version":3,"file":"provider-tron-link.esm.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function tronLink() {\n const { tronLink } = window;\n if (!!tronLink) return tronLink;\n return null;\n}\n","import { DefaultTronSigner } from '@rango-dev/signer-tron';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const signers = new SignerFactory();\n signers.registerSigner(TxType.TRON, new DefaultTronSigner(provider));\n return signers;\n}\n","import { Subscribe } from '@rango-dev/wallets-shared';\nimport {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { tronLink as tronLink_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, BlockchainMeta, tronBlockchain } from 'rango-types';\n\n// https://docs.tronlink.org/dapp/start-developing\n// https://developers.tron.network/docs/tronlink-events\nconst WALLET = WalletType.TRON_LINK;\n\nexport const config = {\n type: WALLET,\n defaultNetwork: Network.TRON,\n};\n\nexport const getInstance = tronLink_instance;\n\nexport const connect: Connect = async ({ instance }) => {\n let r = undefined;\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 === 200) {\n } else if (!!r?.code && !!r.message) {\n throw new Error(r.message);\n }\n }\n const address = instance.tronWeb.address.fromHex(\n (await instance.tronWeb.trx.getAccount()).address.toString()\n );\n // TODO check connected network\n return { accounts: !!address ? [address] : [], chainId: Network.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) => 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/rango-types/main/assets/icons/wallets/tronlink.png',\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"],"names":["tronLink","_window","window","getSigners","provider","signers","SignerFactory","registerSigner","TxType","TRON","DefaultTronSigner","WALLET","WalletType","TRON_LINK","config","type","defaultNetwork","Network","getInstance","tronLink_instance","connect","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","instance","r","_r","address","wrap","_callee$","_context","prev","next","undefined","ready","request","method","sent","Error","code","message","t0","tronWeb","trx","getAccount","t1","toString","fromHex","call","abrupt","accounts","chainId","stop","_x","apply","arguments","subscribe","_ref3","updateAccounts","disconnect","addEventListener","e","data","isTronLink","action","_e$data","_e$data$message","_e$data$message$data","account","canSwitchNetworkTo","signer","getWalletInfo","allBlockChains","tron","tronBlockchain","name","img","installLink","CHROME","BRAVE","DEFAULT","color","supportedChains"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,SAAS,EAAE,UAACC,CAAC;IACnC,IACEA,CAAC,CAACC,IAAI,CAACC,UAAU,IACjBF,CAAC,CAACC,IAAI,CAACtB,OAAO,IACdqB,CAAC,CAACC,IAAI,CAACtB,OAAO,CAACwB,MAAM,IAAI,iBAAiB,EAC1C;MAAA,IAAAC,OAAA,EAAAC,eAAA,EAAAC,oBAAA;MACA,IAAMC,OAAO,GAAGP,CAAC,qBAAAI,OAAA,GAADJ,CAAC,CAAEC,IAAI,sBAAAI,eAAA,GAAPD,OAAA,CAASzB,OAAO,sBAAA2B,oBAAA,GAAhBD,eAAA,CAAkBJ,IAAI,qBAAtBK,oBAAA,CAAwBxC,OAAO;MAC/C,IAAI,CAAC,CAACyC,OAAO,EAAE;QACbV,cAAc,CAAC,CAACU,OAAO,CAAC,CAAC;OAC1B,MAAM;QACLT,UAAU,EAAE;;;GAGjB,CAAC;AACJ,CAAC;AAED,IAAaU,kBAAkB,GAAqB,SAAvCA,kBAAkBA;EAAA,OAA2B,KAAK;AAAA;AAE/D,IAAarE,YAAU,GAAqCsE;AAE5D,IAAaC,aAAa,GAAqD,SAAlEA,aAAaA,CACxBC,cAAc;EAEd,IAAMC,IAAI,GAAGC,cAAc,CAACF,cAAc,CAAC;EAC3C,OAAO;IACLG,IAAI,EAAE,UAAU;IAChBC,GAAG,EAAE,qGAAqG;IAC1GC,WAAW,EAAE;MACXC,MAAM,EACJ,qFAAqF;MACvFC,KAAK,EACH,qFAAqF;MACvFC,OAAO,EAAE;KACV;IACDC,KAAK,EAAE,SAAS;IAChBC,eAAe,EAAET;GAClB;AACH,CAAC;;;;"}
|
package/dist/signer.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default function getSigners(provider: any):
|
|
1
|
+
import { SignerFactory } from 'rango-types';
|
|
2
|
+
export default function getSigners(provider: any): SignerFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-tron-link",
|
|
3
|
-
"version": "0.1.11-next.
|
|
3
|
+
"version": "0.1.11-next.70",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "dist/provider-tron-link.esm.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,15 +11,12 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"dev": "tsdx watch",
|
|
14
|
-
"build": "tsdx build",
|
|
14
|
+
"build": "tsdx build --tsconfig ./tsconfig.json",
|
|
15
15
|
"test": "tsdx test --passWithNoTests",
|
|
16
16
|
"lint": "tsdx lint",
|
|
17
17
|
"size": "size-limit",
|
|
18
18
|
"analyze": "size-limit --why"
|
|
19
19
|
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"react": ">=16"
|
|
22
|
-
},
|
|
23
20
|
"husky": {
|
|
24
21
|
"hooks": {
|
|
25
22
|
"pre-commit": "tsdx lint"
|
|
@@ -42,7 +39,9 @@
|
|
|
42
39
|
}
|
|
43
40
|
],
|
|
44
41
|
"dependencies": {
|
|
45
|
-
"@rango-dev/
|
|
42
|
+
"@rango-dev/signer-tron": "^0.1.11-next.76",
|
|
43
|
+
"@rango-dev/wallets-shared": "^0.1.11-next.73",
|
|
44
|
+
"rango-types": "^0.1.21"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -4,13 +4,11 @@ import {
|
|
|
4
4
|
WalletType,
|
|
5
5
|
CanSwitchNetwork,
|
|
6
6
|
Connect,
|
|
7
|
-
WalletSigners,
|
|
8
|
-
BlockchainMeta,
|
|
9
7
|
WalletInfo,
|
|
10
|
-
tronBlockchain,
|
|
11
8
|
} from '@rango-dev/wallets-shared';
|
|
12
9
|
import { tronLink as tronLink_instance } from './helpers';
|
|
13
10
|
import signer from './signer';
|
|
11
|
+
import { SignerFactory, BlockchainMeta, tronBlockchain } from 'rango-types';
|
|
14
12
|
|
|
15
13
|
// https://docs.tronlink.org/dapp/start-developing
|
|
16
14
|
// https://developers.tron.network/docs/tronlink-events
|
|
@@ -61,7 +59,7 @@ export const subscribe: Subscribe = ({ updateAccounts, disconnect }) => {
|
|
|
61
59
|
|
|
62
60
|
export const canSwitchNetworkTo: CanSwitchNetwork = () => false;
|
|
63
61
|
|
|
64
|
-
export const getSigners: (provider: any) =>
|
|
62
|
+
export const getSigners: (provider: any) => SignerFactory = signer;
|
|
65
63
|
|
|
66
64
|
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
|
|
67
65
|
allBlockChains
|
package/src/signer.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
WalletSigners,
|
|
4
|
-
defaultSigners,
|
|
5
|
-
} from '@rango-dev/wallets-shared';
|
|
1
|
+
import { DefaultTronSigner } from '@rango-dev/signer-tron';
|
|
2
|
+
import { SignerFactory, TransactionType as TxType } from 'rango-types';
|
|
6
3
|
|
|
7
|
-
export default function getSigners(provider: any):
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
supportTron: true,
|
|
12
|
-
});
|
|
4
|
+
export default function getSigners(provider: any): SignerFactory {
|
|
5
|
+
const signers = new SignerFactory();
|
|
6
|
+
signers.registerSigner(TxType.TRON, new DefaultTronSigner(provider));
|
|
7
|
+
return signers;
|
|
13
8
|
}
|