@rango-dev/provider-trustwallet 0.1.11-next.74 → 0.1.11-next.76
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-trustwallet.cjs.development.js +7 -6
- package/dist/provider-trustwallet.cjs.development.js.map +1 -1
- package/dist/provider-trustwallet.cjs.production.min.js +1 -1
- package/dist/provider-trustwallet.cjs.production.min.js.map +1 -1
- package/dist/provider-trustwallet.esm.js +7 -6
- package/dist/provider-trustwallet.esm.js.map +1 -1
- package/dist/signer.d.ts +2 -2
- package/package.json +5 -9
- package/src/index.ts +2 -4
- package/src/signer.ts +8 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { WalletType, CanSwitchNetwork, Connect, Subscribe, SwitchNetwork,
|
|
1
|
+
import { WalletType, CanSwitchNetwork, Connect, Subscribe, SwitchNetwork, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
2
|
import { trustWallet as trustwallet_instance } from './helpers';
|
|
3
|
+
import { SignerFactory, BlockchainMeta } from 'rango-types';
|
|
3
4
|
export declare const config: {
|
|
4
5
|
type: WalletType;
|
|
5
6
|
};
|
|
@@ -8,5 +9,5 @@ export declare const connect: Connect;
|
|
|
8
9
|
export declare const subscribe: Subscribe;
|
|
9
10
|
export declare const switchNetwork: SwitchNetwork;
|
|
10
11
|
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
11
|
-
export declare const getSigners: (provider: any) =>
|
|
12
|
+
export declare const getSigners: (provider: any) => SignerFactory;
|
|
12
13
|
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 signerEvm = require('@rango-dev/signer-evm');
|
|
7
|
+
var rangoTypes = require('rango-types');
|
|
6
8
|
|
|
7
9
|
function _regeneratorRuntime() {
|
|
8
10
|
_regeneratorRuntime = function () {
|
|
@@ -346,11 +348,10 @@ function trustWallet() {
|
|
|
346
348
|
}
|
|
347
349
|
|
|
348
350
|
function getSigners(provider) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
});
|
|
351
|
+
var ethProvider = walletsShared.getNetworkInstance(provider, walletsShared.Network.ETHEREUM);
|
|
352
|
+
var signers = new rangoTypes.SignerFactory();
|
|
353
|
+
signers.registerSigner(rangoTypes.TransactionType.EVM, new signerEvm.DefaultEvmSigner(ethProvider));
|
|
354
|
+
return signers;
|
|
354
355
|
}
|
|
355
356
|
|
|
356
357
|
var WALLET = walletsShared.WalletType.TRUST_WALLET;
|
|
@@ -391,7 +392,7 @@ var switchNetwork = walletsShared.switchNetworkForEvm;
|
|
|
391
392
|
var canSwitchNetworkTo = walletsShared.canSwitchNetworkToEvm;
|
|
392
393
|
var getSigners$1 = getSigners;
|
|
393
394
|
var getWalletInfo = function getWalletInfo(allBlockChains) {
|
|
394
|
-
var evms =
|
|
395
|
+
var evms = rangoTypes.evmBlockchains(allBlockChains);
|
|
395
396
|
return {
|
|
396
397
|
name: 'Trust Wallet',
|
|
397
398
|
img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/trust.png',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-trustwallet.cjs.development.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function trustWallet() {\n const { trustwallet } = window;\n \n if (!!trustwallet && (trustwallet?.isTrust || trustwallet?.isTrustWallet)) {\n return trustwallet;\n }\n return null;\n}\n","import {
|
|
1
|
+
{"version":3,"file":"provider-trustwallet.cjs.development.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function trustWallet() {\n const { trustwallet } = window;\n \n if (!!trustwallet && (trustwallet?.isTrust || trustwallet?.isTrustWallet)) {\n return trustwallet;\n }\n return null;\n}\n","import { DefaultEvmSigner } from '@rango-dev/signer-evm';\nimport { Network, getNetworkInstance } from '@rango-dev/wallets-shared';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const ethProvider = getNetworkInstance(provider, Network.ETHEREUM);\n const signers = new SignerFactory();\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider));\n return signers;\n}\n","import {\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n SwitchNetwork,\n canSwitchNetworkToEvm,\n getEvmAccounts,\n subscribeToEvm,\n switchNetworkForEvm,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { trustWallet as trustwallet_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, evmBlockchains, BlockchainMeta } from 'rango-types';\n\nconst WALLET = WalletType.TRUST_WALLET;\n\nexport const config = {\n type: WALLET,\n};\n\nexport const getInstance = trustwallet_instance;\n\n// doc: https://developer.trustwallet.com/trust-wallet-browser-extension/extension-guide\nexport const connect: Connect = async ({ instance }) => {\n const { accounts, chainId } = await getEvmAccounts(instance);\n return {\n accounts,\n chainId,\n };\n};\n\nexport const subscribe: Subscribe = subscribeToEvm;\n\nexport const switchNetwork: SwitchNetwork = switchNetworkForEvm;\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = canSwitchNetworkToEvm;\n\nexport const getSigners: (provider: any) => SignerFactory = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const evms = evmBlockchains(allBlockChains);\n return {\n name: 'Trust Wallet',\n img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/trust.png',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/',\n BRAVE:\n 'https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/',\n DEFAULT: 'https://trustwallet.com/browser-extension',\n },\n color: '#ffffff',\n supportedChains: evms,\n };\n};\n"],"names":["trustWallet","_window","window","trustwallet","isTrust","isTrustWallet","getSigners","provider","ethProvider","getNetworkInstance","Network","ETHEREUM","signers","SignerFactory","registerSigner","TxType","EVM","DefaultEvmSigner","WALLET","WalletType","TRUST_WALLET","config","type","getInstance","trustwallet_instance","connect","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","instance","_yield$getEvmAccounts","accounts","chainId","wrap","_callee$","_context","prev","next","getEvmAccounts","sent","abrupt","stop","_x","apply","arguments","subscribe","subscribeToEvm","switchNetwork","switchNetworkForEvm","canSwitchNetworkTo","canSwitchNetworkToEvm","signer","getWalletInfo","allBlockChains","evms","evmBlockchains","name","img","installLink","CHROME","BRAVE","DEFAULT","color","supportedChains"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAgBA,WAAWA;EACzB,IAAAC,OAAA,GAAwBC,MAAM;IAAtBC,WAAW,GAAAF,OAAA,CAAXE,WAAW;EAEnB,IAAI,CAAC,CAACA,WAAW,KAAKA,WAAW,YAAXA,WAAW,CAAEC,OAAO,IAAID,WAAW,YAAXA,WAAW,CAAEE,aAAa,CAAC,EAAE;IACzE,OAAOF,WAAW;;EAEpB,OAAO,IAAI;AACb;;SCHwBG,UAAUA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AAaC,kBAAkB,GAAqBC;AAEpD,IAAa/C,YAAU,GAAqCgD;AAE5D,IAAaC,aAAa,GAAqD,SAAlEA,aAAaA,CACxBC,cAAc;EAEd,IAAMC,IAAI,GAAGC,yBAAc,CAACF,cAAc,CAAC;EAC3C,OAAO;IACLG,IAAI,EAAE,cAAc;IACpBC,GAAG,EAAE,kGAAkG;IACvGC,WAAW,EAAE;MACXC,MAAM,EACJ,0FAA0F;MAC5FC,KAAK,EACH,0FAA0F;MAC5FC,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-evm"),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:E(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function p(){}function v(){}function d(){}var g={};s(g,a,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(k([])));w&&w!==e&&r.call(w,a)&&(g=w);var m=d.prototype=p.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(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=h(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 E(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=L(a,r);if(c){if(c===f)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=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function L(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,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;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,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(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:O}}function O(){return{value:void 0,done:!0}}return v.prototype=d,o(m,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(x.prototype),s(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),s(m,u,"Generator"),s(m,a,(function(){return this})),s(m,"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=k,_.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(j),!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,f):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),f},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),j(r),f}},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;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},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.TRUST_WALLET},c=function(){var e=i(n().mark((function e(r){var o,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.instance,e.next=3,t.getEvmAccounts(o);case 3:return e.abrupt("return",{accounts:(i=e.sent).accounts,chainId:i.chainId});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u=t.subscribeToEvm,s=t.switchNetworkForEvm;exports.canSwitchNetworkTo=t.canSwitchNetworkToEvm,exports.config=a,exports.connect=c,exports.getInstance=function(){var t=window.trustwallet;return t&&(null!=t&&t.isTrust||null!=t&&t.isTrustWallet)?t:null},exports.getSigners=function(n){var o=t.getNetworkInstance(n,t.Network.ETHEREUM),i=new r.SignerFactory;return i.registerSigner(r.TransactionType.EVM,new e.DefaultEvmSigner(o)),i},exports.getWalletInfo=function(t){return{name:"Trust Wallet",img:"https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/trust.png",installLink:{CHROME:"https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/",BRAVE:"https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/",DEFAULT:"https://trustwallet.com/browser-extension"},color:"#ffffff",supportedChains:r.evmBlockchains(t)}},exports.subscribe=u,exports.switchNetwork=s;
|
|
2
2
|
//# sourceMappingURL=provider-trustwallet.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-trustwallet.cjs.production.min.js","sources":["../src/index.ts","../src/helpers.ts","../src/signer.ts"],"sourcesContent":["import {\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n SwitchNetwork,\n
|
|
1
|
+
{"version":3,"file":"provider-trustwallet.cjs.production.min.js","sources":["../src/index.ts","../src/helpers.ts","../src/signer.ts"],"sourcesContent":["import {\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n SwitchNetwork,\n canSwitchNetworkToEvm,\n getEvmAccounts,\n subscribeToEvm,\n switchNetworkForEvm,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { trustWallet as trustwallet_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, evmBlockchains, BlockchainMeta } from 'rango-types';\n\nconst WALLET = WalletType.TRUST_WALLET;\n\nexport const config = {\n type: WALLET,\n};\n\nexport const getInstance = trustwallet_instance;\n\n// doc: https://developer.trustwallet.com/trust-wallet-browser-extension/extension-guide\nexport const connect: Connect = async ({ instance }) => {\n const { accounts, chainId } = await getEvmAccounts(instance);\n return {\n accounts,\n chainId,\n };\n};\n\nexport const subscribe: Subscribe = subscribeToEvm;\n\nexport const switchNetwork: SwitchNetwork = switchNetworkForEvm;\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = canSwitchNetworkToEvm;\n\nexport const getSigners: (provider: any) => SignerFactory = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const evms = evmBlockchains(allBlockChains);\n return {\n name: 'Trust Wallet',\n img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/trust.png',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/',\n BRAVE:\n 'https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/',\n DEFAULT: 'https://trustwallet.com/browser-extension',\n },\n color: '#ffffff',\n supportedChains: evms,\n };\n};\n","export function trustWallet() {\n const { trustwallet } = window;\n \n if (!!trustwallet && (trustwallet?.isTrust || trustwallet?.isTrustWallet)) {\n return trustwallet;\n }\n return null;\n}\n","import { DefaultEvmSigner } from '@rango-dev/signer-evm';\nimport { Network, getNetworkInstance } from '@rango-dev/wallets-shared';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const ethProvider = getNetworkInstance(provider, Network.ETHEREUM);\n const signers = new SignerFactory();\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider));\n return signers;\n}\n"],"names":["config","type","WalletType","TRUST_WALLET","connect","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","instance","_yield$getEvmAccounts","wrap","_context","prev","next","getEvmAccounts","abrupt","accounts","sent","chainId","stop","_x","apply","arguments","subscribe","subscribeToEvm","switchNetwork","switchNetworkForEvm","canSwitchNetworkToEvm","trustwallet","window","isTrust","isTrustWallet","provider","ethProvider","getNetworkInstance","Network","ETHEREUM","signers","SignerFactory","registerSigner","TxType","EVM","DefaultEvmSigner","allBlockChains","name","img","installLink","CHROME","BRAVE","DEFAULT","color","supportedChains","evmBlockchains"],"mappings":"86NAgBA,IAEaA,EAAS,CACpBC,KAHaC,aAAWC,cASbC,aAAO,IAAAC,EAAAC,EAAAC,IAAAC,MAAY,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,EAAA,OAAAL,IAAAM,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAAiB,OAARL,EAAQD,EAARC,SAAQG,EAAAE,OACXC,iBAAeN,GAAS,OAAnC,OAAAG,EAAAI,gBAClB,CACLC,UAF0DP,EAAAE,EAAAM,MAApDD,SAGNE,QAHuBT,EAAPS,UAIjB,OAAA,UAAA,OAAAP,EAAAQ,UAAAb,OACF,gBANmBc,GAAA,OAAAlB,EAAAmB,WAAAC,eAQPC,EAAuBC,iBAEvBC,EAA+BC,iDAEQC,0FCpClD,IAAQC,EAAgBC,OAAhBD,YAER,OAAMA,UAAgBA,GAAAA,EAAaE,eAAWF,GAAAA,EAAaG,eAClDH,EAEF,kCCF0BI,GACjC,IAAMC,EAAcC,qBAAmBF,EAAUG,UAAQC,UACnDC,EAAU,IAAIC,gBAEpB,OADAD,EAAQE,eAAeC,kBAAOC,IAAK,IAAIC,mBAAiBT,IACjDI,yBFiCsE,SAC7EM,GAGA,MAAO,CACLC,KAAM,eACNC,IAAK,mGACLC,YAAa,CACXC,OACE,2FACFC,MACE,2FACFC,QAAS,6CAEXC,MAAO,UACPC,gBAZWC,iBAAeT"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getNetworkInstance, Network, subscribeToEvm, switchNetworkForEvm, canSwitchNetworkToEvm, WalletType, getEvmAccounts } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { DefaultEvmSigner } from '@rango-dev/signer-evm';
|
|
3
|
+
import { SignerFactory, TransactionType, evmBlockchains } from 'rango-types';
|
|
2
4
|
|
|
3
5
|
function _regeneratorRuntime() {
|
|
4
6
|
_regeneratorRuntime = function () {
|
|
@@ -342,11 +344,10 @@ function trustWallet() {
|
|
|
342
344
|
}
|
|
343
345
|
|
|
344
346
|
function getSigners(provider) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
});
|
|
347
|
+
var ethProvider = getNetworkInstance(provider, Network.ETHEREUM);
|
|
348
|
+
var signers = new SignerFactory();
|
|
349
|
+
signers.registerSigner(TransactionType.EVM, new DefaultEvmSigner(ethProvider));
|
|
350
|
+
return signers;
|
|
350
351
|
}
|
|
351
352
|
|
|
352
353
|
var WALLET = WalletType.TRUST_WALLET;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-trustwallet.esm.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function trustWallet() {\n const { trustwallet } = window;\n \n if (!!trustwallet && (trustwallet?.isTrust || trustwallet?.isTrustWallet)) {\n return trustwallet;\n }\n return null;\n}\n","import {
|
|
1
|
+
{"version":3,"file":"provider-trustwallet.esm.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function trustWallet() {\n const { trustwallet } = window;\n \n if (!!trustwallet && (trustwallet?.isTrust || trustwallet?.isTrustWallet)) {\n return trustwallet;\n }\n return null;\n}\n","import { DefaultEvmSigner } from '@rango-dev/signer-evm';\nimport { Network, getNetworkInstance } from '@rango-dev/wallets-shared';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const ethProvider = getNetworkInstance(provider, Network.ETHEREUM);\n const signers = new SignerFactory();\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider));\n return signers;\n}\n","import {\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n SwitchNetwork,\n canSwitchNetworkToEvm,\n getEvmAccounts,\n subscribeToEvm,\n switchNetworkForEvm,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { trustWallet as trustwallet_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, evmBlockchains, BlockchainMeta } from 'rango-types';\n\nconst WALLET = WalletType.TRUST_WALLET;\n\nexport const config = {\n type: WALLET,\n};\n\nexport const getInstance = trustwallet_instance;\n\n// doc: https://developer.trustwallet.com/trust-wallet-browser-extension/extension-guide\nexport const connect: Connect = async ({ instance }) => {\n const { accounts, chainId } = await getEvmAccounts(instance);\n return {\n accounts,\n chainId,\n };\n};\n\nexport const subscribe: Subscribe = subscribeToEvm;\n\nexport const switchNetwork: SwitchNetwork = switchNetworkForEvm;\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = canSwitchNetworkToEvm;\n\nexport const getSigners: (provider: any) => SignerFactory = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const evms = evmBlockchains(allBlockChains);\n return {\n name: 'Trust Wallet',\n img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/trust.png',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/',\n BRAVE:\n 'https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph/',\n DEFAULT: 'https://trustwallet.com/browser-extension',\n },\n color: '#ffffff',\n supportedChains: evms,\n };\n};\n"],"names":["trustWallet","_window","window","trustwallet","isTrust","isTrustWallet","getSigners","provider","ethProvider","getNetworkInstance","Network","ETHEREUM","signers","SignerFactory","registerSigner","TxType","EVM","DefaultEvmSigner","WALLET","WalletType","TRUST_WALLET","config","type","getInstance","trustwallet_instance","connect","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","instance","_yield$getEvmAccounts","accounts","chainId","wrap","_callee$","_context","prev","next","getEvmAccounts","sent","abrupt","stop","_x","apply","arguments","subscribe","subscribeToEvm","switchNetwork","switchNetworkForEvm","canSwitchNetworkTo","canSwitchNetworkToEvm","signer","getWalletInfo","allBlockChains","evms","evmBlockchains","name","img","installLink","CHROME","BRAVE","DEFAULT","color","supportedChains"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAgBA,WAAWA;EACzB,IAAAC,OAAA,GAAwBC,MAAM;IAAtBC,WAAW,GAAAF,OAAA,CAAXE,WAAW;EAEnB,IAAI,CAAC,CAACA,WAAW,KAAKA,WAAW,YAAXA,WAAW,CAAEC,OAAO,IAAID,WAAW,YAAXA,WAAW,CAAEE,aAAa,CAAC,EAAE;IACzE,OAAOF,WAAW;;EAEpB,OAAO,IAAI;AACb;;SCHwBG,UAAUA,CAACC,QAAa;EAC9C,IAAMC,WAAW,GAAGC,kBAAkB,CAACF,QAAQ,EAAEG,OAAO,CAACC,QAAQ,CAAC;EAClE,IAAMC,OAAO,GAAG,IAAIC,aAAa,E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AMC,IAAI,GAAGC,cAAc,CAACF,cAAc,CAAC;EAC3C,OAAO;IACLG,IAAI,EAAE,cAAc;IACpBC,GAAG,EAAE,kGAAkG;IACvGC,WAAW,EAAE;MACXC,MAAM,EACJ,0FAA0F;MAC5FC,KAAK,EACH,0FAA0F;MAC5FC,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-trustwallet",
|
|
3
|
-
"version": "0.1.11-next.
|
|
3
|
+
"version": "0.1.11-next.76",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "dist/provider-trustwallet.esm.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,20 +9,14 @@
|
|
|
9
9
|
"dist",
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
|
-
"engines": {
|
|
13
|
-
"node": ">=10"
|
|
14
|
-
},
|
|
15
12
|
"scripts": {
|
|
16
13
|
"start": "tsdx watch",
|
|
17
|
-
"build": "tsdx build",
|
|
14
|
+
"build": "tsdx build --tsconfig ./tsconfig.json",
|
|
18
15
|
"test": "tsdx test --passWithNoTests",
|
|
19
16
|
"lint": "tsdx lint",
|
|
20
17
|
"size": "size-limit",
|
|
21
18
|
"analyze": "size-limit --why"
|
|
22
19
|
},
|
|
23
|
-
"peerDependencies": {
|
|
24
|
-
"react": ">=16"
|
|
25
|
-
},
|
|
26
20
|
"husky": {
|
|
27
21
|
"hooks": {
|
|
28
22
|
"pre-commit": "tsdx lint"
|
|
@@ -45,7 +39,9 @@
|
|
|
45
39
|
}
|
|
46
40
|
],
|
|
47
41
|
"dependencies": {
|
|
48
|
-
"@rango-dev/
|
|
42
|
+
"@rango-dev/signer-evm": "^0.1.11-next.76",
|
|
43
|
+
"@rango-dev/wallets-shared": "^0.1.11-next.73",
|
|
44
|
+
"rango-types": "^0.1.21"
|
|
49
45
|
},
|
|
50
46
|
"publishConfig": {
|
|
51
47
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -4,17 +4,15 @@ import {
|
|
|
4
4
|
Connect,
|
|
5
5
|
Subscribe,
|
|
6
6
|
SwitchNetwork,
|
|
7
|
-
WalletSigners,
|
|
8
7
|
canSwitchNetworkToEvm,
|
|
9
8
|
getEvmAccounts,
|
|
10
9
|
subscribeToEvm,
|
|
11
10
|
switchNetworkForEvm,
|
|
12
|
-
evmBlockchains,
|
|
13
|
-
BlockchainMeta,
|
|
14
11
|
WalletInfo,
|
|
15
12
|
} from '@rango-dev/wallets-shared';
|
|
16
13
|
import { trustWallet as trustwallet_instance } from './helpers';
|
|
17
14
|
import signer from './signer';
|
|
15
|
+
import { SignerFactory, evmBlockchains, BlockchainMeta } from 'rango-types';
|
|
18
16
|
|
|
19
17
|
const WALLET = WalletType.TRUST_WALLET;
|
|
20
18
|
|
|
@@ -39,7 +37,7 @@ export const switchNetwork: SwitchNetwork = switchNetworkForEvm;
|
|
|
39
37
|
|
|
40
38
|
export const canSwitchNetworkTo: CanSwitchNetwork = canSwitchNetworkToEvm;
|
|
41
39
|
|
|
42
|
-
export const getSigners: (provider: any) =>
|
|
40
|
+
export const getSigners: (provider: any) => SignerFactory = signer;
|
|
43
41
|
|
|
44
42
|
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
|
|
45
43
|
allBlockChains
|
package/src/signer.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
WalletSigners,
|
|
5
|
-
} from '@rango-dev/wallets-shared';
|
|
1
|
+
import { DefaultEvmSigner } from '@rango-dev/signer-evm';
|
|
2
|
+
import { Network, getNetworkInstance } from '@rango-dev/wallets-shared';
|
|
3
|
+
import { SignerFactory, TransactionType as TxType } from 'rango-types';
|
|
6
4
|
|
|
7
|
-
export default function getSigners(provider: any):
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
5
|
+
export default function getSigners(provider: any): SignerFactory {
|
|
6
|
+
const ethProvider = getNetworkInstance(provider, Network.ETHEREUM);
|
|
7
|
+
const signers = new SignerFactory();
|
|
8
|
+
signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider));
|
|
9
|
+
return signers;
|
|
13
10
|
}
|