@rango-dev/provider-trustwallet 0.1.15 → 0.1.16-next.0
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 +0 -4
- package/dist/index.d.ts +2 -2
- package/dist/provider-trustwallet.cjs.development.js +1 -1
- 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 +2 -2
- package/dist/provider-trustwallet.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
## [0.1.15](https://github.com/rango-exchange/rango-client/compare/provider-trustwallet@0.1.14...provider-trustwallet@0.1.15) (2023-05-15)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
1
|
## [0.1.14](https://github.com/rango-exchange/rango-client/compare/provider-trustwallet@0.1.13...provider-trustwallet@0.1.14) (2023-05-15)
|
|
6
2
|
|
|
7
3
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WalletTypes, CanSwitchNetwork, Connect, Subscribe, SwitchNetwork, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
2
|
import { trustWallet as trustwallet_instance } from './helpers';
|
|
3
3
|
import { SignerFactory, BlockchainMeta } from 'rango-types';
|
|
4
4
|
export declare const config: {
|
|
5
|
-
type:
|
|
5
|
+
type: WalletTypes;
|
|
6
6
|
};
|
|
7
7
|
export declare const getInstance: typeof trustwallet_instance;
|
|
8
8
|
export declare const connect: Connect;
|
|
@@ -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 { 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
|
|
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 WalletTypes,\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 = WalletTypes.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","WalletTypes","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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UAAA,OACXC,4BAAc,CAACT,QAAQ,CAAC;QAAA;UAAAC,qBAAA,GAAAK,QAAA,CAAAI,IAAA;UAApDR,QAAQ,GAAAD,qBAAA,CAARC,QAAQ;UAAEC,OAAO,GAAAF,qBAAA,CAAPE,OAAO;UAAA,OAAAG,QAAA,CAAAK,MAAA,WAClB;YACLT,QAAQ,EAARA,QAAQ;YACRC,OAAO,EAAPA;WACD;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAM,IAAA;;OAAAd,OAAA;GACF;EAAA,gBANYL,OAAOA,CAAAoB,EAAA;IAAA,OAAAnB,KAAA,CAAAoB,KAAA,OAAAC,SAAA;;AAAA,GAMnB;AAED,IAAaC,SAAS,GAAcC;AAEpC,IAAaC,aAAa,GAAkBC;AAE5C,IAAaC,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"),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.
|
|
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.WalletTypes.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
|
|
1
|
+
{"version":3,"file":"provider-trustwallet.cjs.production.min.js","sources":["../src/index.ts","../src/helpers.ts","../src/signer.ts"],"sourcesContent":["import {\n WalletTypes,\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 = WalletTypes.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","WalletTypes","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,cAAYC,cASdC,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,4 @@
|
|
|
1
|
-
import { getNetworkInstance, Network, subscribeToEvm, switchNetworkForEvm, canSwitchNetworkToEvm,
|
|
1
|
+
import { getNetworkInstance, Network, subscribeToEvm, switchNetworkForEvm, canSwitchNetworkToEvm, WalletTypes, getEvmAccounts } from '@rango-dev/wallets-shared';
|
|
2
2
|
import { DefaultEvmSigner } from '@rango-dev/signer-evm';
|
|
3
3
|
import { SignerFactory, TransactionType, evmBlockchains } from 'rango-types';
|
|
4
4
|
|
|
@@ -350,7 +350,7 @@ function getSigners(provider) {
|
|
|
350
350
|
return signers;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
var WALLET =
|
|
353
|
+
var WALLET = WalletTypes.TRUST_WALLET;
|
|
354
354
|
var config = {
|
|
355
355
|
type: WALLET
|
|
356
356
|
};
|
|
@@ -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 { 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
|
|
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 WalletTypes,\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 = WalletTypes.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","WalletTypes","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,EAAE;EACnCD,OAAO,CAACE,cAAc,CAACC,eAAM,CAACC,GAAG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O;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/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
WalletTypes,
|
|
3
3
|
CanSwitchNetwork,
|
|
4
4
|
Connect,
|
|
5
5
|
Subscribe,
|
|
@@ -14,7 +14,7 @@ import { trustWallet as trustwallet_instance } from './helpers';
|
|
|
14
14
|
import signer from './signer';
|
|
15
15
|
import { SignerFactory, evmBlockchains, BlockchainMeta } from 'rango-types';
|
|
16
16
|
|
|
17
|
-
const WALLET =
|
|
17
|
+
const WALLET = WalletTypes.TRUST_WALLET;
|
|
18
18
|
|
|
19
19
|
export const config = {
|
|
20
20
|
type: WALLET,
|