@rango-dev/provider-trezor 0.27.1-next.3 → 0.27.1-next.4

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.
@@ -1,2 +1,2 @@
1
1
  var s=Object.defineProperty;var e=(t,r)=>s(t,"name",{value:r,configurable:!0});var o="";function g(t){o=t}e(g,"setDerivationPath");function i(){return o}e(i,"getDerivationPath");import{dynamicImportWithRefinedError as c,ETHEREUM_CHAIN_ID as a,Networks as u}from"@rango-dev/wallets-shared";var h={Failure_ActionCancelled:"User rejected the transaction."};async function d(){let t=await c(async()=>await import("@trezor/connect-web"));return t.default.default?t.default.default:t.default}e(d,"getTrezorModule");function x(){let t=new Map;return t.set(u.ETHEREUM,{chainId:a}),t}e(x,"getTrezorInstance");async function I(){let t=await d(),r=i(),n=await t.ethereumGetAddress({path:r});if(!n.success)throw new Error(n.payload.error);return{accounts:[n.payload.address],chainId:a,derivationPath:r}}e(I,"getEthereumAccounts");var w=e(t=>{let r=BigInt(0);return BigInt(t)>r?`0x${BigInt(t).toString(16)}`:"0x0"},"valueToHex"),T=e(t=>t&&!t.startsWith("m/")?"m/"+t:t,"getTrezorNormalizedDerivationPath");export{e as a,g as b,i as c,h as d,d as e,x as f,I as g,w as h,T as i};
2
- //# sourceMappingURL=chunk-EWAGIH74.js.map
2
+ //# sourceMappingURL=chunk-WO4Y4OWN.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/state.ts", "../src/legacy/helpers.ts"],
4
+ "sourcesContent": ["// We keep derivationPath here because we need to maintain it for signing transactions after it is set in connect method\nlet derivationPath = '';\n\nexport function setDerivationPath(path: string) {\n derivationPath = path;\n}\n\nexport function getDerivationPath() {\n return derivationPath;\n}\n", "import type { TrezorConnect } from '@trezor/connect-web';\n\nimport {\n dynamicImportWithRefinedError,\n ETHEREUM_CHAIN_ID,\n Networks,\n type ProviderConnectResult,\n} from '@rango-dev/wallets-shared';\n\nimport { getDerivationPath } from '../state';\n\nexport const trezorErrorMessages: { [statusCode: string]: string } = {\n Failure_ActionCancelled: 'User rejected the transaction.',\n};\n\n// `@trezor/connect-web` is commonjs, when we are importing it dynamically, it has some differences in different tooling. for example vite (you can check widget-examples), goes throw error. this is a workaround for solving this interop issue.\nexport async function getTrezorModule() {\n const mod = await dynamicImportWithRefinedError(\n async () => await import('@trezor/connect-web')\n );\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (mod.default.default) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return mod.default.default as unknown as TrezorConnect;\n }\n\n return mod.default;\n}\n\nexport function getTrezorInstance() {\n /*\n * Instances have a required property which is `chainId` and is using in swap execution.\n * Here we are setting it as Ethereum always since we are supporting only eth for now.\n */\n const instances = new Map();\n\n instances.set(Networks.ETHEREUM, { chainId: ETHEREUM_CHAIN_ID });\n\n return instances;\n}\n\nexport async function getEthereumAccounts(): Promise<ProviderConnectResult> {\n const TrezorConnect = await getTrezorModule();\n const derivationPath = getDerivationPath();\n const result = await TrezorConnect.ethereumGetAddress({\n path: derivationPath,\n });\n\n if (!result.success) {\n throw new Error(result.payload.error);\n }\n\n return {\n accounts: [result.payload.address],\n chainId: ETHEREUM_CHAIN_ID,\n derivationPath,\n };\n}\n\n/*\n * Using BigInt in the valueToHex function ensures that the function\n * can handle very large integer values that exceed the range of standard JavaScript number types.\n */\nexport const valueToHex = (value: string) => {\n const ZERO_BIGINT = BigInt(0);\n const HEX_BASE = 16;\n return BigInt(value) > ZERO_BIGINT\n ? `0x${BigInt(value).toString(HEX_BASE)}`\n : '0x0';\n};\n\nexport const getTrezorNormalizedDerivationPath = (\n path: string // TrezorConnect needs master node to be added to derivation path\n) => (path && !path.startsWith('m/') ? 'm/' + path : path);\n"],
5
+ "mappings": "+EACA,IAAIA,EAAiB,GAEd,SAASC,EAAkBC,EAAc,CAC9CF,EAAiBE,CACnB,CAFgBC,EAAAF,EAAA,qBAIT,SAASG,GAAoB,CAClC,OAAOJ,CACT,CAFgBG,EAAAC,EAAA,qBCLhB,OACE,iCAAAC,EACA,qBAAAC,EACA,YAAAC,MAEK,4BAIA,IAAMC,EAAwD,CACnE,wBAAyB,gCAC3B,EAGA,eAAsBC,GAAkB,CACtC,IAAMC,EAAM,MAAMC,EAChB,SAAY,KAAM,QAAO,qBAAqB,CAChD,EAGA,OAAID,EAAI,QAAQ,QAGPA,EAAI,QAAQ,QAGdA,EAAI,OACb,CAbsBE,EAAAH,EAAA,mBAef,SAASI,GAAoB,CAKlC,IAAMC,EAAY,IAAI,IAEtB,OAAAA,EAAU,IAAIC,EAAS,SAAU,CAAE,QAASC,CAAkB,CAAC,EAExDF,CACT,CAVgBF,EAAAC,EAAA,qBAYhB,eAAsBI,GAAsD,CAC1E,IAAMC,EAAgB,MAAMT,EAAgB,EACtCU,EAAiBC,EAAkB,EACnCC,EAAS,MAAMH,EAAc,mBAAmB,CACpD,KAAMC,CACR,CAAC,EAED,GAAI,CAACE,EAAO,QACV,MAAM,IAAI,MAAMA,EAAO,QAAQ,KAAK,EAGtC,MAAO,CACL,SAAU,CAACA,EAAO,QAAQ,OAAO,EACjC,QAASL,EACT,eAAAG,CACF,CACF,CAhBsBP,EAAAK,EAAA,uBAsBf,IAAMK,EAAaV,EAACW,GAAkB,CAC3C,IAAMC,EAAc,OAAO,CAAC,EAE5B,OAAO,OAAOD,CAAK,EAAIC,EACnB,KAAK,OAAOD,CAAK,EAAE,SAFN,EAEuB,CAAC,GACrC,KACN,EAN0B,cAQbE,EAAoCb,EAC/Cc,GACIA,GAAQ,CAACA,EAAK,WAAW,IAAI,EAAI,KAAOA,EAAOA,EAFJ",
6
+ "names": ["derivationPath", "setDerivationPath", "path", "__name", "getDerivationPath", "dynamicImportWithRefinedError", "ETHEREUM_CHAIN_ID", "Networks", "trezorErrorMessages", "getTrezorModule", "mod", "dynamicImportWithRefinedError", "__name", "getTrezorInstance", "instances", "Networks", "ETHEREUM_CHAIN_ID", "getEthereumAccounts", "TrezorConnect", "derivationPath", "getDerivationPath", "result", "valueToHex", "value", "ZERO_BIGINT", "getTrezorNormalizedDerivationPath", "path"]
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { ProviderMetadata } from '@hub3js/core';
2
+ import { WalletTypes } from '@rango-dev/wallets-shared';
3
+ export declare const WALLET_ID = WalletTypes.TREZOR;
4
+ export declare const metadata: ProviderMetadata;
@@ -0,0 +1,2 @@
1
+ import{a as p,c as u,d as P,e as h,h as t}from"./chunk-WO4Y4OWN.js";import{cleanEvmError as G}from"@rango-dev/signer-evm";import{DEFAULT_ETHEREUM_RPC_URL as z}from"@rango-dev/wallets-shared";import{JsonRpcProvider as S,Transaction as b}from"ethers";import"rango-types";function R(r){return typeof r=="object"&&r!==null&&"shortMessage"in r&&typeof r.shortMessage=="string"?new Error(r.shortMessage,{cause:r}):G(r)}p(R,"getTrezorErrorMessage");var f=class{static{p(this,"EthereumSigner")}async signMessage(e){let n=await h(),{success:o,payload:s}=await n.ethereumSignMessage({message:e,path:u()});if(!o)throw new Error(s.error);return s.signature}async signAndSendTx(e,n,o){try{let s=await h(),{gasPrice:w,maxFeePerGas:i,maxPriorityFeePerGas:c}=e,a=i&&c;if(a&&!i)throw new Error("Missing maxFeePerGas");if(a&&!c)throw new Error("Missing maxPriorityFeePerGas");if(!a&&!w)throw new Error("Missing gasPrice");let d=new S(z),l=await d.getTransactionCount(n),E=a?{maxFeePerGas:t(i||"0"),maxPriorityFeePerGas:t(c||"0")}:{gasPrice:t(w||"0")},g={to:e.to,data:e.data||"0x",value:t(e.value?.toString()||"0"),gasLimit:t(e.gasLimit?.toString()||"0"),chainId:Number.parseInt(o),nonce:t(l.toString()),...E},{success:T,payload:m}=await s.ethereumSignTransaction({path:u(),transaction:g});if(!T){let F=P[m?.code||""]||m.error;throw new Error(F)}let{r:y,s:M,v}=m,x=b.from({...g,nonce:Number.parseInt(g.nonce),type:a?2:0,signature:{r:y,s:M,v:parseInt(v)}}).serialized;return{hash:(await d.broadcastTransaction(x)).hash}}catch(s){throw R(s)}}};export{f as EthereumSigner,R as getTrezorErrorMessage};
2
+ //# sourceMappingURL=ethereum-EMJ4SXYX.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/signers/ethereum.ts"],
4
+ "sourcesContent": ["import type { EvmTransaction } from 'rango-types/mainApi';\n\nimport { cleanEvmError } from '@rango-dev/signer-evm';\nimport { DEFAULT_ETHEREUM_RPC_URL } from '@rango-dev/wallets-shared';\nimport { JsonRpcProvider, Transaction } from 'ethers';\nimport { type GenericSigner } from 'rango-types';\n\nimport {\n getTrezorModule,\n trezorErrorMessages,\n valueToHex,\n} from '../legacy/helpers.js';\nimport { getDerivationPath } from '../state.js';\n\nexport function getTrezorErrorMessage(error: unknown) {\n if (\n typeof error === 'object' &&\n error !== null &&\n 'shortMessage' in error &&\n typeof error.shortMessage === 'string'\n ) {\n /*\n * Some error signs have lengthy, challenging-to-read messages.\n * shortMessage is used because it is shorter and easier to understand.\n */\n return new Error(error.shortMessage, { cause: error });\n }\n return cleanEvmError(error);\n}\n\nexport class EthereumSigner implements GenericSigner<EvmTransaction> {\n async signMessage(msg: string): Promise<string> {\n const TrezorConnect = await getTrezorModule();\n\n const { success, payload } = await TrezorConnect.ethereumSignMessage({\n message: msg,\n path: getDerivationPath(),\n });\n if (!success) {\n throw new Error(payload.error);\n }\n return payload.signature;\n }\n\n async signAndSendTx(\n tx: EvmTransaction,\n fromAddress: string,\n chainId: string\n ): Promise<{ hash: string }> {\n try {\n const TrezorConnect = await getTrezorModule();\n const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = tx;\n const isEIP1559 = maxFeePerGas && maxPriorityFeePerGas;\n\n if (isEIP1559 && !maxFeePerGas) {\n throw new Error('Missing maxFeePerGas');\n }\n if (isEIP1559 && !maxPriorityFeePerGas) {\n throw new Error('Missing maxPriorityFeePerGas');\n }\n if (!isEIP1559 && !gasPrice) {\n throw new Error('Missing gasPrice');\n }\n const provider = new JsonRpcProvider(DEFAULT_ETHEREUM_RPC_URL); // Provider to broadcast transaction\n const transactionCount = await provider.getTransactionCount(fromAddress); // Get nonce\n const additionalFields = isEIP1559\n ? {\n maxFeePerGas: valueToHex(maxFeePerGas || '0'),\n maxPriorityFeePerGas: valueToHex(maxPriorityFeePerGas || '0'),\n }\n : {\n gasPrice: valueToHex(gasPrice || '0'),\n };\n\n const transaction = {\n to: tx.to,\n data: tx.data || '0x',\n value: valueToHex(tx.value?.toString() || '0'),\n gasLimit: valueToHex(tx.gasLimit?.toString() || '0'),\n chainId: Number.parseInt(chainId),\n nonce: valueToHex(transactionCount.toString()),\n ...additionalFields,\n };\n\n const { success, payload } = await TrezorConnect.ethereumSignTransaction({\n path: getDerivationPath(),\n transaction,\n });\n\n if (!success) {\n const errorMessage =\n trezorErrorMessages[payload?.code || ''] || payload.error;\n throw new Error(errorMessage);\n }\n const { r, s, v } = payload;\n\n const serializedTx = Transaction.from({\n ...transaction,\n nonce: Number.parseInt(transaction.nonce),\n /*\n * Type 0: This refers to the legacy transaction type that has been used since Ethereum's inception.\n * Type 2: This refers to the new transaction type introduced with the EIP-1559 (Ethereum Improvement Proposal 1559) update,\n * which was part of the London hard fork.\n */\n type: isEIP1559 ? 2 : 0,\n signature: { r, s, v: parseInt(v) },\n }).serialized;\n const broadcastResult = await provider.broadcastTransaction(serializedTx);\n\n return { hash: broadcastResult.hash };\n } catch (error) {\n throw getTrezorErrorMessage(error);\n }\n }\n}\n"],
5
+ "mappings": "oEAEA,OAAS,iBAAAA,MAAqB,wBAC9B,OAAS,4BAAAC,MAAgC,4BACzC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,SAC7C,MAAmC,cAS5B,SAASC,EAAsBC,EAAgB,CACpD,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,iBAAkBA,GAClB,OAAOA,EAAM,cAAiB,SAMvB,IAAI,MAAMA,EAAM,aAAc,CAAE,MAAOA,CAAM,CAAC,EAEhDC,EAAcD,CAAK,CAC5B,CAdgBE,EAAAH,EAAA,yBAgBT,IAAMI,EAAN,KAA8D,CA9BrE,MA8BqE,CAAAD,EAAA,uBACnE,MAAM,YAAYE,EAA8B,CAC9C,IAAMC,EAAgB,MAAMC,EAAgB,EAEtC,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,MAAMH,EAAc,oBAAoB,CACnE,QAASD,EACT,KAAMK,EAAkB,CAC1B,CAAC,EACD,GAAI,CAACF,EACH,MAAM,IAAI,MAAMC,EAAQ,KAAK,EAE/B,OAAOA,EAAQ,SACjB,CAEA,MAAM,cACJE,EACAC,EACAC,EAC2B,CAC3B,GAAI,CACF,IAAMP,EAAgB,MAAMC,EAAgB,EACtC,CAAE,SAAAO,EAAU,aAAAC,EAAc,qBAAAC,CAAqB,EAAIL,EACnDM,EAAYF,GAAgBC,EAElC,GAAIC,GAAa,CAACF,EAChB,MAAM,IAAI,MAAM,sBAAsB,EAExC,GAAIE,GAAa,CAACD,EAChB,MAAM,IAAI,MAAM,8BAA8B,EAEhD,GAAI,CAACC,GAAa,CAACH,EACjB,MAAM,IAAI,MAAM,kBAAkB,EAEpC,IAAMI,EAAW,IAAIC,EAAgBC,CAAwB,EACvDC,EAAmB,MAAMH,EAAS,oBAAoBN,CAAW,EACjEU,EAAmBL,EACrB,CACE,aAAcM,EAAWR,GAAgB,GAAG,EAC5C,qBAAsBQ,EAAWP,GAAwB,GAAG,CAC9D,EACA,CACE,SAAUO,EAAWT,GAAY,GAAG,CACtC,EAEEU,EAAc,CAClB,GAAIb,EAAG,GACP,KAAMA,EAAG,MAAQ,KACjB,MAAOY,EAAWZ,EAAG,OAAO,SAAS,GAAK,GAAG,EAC7C,SAAUY,EAAWZ,EAAG,UAAU,SAAS,GAAK,GAAG,EACnD,QAAS,OAAO,SAASE,CAAO,EAChC,MAAOU,EAAWF,EAAiB,SAAS,CAAC,EAC7C,GAAGC,CACL,EAEM,CAAE,QAAAd,EAAS,QAAAC,CAAQ,EAAI,MAAMH,EAAc,wBAAwB,CACvE,KAAMI,EAAkB,EACxB,YAAAc,CACF,CAAC,EAED,GAAI,CAAChB,EAAS,CACZ,IAAMiB,EACJC,EAAoBjB,GAAS,MAAQ,EAAE,GAAKA,EAAQ,MACtD,MAAM,IAAI,MAAMgB,CAAY,CAC9B,CACA,GAAM,CAAE,EAAAE,EAAG,EAAAC,EAAG,CAAE,EAAInB,EAEdoB,EAAeC,EAAY,KAAK,CACpC,GAAGN,EACH,MAAO,OAAO,SAASA,EAAY,KAAK,EAMxC,KAAMP,EAAY,EAAI,EACtB,UAAW,CAAE,EAAAU,EAAG,EAAAC,EAAG,EAAG,SAAS,CAAC,CAAE,CACpC,CAAC,EAAE,WAGH,MAAO,CAAE,MAFe,MAAMV,EAAS,qBAAqBW,CAAY,GAEzC,IAAK,CACtC,OAAS5B,EAAO,CACd,MAAMD,EAAsBC,CAAK,CACnC,CACF,CACF",
6
+ "names": ["cleanEvmError", "DEFAULT_ETHEREUM_RPC_URL", "JsonRpcProvider", "Transaction", "getTrezorErrorMessage", "error", "cleanEvmError", "__name", "EthereumSigner", "msg", "TrezorConnect", "getTrezorModule", "success", "payload", "getDerivationPath", "tx", "fromAddress", "chainId", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "isEIP1559", "provider", "JsonRpcProvider", "DEFAULT_ETHEREUM_RPC_URL", "transactionCount", "additionalFields", "valueToHex", "transaction", "errorMessage", "trezorErrorMessages", "r", "s", "serializedTx", "Transaction"]
7
+ }
@@ -4,7 +4,7 @@ export declare const trezorErrorMessages: {
4
4
  [statusCode: string]: string;
5
5
  };
6
6
  export declare function getTrezorModule(): Promise<TrezorConnect | (Omit<TrezorConnect, "init"> & {
7
- init: import("@trezor/connect/lib/types/api/init.js").InitType<import("@trezor/connect").ConnectSettingsWeb>;
7
+ init: import("@trezor/connect/lib/types/api/init").InitType<import("@trezor/connect").ConnectSettingsWeb>;
8
8
  } & {
9
9
  renderWebUSBButton: (className?: string) => void;
10
10
  disableWebUSB: () => void;
@@ -1,4 +1,5 @@
1
- import type { Environments } from './types.js';
1
+ import type { Environments } from '../types.js';
2
+ import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
2
3
  import type { Connect, WalletInfo } from '@rango-dev/wallets-shared';
3
4
  import { WalletTypes } from '@rango-dev/wallets-shared';
4
5
  import { type BlockchainMeta, type SignerFactory } from 'rango-types';
@@ -13,3 +14,5 @@ export declare const getInstance: typeof getTrezorInstance;
13
14
  export declare const connect: Connect;
14
15
  export declare const getSigners: (provider: Provider) => Promise<SignerFactory>;
15
16
  export declare const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo;
17
+ declare const buildLegacyProvider: () => LegacyProviderInterface;
18
+ export { buildLegacyProvider };
package/dist/mod.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const versions: () => readonly [readonly ["0.0.0", import("@rango-dev/wallets-core/legacy").LegacyProviderInterface], readonly ["1.0.0", import("@hub3js/core").Provider<Record<"evm", import("@hub3js/evm").EvmActions>>]];
2
+ export { versions };
package/dist/mod.js ADDED
@@ -0,0 +1,2 @@
1
+ import{a as o,b as s,e as c,f as d,g as m,i as l}from"./chunk-WO4Y4OWN.js";import{defineVersions as j}from"@hub3js/core/utils";import{Networks as f,WalletTypes as L}from"@rango-dev/wallets-shared";import"rango-types";import{dynamicImportWithRefinedError as z}from"@rango-dev/wallets-shared";import{DefaultSignerFactory as b,TransactionType as x}from"rango-types";async function i(){let e=new b,{EthereumSigner:r}=await z(async()=>await import("./ethereum-EMJ4SXYX.js"));return e.registerSigner(x.EVM,new r),e}o(i,"getSigners");var I={appUrl:"",email:""},D={type:L.TREZOR};var k=d,g=!1,A=o(async({namespaces:e})=>{let r=[],n=await c(),t=e?.find(a=>a.namespace==="EVM");if(t)if(t.derivationPath){s(l(t.derivationPath)),g||(await n.init({lazyLoad:!0,manifest:I}),g=!0);let a=await m();r.push(a)}else throw new Error("Derivation Path can not be empty.");else throw new Error(`It appears that you have selected a namespace that is not yet supported by our system. Your namespaces: ${e?.map(a=>a.namespace)}`);return r},"connect"),C=i,S=o(e=>{let r=[],n=e.find(t=>t.name===f.ETHEREUM);return n&&r.push(n),{name:"Trezor",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/trezor/icon.svg",installLink:{DEFAULT:"https://trezor.io/learn/a/download-verify-trezor-suite"},color:"black",supportedChains:r,showOnMobile:!1,needsNamespace:{selection:"single",data:[{id:"ETH",value:"EVM",label:"Ethereum",getSupportedChains:t=>t.filter(a=>a.name===f.ETHEREUM)}]},needsDerivationPath:{data:[{id:"metamask",label:"Metamask (m/44'/60'/0'/0/index)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/0'/0/${t}`},{id:"ledgerLive",label:"LedgerLive (m/44'/60'/index'/0/0)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/${t}'/0/0`},{id:"legacy",label:"Legacy (m/44'/60'/0'/index)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/0'/${t}`}]}}},"getWalletInfo"),u=o(()=>({config:D,getInstance:k,connect:A,getSigners:C,getWalletInfo:S}),"buildLegacyProvider");import{ProviderBuilder as U}from"@hub3js/core";import{Networks as B,WalletTypes as V}from"@rango-dev/wallets-shared";import"rango-types";var p=V.TREZOR,v={name:"Trezor",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/trezor/icon.svg",extensions:{homepage:"https://trezor.io/learn/a/download-verify-trezor-suite"},properties:[{name:"namespaces",value:{selection:"single",data:[{label:"Ethereum",value:"EVM",id:"ETH",getSupportedChains:e=>e.filter(r=>r.name===B.ETHEREUM)}]}},{name:"derivationPath",value:{data:[{id:"metamask",label:"Metamask (m/44'/60'/0'/0/index)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/0'/0/${e}`},{id:"ledgerLive",label:"LedgerLive (m/44'/60'/index'/0/0)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/${e}'/0/0`},{id:"legacy",label:"Legacy (m/44'/60'/0'/index)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/0'/${e}`}]}},{name:"signers",value:{getSigners:async()=>i()}}]};import{NamespaceBuilder as R}from"@hub3js/core";import{builders as E,utils as W}from"@hub3js/evm";import*as y from"@hub3js/std/builders";import{standardizeAndThrowError as N}from"@hub3js/std/operators";import{ETHEREUM_CHAIN_ID as H}from"@rango-dev/wallets-shared";var h=!1,_=E.connect().action(async function(e,r,n){if(!n?.derivationPath)throw new Error("Derivation Path can not be empty.");s(l(n.derivationPath)),h||(await(await c()).init({lazyLoad:!0,manifest:P()}),h=!0);let t=await m();return{accounts:W.formatAccountsToCAIP(t.accounts,t.chainId),network:t.chainId}}).or(N).build(),$=y.disconnect().build(),F=E.getChainId().action(()=>H).build(),T=new R("EVM",p).action(_).action($).action(F).build();var w,P=o(()=>w,"getTrezorManifest"),M=o(()=>new U(p).init(function(e,r){let[,n]=e.state();if(!r.manifest)throw new Error("Trezor manifest is required");w=r.manifest,n("installed",!0),console.debug("[trezor] instance detected.",e)}).config("metadata",v).add("evm",T).build(),"buildProvider");var ze=o(()=>j().version("0.0.0",u()).version("1.0.0",M()).build(),"versions");export{ze as versions};
2
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/mod.ts", "../src/legacy/index.ts", "../src/signer.ts", "../src/provider.ts", "../src/constants.ts", "../src/namespaces/evm.ts"],
4
+ "sourcesContent": ["import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildLegacyProvider } from './legacy/index.js';\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions()\n .version('0.0.0', buildLegacyProvider())\n .version('1.0.0', buildProvider())\n .build();\n\nexport { versions };\n", "import type { Environments } from '../types.js';\nimport type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';\nimport type {\n Connect,\n ProviderConnectResult,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\n\nimport { Networks, WalletTypes } from '@rango-dev/wallets-shared';\nimport { type BlockchainMeta, type SignerFactory } from 'rango-types';\n\nimport signer from '../signer.js';\nimport { setDerivationPath } from '../state.js';\n\nimport {\n getEthereumAccounts,\n getTrezorInstance,\n getTrezorModule,\n getTrezorNormalizedDerivationPath,\n} from './helpers.js';\n\nlet trezorManifest: Environments['manifest'] = {\n appUrl: '',\n email: '',\n};\nexport const config = {\n type: WalletTypes.TREZOR,\n};\n\nexport type { Environments };\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Provider = any;\n\nexport const init = (environments: Environments) => {\n trezorManifest = environments.manifest;\n};\n\nexport const getInstance = getTrezorInstance;\n\nlet isTrezorInitialized = false;\nexport const connect: Connect = async ({ namespaces }) => {\n const results: ProviderConnectResult[] = [];\n\n const TrezorConnect = await getTrezorModule();\n\n const evmNamespace = namespaces?.find(\n (namespaceItem) => namespaceItem.namespace === 'EVM'\n );\n\n if (evmNamespace) {\n if (evmNamespace.derivationPath) {\n setDerivationPath(\n getTrezorNormalizedDerivationPath(evmNamespace.derivationPath)\n );\n\n if (!isTrezorInitialized) {\n await TrezorConnect.init({\n lazyLoad: true, // this param will prevent iframe injection until TrezorConnect.method will be called\n manifest: trezorManifest,\n });\n\n isTrezorInitialized = true;\n }\n\n const accounts = await getEthereumAccounts();\n results.push(accounts);\n } else {\n throw new Error('Derivation Path can not be empty.');\n }\n } else {\n throw new Error(\n `It appears that you have selected a namespace that is not yet supported by our system. Your namespaces: ${namespaces?.map(\n (namespaceItem) => namespaceItem.namespace\n )}`\n );\n }\n\n return results;\n};\n\nexport const getSigners: (provider: Provider) => Promise<SignerFactory> =\n signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const supportedChains: BlockchainMeta[] = [];\n\n const ethereumBlockchain = allBlockChains.find(\n (chain) => chain.name === Networks.ETHEREUM\n );\n if (ethereumBlockchain) {\n supportedChains.push(ethereumBlockchain);\n }\n\n return {\n name: 'Trezor',\n img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/trezor/icon.svg',\n installLink: {\n DEFAULT: 'https://trezor.io/learn/a/download-verify-trezor-suite',\n },\n color: 'black',\n supportedChains,\n showOnMobile: false,\n\n needsNamespace: {\n selection: 'single',\n data: [\n {\n id: 'ETH',\n value: 'EVM',\n label: 'Ethereum',\n getSupportedChains: (allBlockchains: BlockchainMeta[]) =>\n allBlockchains.filter((chain) => chain.name === Networks.ETHEREUM),\n },\n ],\n },\n needsDerivationPath: {\n data: [\n {\n id: 'metamask',\n label: `Metamask (m/44'/60'/0'/0/index)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/0'/0/${index}`,\n },\n {\n id: 'ledgerLive',\n label: `LedgerLive (m/44'/60'/index'/0/0)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/${index}'/0/0`,\n },\n {\n id: 'legacy',\n label: `Legacy (m/44'/60'/0'/index)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/0'/${index}`,\n },\n ],\n },\n };\n};\n\nconst buildLegacyProvider: () => LegacyProviderInterface = () => ({\n config,\n getInstance,\n connect,\n getSigners,\n getWalletInfo,\n});\n\nexport { buildLegacyProvider };\n", "import type { SignerFactory } from 'rango-types';\n\nimport { dynamicImportWithRefinedError } from '@rango-dev/wallets-shared';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default async function getSigners(): Promise<SignerFactory> {\n const signers = new DefaultSignerFactory();\n const { EthereumSigner } = await dynamicImportWithRefinedError(\n async () => await import('./signers/ethereum.js')\n );\n signers.registerSigner(TxType.EVM, new EthereumSigner());\n return signers;\n}\n", "import type { Environments } from './types.js';\n\nimport { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\n\nlet trezorManifest: Environments['manifest'];\n\nexport const getTrezorManifest = () => trezorManifest;\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context, environments: Environments) {\n const [, setState] = context.state();\n\n if (!environments.manifest) {\n throw new Error('Trezor manifest is required');\n }\n\n trezorManifest = environments.manifest;\n setState('installed', true);\n console.debug('[trezor] instance detected.', context);\n })\n .config('metadata', metadata)\n .add('evm', evm)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport { Networks, WalletTypes } from '@rango-dev/wallets-shared';\nimport { type BlockchainMeta } from 'rango-types';\n\nimport getSigners from './signer.js';\n\nexport const WALLET_ID = WalletTypes.TREZOR;\n\nexport const metadata: ProviderMetadata = {\n name: 'Trezor',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/trezor/icon.svg',\n extensions: {\n homepage: 'https://trezor.io/learn/a/download-verify-trezor-suite',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n selection: 'single',\n data: [\n {\n label: 'Ethereum',\n value: 'EVM',\n id: 'ETH',\n getSupportedChains: (allBlockchains: BlockchainMeta[]) =>\n allBlockchains.filter(\n (chain) => chain.name === Networks.ETHEREUM\n ),\n },\n ],\n },\n },\n {\n name: 'derivationPath',\n value: {\n data: [\n {\n id: 'metamask',\n label: `Metamask (m/44'/60'/0'/0/index)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/0'/0/${index}`,\n },\n {\n id: 'ledgerLive',\n label: `LedgerLive (m/44'/60'/index'/0/0)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/${index}'/0/0`,\n },\n {\n id: 'legacy',\n label: `Legacy (m/44'/60'/0'/index)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/0'/${index}`,\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners() },\n },\n ],\n};\n", "import type { EvmActions } from '@hub3js/evm';\n\nimport { NamespaceBuilder } from '@hub3js/core';\nimport { builders, utils } from '@hub3js/evm';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport { ETHEREUM_CHAIN_ID } from '@rango-dev/wallets-shared';\n\nimport { WALLET_ID } from '../constants.js';\nimport {\n getEthereumAccounts,\n getTrezorModule,\n getTrezorNormalizedDerivationPath,\n} from '../legacy/helpers.js';\nimport { getTrezorManifest } from '../provider.js';\nimport { setDerivationPath } from '../state.js';\n\nlet isTrezorInitialized = false;\n\nconst connect = builders\n .connect()\n .action(async function (_context, _chain, options) {\n if (!options?.derivationPath) {\n throw new Error('Derivation Path can not be empty.');\n }\n setDerivationPath(\n getTrezorNormalizedDerivationPath(options.derivationPath)\n );\n\n if (!isTrezorInitialized) {\n const TrezorConnect = await getTrezorModule();\n await TrezorConnect.init({\n lazyLoad: true, // this param will prevent iframe injection until TrezorConnect.method will be called\n manifest: getTrezorManifest(),\n });\n isTrezorInitialized = true;\n }\n\n const result = await getEthereumAccounts();\n\n const formatAccounts = utils.formatAccountsToCAIP(\n result.accounts,\n result.chainId\n );\n\n return {\n accounts: formatAccounts,\n network: result.chainId,\n };\n })\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders.disconnect<EvmActions>().build();\n\nconst getChainId = builders\n .getChainId()\n .action(() => ETHEREUM_CHAIN_ID)\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(getChainId)\n .build();\n\nexport { evm };\n"],
5
+ "mappings": "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",
6
+ "names": ["defineVersions", "Networks", "WalletTypes", "dynamicImportWithRefinedError", "DefaultSignerFactory", "TxType", "getSigners", "signers", "DefaultSignerFactory", "EthereumSigner", "dynamicImportWithRefinedError", "TxType", "__name", "trezorManifest", "config", "WalletTypes", "getInstance", "getTrezorInstance", "isTrezorInitialized", "connect", "__name", "namespaces", "results", "TrezorConnect", "getTrezorModule", "evmNamespace", "namespaceItem", "setDerivationPath", "getTrezorNormalizedDerivationPath", "trezorManifest", "accounts", "getEthereumAccounts", "getSigners", "getWalletInfo", "allBlockChains", "supportedChains", "ethereumBlockchain", "chain", "Networks", "allBlockchains", "index", "buildLegacyProvider", "config", "ProviderBuilder", "Networks", "WalletTypes", "WALLET_ID", "WalletTypes", "metadata", "allBlockchains", "chain", "Networks", "index", "getSigners", "NamespaceBuilder", "builders", "utils", "commonBuilders", "standardizeAndThrowError", "ETHEREUM_CHAIN_ID", "isTrezorInitialized", "connect", "builders", "_context", "_chain", "options", "setDerivationPath", "getTrezorNormalizedDerivationPath", "getTrezorModule", "getTrezorManifest", "result", "getEthereumAccounts", "utils", "standardizeAndThrowError", "disconnect", "getChainId", "ETHEREUM_CHAIN_ID", "evm", "NamespaceBuilder", "WALLET_ID", "trezorManifest", "getTrezorManifest", "__name", "buildProvider", "ProviderBuilder", "WALLET_ID", "context", "environments", "setState", "metadata", "evm", "versions", "__name", "defineVersions", "buildLegacyProvider", "buildProvider"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { EvmActions } from '@hub3js/evm';
2
+ declare const evm: import("@hub3js/core").ProxiedNamespace<EvmActions>;
3
+ export { evm };
@@ -1 +1 @@
1
- {"inputs":{"src/state.ts":{"bytes":290,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":2433,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"src/state.ts","kind":"import-statement","original":"./state.js"},{"path":"@trezor/connect-web","kind":"dynamic-import","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/ethereum.ts":{"bytes":3696,"imports":[{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"ethers","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":526,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/signers/ethereum.ts","kind":"dynamic-import","original":"./signers/ethereum.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":4182,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/signer.ts","kind":"import-statement","original":"./signer.js"},{"path":"src/state.ts","kind":"import-statement","original":"./state.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":7387},"dist/index.js":{"imports":[{"path":"dist/chunk-EWAGIH74.js","kind":"import-statement"},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"dist/ethereum-ZQ7ZTGPY.js","kind":"dynamic-import"}],"exports":["config","connect","getInstance","getSigners","getWalletInfo","init"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1697},"src/signer.ts":{"bytesInOutput":310}},"bytes":2212},"dist/ethereum-ZQ7ZTGPY.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6222},"dist/ethereum-ZQ7ZTGPY.js":{"imports":[{"path":"dist/chunk-EWAGIH74.js","kind":"import-statement"},{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"ethers","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"exports":["EthereumSigner","getTrezorErrorMessage"],"entryPoint":"src/signers/ethereum.ts","inputs":{"src/signers/ethereum.ts":{"bytesInOutput":1391}},"bytes":1561},"dist/chunk-EWAGIH74.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4399},"dist/chunk-EWAGIH74.js":{"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@trezor/connect-web","kind":"dynamic-import","external":true}],"exports":["a","b","c","d","e","f","g","h","i"],"inputs":{"src/state.ts":{"bytesInOutput":99},"src/helpers.ts":{"bytesInOutput":814}},"bytes":1107}}}
1
+ {"inputs":{"src/state.ts":{"bytes":290,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/helpers.ts":{"bytes":2431,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"src/state.ts","kind":"import-statement","original":"../state"},{"path":"@trezor/connect-web","kind":"dynamic-import","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/ethereum.ts":{"bytes":3820,"imports":[{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"ethers","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"../legacy/helpers.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":526,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/signers/ethereum.ts","kind":"dynamic-import","original":"./signers/ethereum.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/index.ts":{"bytes":4024,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/signer.ts","kind":"import-statement","original":"../signer.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":1774,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/signer.ts","kind":"import-statement","original":"./signer.js"}],"format":"esm"},"src/namespaces/evm.ts":{"bytes":1843,"imports":[{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@hub3js/std/builders","kind":"import-statement","external":true},{"path":"@hub3js/std/operators","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"../legacy/helpers.js"},{"path":"src/provider.ts","kind":"import-statement","original":"../provider.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"}],"format":"esm"},"src/provider.ts":{"bytes":810,"imports":[{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/evm.ts","kind":"import-statement","original":"./namespaces/evm.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/mod.ts":{"bytes":321,"imports":[{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"path":"src/legacy/index.ts","kind":"import-statement","original":"./legacy/index.js"},{"path":"src/provider.ts","kind":"import-statement","original":"./provider.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":14876},"dist/mod.js":{"imports":[{"path":"dist/chunk-WO4Y4OWN.js","kind":"import-statement"},{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"dist/ethereum-EMJ4SXYX.js","kind":"dynamic-import"},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@hub3js/std/builders","kind":"import-statement","external":true},{"path":"@hub3js/std/operators","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true}],"exports":["versions"],"entryPoint":"src/mod.ts","inputs":{"src/mod.ts":{"bytesInOutput":131},"src/legacy/index.ts":{"bytesInOutput":1528},"src/signer.ts":{"bytesInOutput":310},"src/provider.ts":{"bytesInOutput":339},"src/constants.ts":{"bytesInOutput":894},"src/namespaces/evm.ts":{"bytesInOutput":705}},"bytes":4038},"dist/ethereum-EMJ4SXYX.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6395},"dist/ethereum-EMJ4SXYX.js":{"imports":[{"path":"dist/chunk-WO4Y4OWN.js","kind":"import-statement"},{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"ethers","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"exports":["EthereumSigner","getTrezorErrorMessage"],"entryPoint":"src/signers/ethereum.ts","inputs":{"src/signers/ethereum.ts":{"bytesInOutput":1455}},"bytes":1625},"dist/chunk-WO4Y4OWN.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4404},"dist/chunk-WO4Y4OWN.js":{"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@trezor/connect-web","kind":"dynamic-import","external":true}],"exports":["a","b","c","d","e","f","g","h","i"],"inputs":{"src/state.ts":{"bytesInOutput":99},"src/legacy/helpers.ts":{"bytesInOutput":814}},"bytes":1107}}}
@@ -0,0 +1,6 @@
1
+ export declare const getTrezorManifest: () => {
2
+ appUrl: string;
3
+ email: string;
4
+ };
5
+ declare const buildProvider: () => import("@hub3js/core").Provider<Record<"evm", import("@hub3js/evm").EvmActions>>;
6
+ export { buildProvider };
@@ -1,6 +1,6 @@
1
1
  import type { EvmTransaction } from 'rango-types/mainApi';
2
2
  import { type GenericSigner } from 'rango-types';
3
- export declare function getTrezorErrorMessage(error: any): Error;
3
+ export declare function getTrezorErrorMessage(error: unknown): Error;
4
4
  export declare class EthereumSigner implements GenericSigner<EvmTransaction> {
5
5
  signMessage(msg: string): Promise<string>;
6
6
  signAndSendTx(tx: EvmTransaction, fromAddress: string, chainId: string): Promise<{
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@rango-dev/provider-trezor",
3
- "version": "0.27.1-next.3",
3
+ "version": "0.27.1-next.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "source": "./src/index.ts",
7
- "main": "./dist/index.js",
6
+ "source": "./src/mod.ts",
7
+ "main": "./dist/mod.js",
8
8
  "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "default": "./dist/index.js"
12
- }
9
+ ".": "./dist/mod.js"
13
10
  },
14
- "typings": "dist/index.d.ts",
11
+ "typings": "dist/mod.d.ts",
15
12
  "files": [
16
13
  "dist",
17
14
  "src"
18
15
  ],
19
16
  "scripts": {
20
- "build": "node ../../scripts/build/command.mjs --path wallets/provider-trezor --splitting",
17
+ "build": "node ../../scripts/build/command.mjs --path wallets/provider-trezor --splitting --inputs src/mod.ts",
21
18
  "ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
22
19
  "clean": "rimraf dist",
23
20
  "format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
@@ -33,4 +30,4 @@
33
30
  "publishConfig": {
34
31
  "access": "public"
35
32
  }
36
- }
33
+ }
package/readme.md CHANGED
@@ -1 +1,26 @@
1
- # @rango-dev/provider-trezor
1
+ # Trezor
2
+
3
+ Trezor integration for hub.
4
+ [Homepage](https://trezor.io//) | [Docs](https://docs.trezor.io/trezor-suite/)
5
+
6
+ ## Implementation notes/limitations
7
+
8
+ ### Group
9
+
10
+ #### ⚠️ EVM
11
+
12
+ We only support Ethereum for now.
13
+
14
+ ### Feature
15
+
16
+ #### ❌ Switch Account
17
+
18
+ Switch account is not supported. Users must choose the account via derivation path when connecting.
19
+
20
+ #### ❌ Auto Connect
21
+
22
+ Auto-connect is not supported. Trezor requires explicit user interaction (device unlock, permissions, and address export), and the integration does not implement silent eager connect (`canEagerConnect`). The derivation path must also be selected at connect time and is not restored automatically on reload.
23
+
24
+ ---
25
+
26
+ More wallet information can be found in [readme.md](../readme.md).
@@ -0,0 +1,64 @@
1
+ import type { ProviderMetadata } from '@hub3js/core';
2
+
3
+ import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
4
+ import { type BlockchainMeta } from 'rango-types';
5
+
6
+ import getSigners from './signer.js';
7
+
8
+ export const WALLET_ID = WalletTypes.TREZOR;
9
+
10
+ export const metadata: ProviderMetadata = {
11
+ name: 'Trezor',
12
+ icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/trezor/icon.svg',
13
+ extensions: {
14
+ homepage: 'https://trezor.io/learn/a/download-verify-trezor-suite',
15
+ },
16
+ properties: [
17
+ {
18
+ name: 'namespaces',
19
+ value: {
20
+ selection: 'single',
21
+ data: [
22
+ {
23
+ label: 'Ethereum',
24
+ value: 'EVM',
25
+ id: 'ETH',
26
+ getSupportedChains: (allBlockchains: BlockchainMeta[]) =>
27
+ allBlockchains.filter(
28
+ (chain) => chain.name === Networks.ETHEREUM
29
+ ),
30
+ },
31
+ ],
32
+ },
33
+ },
34
+ {
35
+ name: 'derivationPath',
36
+ value: {
37
+ data: [
38
+ {
39
+ id: 'metamask',
40
+ label: `Metamask (m/44'/60'/0'/0/index)`,
41
+ namespace: 'EVM',
42
+ generateDerivationPath: (index: string) => `44'/60'/0'/0/${index}`,
43
+ },
44
+ {
45
+ id: 'ledgerLive',
46
+ label: `LedgerLive (m/44'/60'/index'/0/0)`,
47
+ namespace: 'EVM',
48
+ generateDerivationPath: (index: string) => `44'/60'/${index}'/0/0`,
49
+ },
50
+ {
51
+ id: 'legacy',
52
+ label: `Legacy (m/44'/60'/0'/index)`,
53
+ namespace: 'EVM',
54
+ generateDerivationPath: (index: string) => `44'/60'/0'/${index}`,
55
+ },
56
+ ],
57
+ },
58
+ },
59
+ {
60
+ name: 'signers',
61
+ value: { getSigners: async () => getSigners() },
62
+ },
63
+ ],
64
+ };
@@ -7,7 +7,7 @@ import {
7
7
  type ProviderConnectResult,
8
8
  } from '@rango-dev/wallets-shared';
9
9
 
10
- import { getDerivationPath } from './state.js';
10
+ import { getDerivationPath } from '../state';
11
11
 
12
12
  export const trezorErrorMessages: { [statusCode: string]: string } = {
13
13
  Failure_ActionCancelled: 'User rejected the transaction.',
@@ -1,4 +1,5 @@
1
- import type { Environments } from './types.js';
1
+ import type { Environments } from '../types.js';
2
+ import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
2
3
  import type {
3
4
  Connect,
4
5
  ProviderConnectResult,
@@ -8,14 +9,15 @@ import type {
8
9
  import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
9
10
  import { type BlockchainMeta, type SignerFactory } from 'rango-types';
10
11
 
12
+ import signer from '../signer.js';
13
+ import { setDerivationPath } from '../state.js';
14
+
11
15
  import {
12
16
  getEthereumAccounts,
13
17
  getTrezorInstance,
14
18
  getTrezorModule,
15
19
  getTrezorNormalizedDerivationPath,
16
20
  } from './helpers.js';
17
- import signer from './signer.js';
18
- import { setDerivationPath } from './state.js';
19
21
 
20
22
  let trezorManifest: Environments['manifest'] = {
21
23
  appUrl: '',
@@ -133,19 +135,17 @@ export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
133
135
  namespace: 'EVM',
134
136
  generateDerivationPath: (index: string) => `44'/60'/0'/${index}`,
135
137
  },
136
- {
137
- id: `(m/44'/501'/index')`,
138
- label: `(m/44'/501'/index')`,
139
- namespace: 'Solana',
140
- generateDerivationPath: (index: string) => `44'/501'/${index}'`,
141
- },
142
- {
143
- id: `(m/44'/501'/0'/index)`,
144
- label: `(m/44'/501'/0'/index)`,
145
- namespace: 'Solana',
146
- generateDerivationPath: (index: string) => `44'/501'/0'/${index}`,
147
- },
148
138
  ],
149
139
  },
150
140
  };
151
141
  };
142
+
143
+ const buildLegacyProvider: () => LegacyProviderInterface = () => ({
144
+ config,
145
+ getInstance,
146
+ connect,
147
+ getSigners,
148
+ getWalletInfo,
149
+ });
150
+
151
+ export { buildLegacyProvider };
package/src/mod.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineVersions } from '@hub3js/core/utils';
2
+
3
+ import { buildLegacyProvider } from './legacy/index.js';
4
+ import { buildProvider } from './provider.js';
5
+
6
+ const versions = () =>
7
+ defineVersions()
8
+ .version('0.0.0', buildLegacyProvider())
9
+ .version('1.0.0', buildProvider())
10
+ .build();
11
+
12
+ export { versions };
@@ -0,0 +1,67 @@
1
+ import type { EvmActions } from '@hub3js/evm';
2
+
3
+ import { NamespaceBuilder } from '@hub3js/core';
4
+ import { builders, utils } from '@hub3js/evm';
5
+ import * as commonBuilders from '@hub3js/std/builders';
6
+ import { standardizeAndThrowError } from '@hub3js/std/operators';
7
+ import { ETHEREUM_CHAIN_ID } from '@rango-dev/wallets-shared';
8
+
9
+ import { WALLET_ID } from '../constants.js';
10
+ import {
11
+ getEthereumAccounts,
12
+ getTrezorModule,
13
+ getTrezorNormalizedDerivationPath,
14
+ } from '../legacy/helpers.js';
15
+ import { getTrezorManifest } from '../provider.js';
16
+ import { setDerivationPath } from '../state.js';
17
+
18
+ let isTrezorInitialized = false;
19
+
20
+ const connect = builders
21
+ .connect()
22
+ .action(async function (_context, _chain, options) {
23
+ if (!options?.derivationPath) {
24
+ throw new Error('Derivation Path can not be empty.');
25
+ }
26
+ setDerivationPath(
27
+ getTrezorNormalizedDerivationPath(options.derivationPath)
28
+ );
29
+
30
+ if (!isTrezorInitialized) {
31
+ const TrezorConnect = await getTrezorModule();
32
+ await TrezorConnect.init({
33
+ lazyLoad: true, // this param will prevent iframe injection until TrezorConnect.method will be called
34
+ manifest: getTrezorManifest(),
35
+ });
36
+ isTrezorInitialized = true;
37
+ }
38
+
39
+ const result = await getEthereumAccounts();
40
+
41
+ const formatAccounts = utils.formatAccountsToCAIP(
42
+ result.accounts,
43
+ result.chainId
44
+ );
45
+
46
+ return {
47
+ accounts: formatAccounts,
48
+ network: result.chainId,
49
+ };
50
+ })
51
+ .or(standardizeAndThrowError)
52
+ .build();
53
+
54
+ const disconnect = commonBuilders.disconnect<EvmActions>().build();
55
+
56
+ const getChainId = builders
57
+ .getChainId()
58
+ .action(() => ETHEREUM_CHAIN_ID)
59
+ .build();
60
+
61
+ const evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)
62
+ .action(connect)
63
+ .action(disconnect)
64
+ .action(getChainId)
65
+ .build();
66
+
67
+ export { evm };
@@ -0,0 +1,29 @@
1
+ import type { Environments } from './types.js';
2
+
3
+ import { ProviderBuilder } from '@hub3js/core';
4
+
5
+ import { metadata, WALLET_ID } from './constants.js';
6
+ import { evm } from './namespaces/evm.js';
7
+
8
+ let trezorManifest: Environments['manifest'];
9
+
10
+ export const getTrezorManifest = () => trezorManifest;
11
+
12
+ const buildProvider = () =>
13
+ new ProviderBuilder(WALLET_ID)
14
+ .init(function (context, environments: Environments) {
15
+ const [, setState] = context.state();
16
+
17
+ if (!environments.manifest) {
18
+ throw new Error('Trezor manifest is required');
19
+ }
20
+
21
+ trezorManifest = environments.manifest;
22
+ setState('installed', true);
23
+ console.debug('[trezor] instance detected.', context);
24
+ })
25
+ .config('metadata', metadata)
26
+ .add('evm', evm)
27
+ .build();
28
+
29
+ export { buildProvider };
@@ -9,11 +9,16 @@ import {
9
9
  getTrezorModule,
10
10
  trezorErrorMessages,
11
11
  valueToHex,
12
- } from '../helpers.js';
12
+ } from '../legacy/helpers.js';
13
13
  import { getDerivationPath } from '../state.js';
14
14
 
15
- export function getTrezorErrorMessage(error: any) {
16
- if (error?.shortMessage) {
15
+ export function getTrezorErrorMessage(error: unknown) {
16
+ if (
17
+ typeof error === 'object' &&
18
+ error !== null &&
19
+ 'shortMessage' in error &&
20
+ typeof error.shortMessage === 'string'
21
+ ) {
17
22
  /*
18
23
  * Some error signs have lengthy, challenging-to-read messages.
19
24
  * shortMessage is used because it is shorter and easier to understand.
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/state.ts", "../src/helpers.ts"],
4
- "sourcesContent": ["// We keep derivationPath here because we need to maintain it for signing transactions after it is set in connect method\nlet derivationPath = '';\n\nexport function setDerivationPath(path: string) {\n derivationPath = path;\n}\n\nexport function getDerivationPath() {\n return derivationPath;\n}\n", "import type { TrezorConnect } from '@trezor/connect-web';\n\nimport {\n dynamicImportWithRefinedError,\n ETHEREUM_CHAIN_ID,\n Networks,\n type ProviderConnectResult,\n} from '@rango-dev/wallets-shared';\n\nimport { getDerivationPath } from './state.js';\n\nexport const trezorErrorMessages: { [statusCode: string]: string } = {\n Failure_ActionCancelled: 'User rejected the transaction.',\n};\n\n// `@trezor/connect-web` is commonjs, when we are importing it dynamically, it has some differences in different tooling. for example vite (you can check widget-examples), goes throw error. this is a workaround for solving this interop issue.\nexport async function getTrezorModule() {\n const mod = await dynamicImportWithRefinedError(\n async () => await import('@trezor/connect-web')\n );\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (mod.default.default) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return mod.default.default as unknown as TrezorConnect;\n }\n\n return mod.default;\n}\n\nexport function getTrezorInstance() {\n /*\n * Instances have a required property which is `chainId` and is using in swap execution.\n * Here we are setting it as Ethereum always since we are supporting only eth for now.\n */\n const instances = new Map();\n\n instances.set(Networks.ETHEREUM, { chainId: ETHEREUM_CHAIN_ID });\n\n return instances;\n}\n\nexport async function getEthereumAccounts(): Promise<ProviderConnectResult> {\n const TrezorConnect = await getTrezorModule();\n const derivationPath = getDerivationPath();\n const result = await TrezorConnect.ethereumGetAddress({\n path: derivationPath,\n });\n\n if (!result.success) {\n throw new Error(result.payload.error);\n }\n\n return {\n accounts: [result.payload.address],\n chainId: ETHEREUM_CHAIN_ID,\n derivationPath,\n };\n}\n\n/*\n * Using BigInt in the valueToHex function ensures that the function\n * can handle very large integer values that exceed the range of standard JavaScript number types.\n */\nexport const valueToHex = (value: string) => {\n const ZERO_BIGINT = BigInt(0);\n const HEX_BASE = 16;\n return BigInt(value) > ZERO_BIGINT\n ? `0x${BigInt(value).toString(HEX_BASE)}`\n : '0x0';\n};\n\nexport const getTrezorNormalizedDerivationPath = (\n path: string // TrezorConnect needs master node to be added to derivation path\n) => (path && !path.startsWith('m/') ? 'm/' + path : path);\n"],
5
- "mappings": "+EACA,IAAIA,EAAiB,GAEd,SAASC,EAAkBC,EAAc,CAC9CF,EAAiBE,CACnB,CAFgBC,EAAAF,EAAA,qBAIT,SAASG,GAAoB,CAClC,OAAOJ,CACT,CAFgBG,EAAAC,EAAA,qBCLhB,OACE,iCAAAC,EACA,qBAAAC,EACA,YAAAC,MAEK,4BAIA,IAAMC,EAAwD,CACnE,wBAAyB,gCAC3B,EAGA,eAAsBC,GAAkB,CACtC,IAAMC,EAAM,MAAMC,EAChB,SAAY,KAAM,QAAO,qBAAqB,CAChD,EAGA,OAAID,EAAI,QAAQ,QAGPA,EAAI,QAAQ,QAGdA,EAAI,OACb,CAbsBE,EAAAH,EAAA,mBAef,SAASI,GAAoB,CAKlC,IAAMC,EAAY,IAAI,IAEtB,OAAAA,EAAU,IAAIC,EAAS,SAAU,CAAE,QAASC,CAAkB,CAAC,EAExDF,CACT,CAVgBF,EAAAC,EAAA,qBAYhB,eAAsBI,GAAsD,CAC1E,IAAMC,EAAgB,MAAMT,EAAgB,EACtCU,EAAiBC,EAAkB,EACnCC,EAAS,MAAMH,EAAc,mBAAmB,CACpD,KAAMC,CACR,CAAC,EAED,GAAI,CAACE,EAAO,QACV,MAAM,IAAI,MAAMA,EAAO,QAAQ,KAAK,EAGtC,MAAO,CACL,SAAU,CAACA,EAAO,QAAQ,OAAO,EACjC,QAASL,EACT,eAAAG,CACF,CACF,CAhBsBP,EAAAK,EAAA,uBAsBf,IAAMK,EAAaV,EAACW,GAAkB,CAC3C,IAAMC,EAAc,OAAO,CAAC,EAE5B,OAAO,OAAOD,CAAK,EAAIC,EACnB,KAAK,OAAOD,CAAK,EAAE,SAFN,EAEuB,CAAC,GACrC,KACN,EAN0B,cAQbE,EAAoCb,EAC/Cc,GACIA,GAAQ,CAACA,EAAK,WAAW,IAAI,EAAI,KAAOA,EAAOA,EAFJ",
6
- "names": ["derivationPath", "setDerivationPath", "path", "__name", "getDerivationPath", "dynamicImportWithRefinedError", "ETHEREUM_CHAIN_ID", "Networks", "trezorErrorMessages", "getTrezorModule", "mod", "dynamicImportWithRefinedError", "__name", "getTrezorInstance", "instances", "Networks", "ETHEREUM_CHAIN_ID", "getEthereumAccounts", "TrezorConnect", "derivationPath", "getDerivationPath", "result", "valueToHex", "value", "ZERO_BIGINT", "getTrezorNormalizedDerivationPath", "path"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as p,c as u,d as P,e as h,h as e}from"./chunk-EWAGIH74.js";import{cleanEvmError as G}from"@rango-dev/signer-evm";import{DEFAULT_ETHEREUM_RPC_URL as z}from"@rango-dev/wallets-shared";import{JsonRpcProvider as S,Transaction as R}from"ethers";import"rango-types";function b(s){return s?.shortMessage?new Error(s.shortMessage,{cause:s}):G(s)}p(b,"getTrezorErrorMessage");var E=class{static{p(this,"EthereumSigner")}async signMessage(r){let o=await h(),{success:n,payload:t}=await o.ethereumSignMessage({message:r,path:u()});if(!n)throw new Error(t.error);return t.signature}async signAndSendTx(r,o,n){try{let t=await h(),{gasPrice:d,maxFeePerGas:i,maxPriorityFeePerGas:c}=r,a=i&&c;if(a&&!i)throw new Error("Missing maxFeePerGas");if(a&&!c)throw new Error("Missing maxPriorityFeePerGas");if(!a&&!d)throw new Error("Missing gasPrice");let w=new S(z),T=await w.getTransactionCount(o),f=a?{maxFeePerGas:e(i||"0"),maxPriorityFeePerGas:e(c||"0")}:{gasPrice:e(d||"0")},g={to:r.to,data:r.data||"0x",value:e(r.value?.toString()||"0"),gasLimit:e(r.gasLimit?.toString()||"0"),chainId:Number.parseInt(n),nonce:e(T.toString()),...f},{success:l,payload:m}=await t.ethereumSignTransaction({path:u(),transaction:g});if(!l){let F=P[m?.code||""]||m.error;throw new Error(F)}let{r:y,s:v,v:M}=m,x=R.from({...g,nonce:Number.parseInt(g.nonce),type:a?2:0,signature:{r:y,s:v,v:parseInt(M)}}).serialized;return{hash:(await w.broadcastTransaction(x)).hash}}catch(t){throw b(t)}}};export{E as EthereumSigner,b as getTrezorErrorMessage};
2
- //# sourceMappingURL=ethereum-ZQ7ZTGPY.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/signers/ethereum.ts"],
4
- "sourcesContent": ["import type { EvmTransaction } from 'rango-types/mainApi';\n\nimport { cleanEvmError } from '@rango-dev/signer-evm';\nimport { DEFAULT_ETHEREUM_RPC_URL } from '@rango-dev/wallets-shared';\nimport { JsonRpcProvider, Transaction } from 'ethers';\nimport { type GenericSigner } from 'rango-types';\n\nimport {\n getTrezorModule,\n trezorErrorMessages,\n valueToHex,\n} from '../helpers.js';\nimport { getDerivationPath } from '../state.js';\n\nexport function getTrezorErrorMessage(error: any) {\n if (error?.shortMessage) {\n /*\n * Some error signs have lengthy, challenging-to-read messages.\n * shortMessage is used because it is shorter and easier to understand.\n */\n return new Error(error.shortMessage, { cause: error });\n }\n return cleanEvmError(error);\n}\n\nexport class EthereumSigner implements GenericSigner<EvmTransaction> {\n async signMessage(msg: string): Promise<string> {\n const TrezorConnect = await getTrezorModule();\n\n const { success, payload } = await TrezorConnect.ethereumSignMessage({\n message: msg,\n path: getDerivationPath(),\n });\n if (!success) {\n throw new Error(payload.error);\n }\n return payload.signature;\n }\n\n async signAndSendTx(\n tx: EvmTransaction,\n fromAddress: string,\n chainId: string\n ): Promise<{ hash: string }> {\n try {\n const TrezorConnect = await getTrezorModule();\n const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = tx;\n const isEIP1559 = maxFeePerGas && maxPriorityFeePerGas;\n\n if (isEIP1559 && !maxFeePerGas) {\n throw new Error('Missing maxFeePerGas');\n }\n if (isEIP1559 && !maxPriorityFeePerGas) {\n throw new Error('Missing maxPriorityFeePerGas');\n }\n if (!isEIP1559 && !gasPrice) {\n throw new Error('Missing gasPrice');\n }\n const provider = new JsonRpcProvider(DEFAULT_ETHEREUM_RPC_URL); // Provider to broadcast transaction\n const transactionCount = await provider.getTransactionCount(fromAddress); // Get nonce\n const additionalFields = isEIP1559\n ? {\n maxFeePerGas: valueToHex(maxFeePerGas || '0'),\n maxPriorityFeePerGas: valueToHex(maxPriorityFeePerGas || '0'),\n }\n : {\n gasPrice: valueToHex(gasPrice || '0'),\n };\n\n const transaction = {\n to: tx.to,\n data: tx.data || '0x',\n value: valueToHex(tx.value?.toString() || '0'),\n gasLimit: valueToHex(tx.gasLimit?.toString() || '0'),\n chainId: Number.parseInt(chainId),\n nonce: valueToHex(transactionCount.toString()),\n ...additionalFields,\n };\n\n const { success, payload } = await TrezorConnect.ethereumSignTransaction({\n path: getDerivationPath(),\n transaction,\n });\n\n if (!success) {\n const errorMessage =\n trezorErrorMessages[payload?.code || ''] || payload.error;\n throw new Error(errorMessage);\n }\n const { r, s, v } = payload;\n\n const serializedTx = Transaction.from({\n ...transaction,\n nonce: Number.parseInt(transaction.nonce),\n /*\n * Type 0: This refers to the legacy transaction type that has been used since Ethereum's inception.\n * Type 2: This refers to the new transaction type introduced with the EIP-1559 (Ethereum Improvement Proposal 1559) update,\n * which was part of the London hard fork.\n */\n type: isEIP1559 ? 2 : 0,\n signature: { r, s, v: parseInt(v) },\n }).serialized;\n const broadcastResult = await provider.broadcastTransaction(serializedTx);\n\n return { hash: broadcastResult.hash };\n } catch (error) {\n throw getTrezorErrorMessage(error);\n }\n }\n}\n"],
5
- "mappings": "oEAEA,OAAS,iBAAAA,MAAqB,wBAC9B,OAAS,4BAAAC,MAAgC,4BACzC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,SAC7C,MAAmC,cAS5B,SAASC,EAAsBC,EAAY,CAChD,OAAIA,GAAO,aAKF,IAAI,MAAMA,EAAM,aAAc,CAAE,MAAOA,CAAM,CAAC,EAEhDC,EAAcD,CAAK,CAC5B,CATgBE,EAAAH,EAAA,yBAWT,IAAMI,EAAN,KAA8D,CAzBrE,MAyBqE,CAAAD,EAAA,uBACnE,MAAM,YAAYE,EAA8B,CAC9C,IAAMC,EAAgB,MAAMC,EAAgB,EAEtC,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,MAAMH,EAAc,oBAAoB,CACnE,QAASD,EACT,KAAMK,EAAkB,CAC1B,CAAC,EACD,GAAI,CAACF,EACH,MAAM,IAAI,MAAMC,EAAQ,KAAK,EAE/B,OAAOA,EAAQ,SACjB,CAEA,MAAM,cACJE,EACAC,EACAC,EAC2B,CAC3B,GAAI,CACF,IAAMP,EAAgB,MAAMC,EAAgB,EACtC,CAAE,SAAAO,EAAU,aAAAC,EAAc,qBAAAC,CAAqB,EAAIL,EACnDM,EAAYF,GAAgBC,EAElC,GAAIC,GAAa,CAACF,EAChB,MAAM,IAAI,MAAM,sBAAsB,EAExC,GAAIE,GAAa,CAACD,EAChB,MAAM,IAAI,MAAM,8BAA8B,EAEhD,GAAI,CAACC,GAAa,CAACH,EACjB,MAAM,IAAI,MAAM,kBAAkB,EAEpC,IAAMI,EAAW,IAAIC,EAAgBC,CAAwB,EACvDC,EAAmB,MAAMH,EAAS,oBAAoBN,CAAW,EACjEU,EAAmBL,EACrB,CACE,aAAcM,EAAWR,GAAgB,GAAG,EAC5C,qBAAsBQ,EAAWP,GAAwB,GAAG,CAC9D,EACA,CACE,SAAUO,EAAWT,GAAY,GAAG,CACtC,EAEEU,EAAc,CAClB,GAAIb,EAAG,GACP,KAAMA,EAAG,MAAQ,KACjB,MAAOY,EAAWZ,EAAG,OAAO,SAAS,GAAK,GAAG,EAC7C,SAAUY,EAAWZ,EAAG,UAAU,SAAS,GAAK,GAAG,EACnD,QAAS,OAAO,SAASE,CAAO,EAChC,MAAOU,EAAWF,EAAiB,SAAS,CAAC,EAC7C,GAAGC,CACL,EAEM,CAAE,QAAAd,EAAS,QAAAC,CAAQ,EAAI,MAAMH,EAAc,wBAAwB,CACvE,KAAMI,EAAkB,EACxB,YAAAc,CACF,CAAC,EAED,GAAI,CAAChB,EAAS,CACZ,IAAMiB,EACJC,EAAoBjB,GAAS,MAAQ,EAAE,GAAKA,EAAQ,MACtD,MAAM,IAAI,MAAMgB,CAAY,CAC9B,CACA,GAAM,CAAE,EAAAE,EAAG,EAAAC,EAAG,EAAAC,CAAE,EAAIpB,EAEdqB,EAAeC,EAAY,KAAK,CACpC,GAAGP,EACH,MAAO,OAAO,SAASA,EAAY,KAAK,EAMxC,KAAMP,EAAY,EAAI,EACtB,UAAW,CAAE,EAAAU,EAAG,EAAAC,EAAG,EAAG,SAASC,CAAC,CAAE,CACpC,CAAC,EAAE,WAGH,MAAO,CAAE,MAFe,MAAMX,EAAS,qBAAqBY,CAAY,GAEzC,IAAK,CACtC,OAAS7B,EAAO,CACd,MAAMD,EAAsBC,CAAK,CACnC,CACF,CACF",
6
- "names": ["cleanEvmError", "DEFAULT_ETHEREUM_RPC_URL", "JsonRpcProvider", "Transaction", "getTrezorErrorMessage", "error", "cleanEvmError", "__name", "EthereumSigner", "msg", "TrezorConnect", "getTrezorModule", "success", "payload", "getDerivationPath", "tx", "fromAddress", "chainId", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "isEIP1559", "provider", "JsonRpcProvider", "DEFAULT_ETHEREUM_RPC_URL", "transactionCount", "additionalFields", "valueToHex", "transaction", "errorMessage", "trezorErrorMessages", "r", "s", "v", "serializedTx", "Transaction"]
7
- }
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- import{a as r,b as s,e as c,f as m,g as l,i as p}from"./chunk-EWAGIH74.js";import{Networks as g,WalletTypes as v}from"@rango-dev/wallets-shared";import"rango-types";import{dynamicImportWithRefinedError as f}from"@rango-dev/wallets-shared";import{DefaultSignerFactory as y,TransactionType as u}from"rango-types";async function i(){let t=new y,{EthereumSigner:n}=await f(async()=>await import("./ethereum-ZQ7ZTGPY.js"));return t.registerSigner(u.EVM,new n),t}r(i,"getSigners");var h={appUrl:"",email:""},k={type:v.TREZOR},D=r(t=>{h=t.manifest},"init"),C=m,d=!1,I=r(async({namespaces:t})=>{let n=[],o=await c(),e=t?.find(a=>a.namespace==="EVM");if(e)if(e.derivationPath){s(p(e.derivationPath)),d||(await o.init({lazyLoad:!0,manifest:h}),d=!0);let a=await l();n.push(a)}else throw new Error("Derivation Path can not be empty.");else throw new Error(`It appears that you have selected a namespace that is not yet supported by our system. Your namespaces: ${t?.map(a=>a.namespace)}`);return n},"connect"),L=i,R=r(t=>{let n=[],o=t.find(e=>e.name===g.ETHEREUM);return o&&n.push(o),{name:"Trezor",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/trezor/icon.svg",installLink:{DEFAULT:"https://trezor.io/learn/a/download-verify-trezor-suite"},color:"black",supportedChains:n,showOnMobile:!1,needsNamespace:{selection:"single",data:[{id:"ETH",value:"EVM",label:"Ethereum",getSupportedChains:e=>e.filter(a=>a.name===g.ETHEREUM)}]},needsDerivationPath:{data:[{id:"metamask",label:"Metamask (m/44'/60'/0'/0/index)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/0'/0/${e}`},{id:"ledgerLive",label:"LedgerLive (m/44'/60'/index'/0/0)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/${e}'/0/0`},{id:"legacy",label:"Legacy (m/44'/60'/0'/index)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/0'/${e}`},{id:"(m/44'/501'/index')",label:"(m/44'/501'/index')",namespace:"Solana",generateDerivationPath:e=>`44'/501'/${e}'`},{id:"(m/44'/501'/0'/index)",label:"(m/44'/501'/0'/index)",namespace:"Solana",generateDerivationPath:e=>`44'/501'/0'/${e}`}]}}},"getWalletInfo");export{k as config,I as connect,C as getInstance,L as getSigners,R as getWalletInfo,D as init};
2
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts", "../src/signer.ts"],
4
- "sourcesContent": ["import type { Environments } from './types.js';\nimport type {\n Connect,\n ProviderConnectResult,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\n\nimport { Networks, WalletTypes } from '@rango-dev/wallets-shared';\nimport { type BlockchainMeta, type SignerFactory } from 'rango-types';\n\nimport {\n getEthereumAccounts,\n getTrezorInstance,\n getTrezorModule,\n getTrezorNormalizedDerivationPath,\n} from './helpers.js';\nimport signer from './signer.js';\nimport { setDerivationPath } from './state.js';\n\nlet trezorManifest: Environments['manifest'] = {\n appUrl: '',\n email: '',\n};\nexport const config = {\n type: WalletTypes.TREZOR,\n};\n\nexport type { Environments };\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Provider = any;\n\nexport const init = (environments: Environments) => {\n trezorManifest = environments.manifest;\n};\n\nexport const getInstance = getTrezorInstance;\n\nlet isTrezorInitialized = false;\nexport const connect: Connect = async ({ namespaces }) => {\n const results: ProviderConnectResult[] = [];\n\n const TrezorConnect = await getTrezorModule();\n\n const evmNamespace = namespaces?.find(\n (namespaceItem) => namespaceItem.namespace === 'EVM'\n );\n\n if (evmNamespace) {\n if (evmNamespace.derivationPath) {\n setDerivationPath(\n getTrezorNormalizedDerivationPath(evmNamespace.derivationPath)\n );\n\n if (!isTrezorInitialized) {\n await TrezorConnect.init({\n lazyLoad: true, // this param will prevent iframe injection until TrezorConnect.method will be called\n manifest: trezorManifest,\n });\n\n isTrezorInitialized = true;\n }\n\n const accounts = await getEthereumAccounts();\n results.push(accounts);\n } else {\n throw new Error('Derivation Path can not be empty.');\n }\n } else {\n throw new Error(\n `It appears that you have selected a namespace that is not yet supported by our system. Your namespaces: ${namespaces?.map(\n (namespaceItem) => namespaceItem.namespace\n )}`\n );\n }\n\n return results;\n};\n\nexport const getSigners: (provider: Provider) => Promise<SignerFactory> =\n signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const supportedChains: BlockchainMeta[] = [];\n\n const ethereumBlockchain = allBlockChains.find(\n (chain) => chain.name === Networks.ETHEREUM\n );\n if (ethereumBlockchain) {\n supportedChains.push(ethereumBlockchain);\n }\n\n return {\n name: 'Trezor',\n img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/trezor/icon.svg',\n installLink: {\n DEFAULT: 'https://trezor.io/learn/a/download-verify-trezor-suite',\n },\n color: 'black',\n supportedChains,\n showOnMobile: false,\n\n needsNamespace: {\n selection: 'single',\n data: [\n {\n id: 'ETH',\n value: 'EVM',\n label: 'Ethereum',\n getSupportedChains: (allBlockchains: BlockchainMeta[]) =>\n allBlockchains.filter((chain) => chain.name === Networks.ETHEREUM),\n },\n ],\n },\n needsDerivationPath: {\n data: [\n {\n id: 'metamask',\n label: `Metamask (m/44'/60'/0'/0/index)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/0'/0/${index}`,\n },\n {\n id: 'ledgerLive',\n label: `LedgerLive (m/44'/60'/index'/0/0)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/${index}'/0/0`,\n },\n {\n id: 'legacy',\n label: `Legacy (m/44'/60'/0'/index)`,\n namespace: 'EVM',\n generateDerivationPath: (index: string) => `44'/60'/0'/${index}`,\n },\n {\n id: `(m/44'/501'/index')`,\n label: `(m/44'/501'/index')`,\n namespace: 'Solana',\n generateDerivationPath: (index: string) => `44'/501'/${index}'`,\n },\n {\n id: `(m/44'/501'/0'/index)`,\n label: `(m/44'/501'/0'/index)`,\n namespace: 'Solana',\n generateDerivationPath: (index: string) => `44'/501'/0'/${index}`,\n },\n ],\n },\n };\n};\n", "import type { SignerFactory } from 'rango-types';\n\nimport { dynamicImportWithRefinedError } from '@rango-dev/wallets-shared';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default async function getSigners(): Promise<SignerFactory> {\n const signers = new DefaultSignerFactory();\n const { EthereumSigner } = await dynamicImportWithRefinedError(\n async () => await import('./signers/ethereum.js')\n );\n signers.registerSigner(TxType.EVM, new EthereumSigner());\n return signers;\n}\n"],
5
- "mappings": "2EAOA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,4BACtC,MAAwD,cCNxD,OAAS,iCAAAC,MAAqC,4BAC9C,OAAS,wBAAAC,EAAsB,mBAAmBC,MAAc,cAEhE,eAAOC,GAA4D,CACjE,IAAMC,EAAU,IAAIC,EACd,CAAE,eAAAC,CAAe,EAAI,MAAMC,EAC/B,SAAY,KAAM,QAAO,wBAAuB,CAClD,EACA,OAAAH,EAAQ,eAAeI,EAAO,IAAK,IAAIF,CAAgB,EAChDF,CACT,CAP8BK,EAAAN,EAAA,cDc9B,IAAIO,EAA2C,CAC7C,OAAQ,GACR,MAAO,EACT,EACaC,EAAS,CACpB,KAAMC,EAAY,MACpB,EAMaC,EAAOC,EAACC,GAA+B,CAClDL,EAAiBK,EAAa,QAChC,EAFoB,QAIPC,EAAcC,EAEvBC,EAAsB,GACbC,EAAmBL,EAAA,MAAO,CAAE,WAAAM,CAAW,IAAM,CACxD,IAAMC,EAAmC,CAAC,EAEpCC,EAAgB,MAAMC,EAAgB,EAEtCC,EAAeJ,GAAY,KAC9BK,GAAkBA,EAAc,YAAc,KACjD,EAEA,GAAID,EACF,GAAIA,EAAa,eAAgB,CAC/BE,EACEC,EAAkCH,EAAa,cAAc,CAC/D,EAEKN,IACH,MAAMI,EAAc,KAAK,CACvB,SAAU,GACV,SAAUZ,CACZ,CAAC,EAEDQ,EAAsB,IAGxB,IAAMU,EAAW,MAAMC,EAAoB,EAC3CR,EAAQ,KAAKO,CAAQ,CACvB,KACE,OAAM,IAAI,MAAM,mCAAmC,MAGrD,OAAM,IAAI,MACR,2GAA2GR,GAAY,IACpHK,GAAkBA,EAAc,SACnC,CAAC,EACH,EAGF,OAAOJ,CACT,EAtCgC,WAwCnBS,EACXA,EAEWC,EAAkEjB,EAC7EkB,GACG,CACH,IAAMC,EAAoC,CAAC,EAErCC,EAAqBF,EAAe,KACvCG,GAAUA,EAAM,OAASC,EAAS,QACrC,EACA,OAAIF,GACFD,EAAgB,KAAKC,CAAkB,EAGlC,CACL,KAAM,SACN,IAAK,uFACL,YAAa,CACX,QAAS,wDACX,EACA,MAAO,QACP,gBAAAD,EACA,aAAc,GAEd,eAAgB,CACd,UAAW,SACX,KAAM,CACJ,CACE,GAAI,MACJ,MAAO,MACP,MAAO,WACP,mBAAqBI,GACnBA,EAAe,OAAQF,GAAUA,EAAM,OAASC,EAAS,QAAQ,CACrE,CACF,CACF,EACA,oBAAqB,CACnB,KAAM,CACJ,CACE,GAAI,WACJ,MAAO,kCACP,UAAW,MACX,uBAAyBE,GAAkB,gBAAgBA,CAAK,EAClE,EACA,CACE,GAAI,aACJ,MAAO,oCACP,UAAW,MACX,uBAAyBA,GAAkB,WAAWA,CAAK,OAC7D,EACA,CACE,GAAI,SACJ,MAAO,8BACP,UAAW,MACX,uBAAyBA,GAAkB,cAAcA,CAAK,EAChE,EACA,CACE,GAAI,sBACJ,MAAO,sBACP,UAAW,SACX,uBAAyBA,GAAkB,YAAYA,CAAK,GAC9D,EACA,CACE,GAAI,wBACJ,MAAO,wBACP,UAAW,SACX,uBAAyBA,GAAkB,eAAeA,CAAK,EACjE,CACF,CACF,CACF,CACF,EArE+E",
6
- "names": ["Networks", "WalletTypes", "dynamicImportWithRefinedError", "DefaultSignerFactory", "TxType", "getSigners", "signers", "DefaultSignerFactory", "EthereumSigner", "dynamicImportWithRefinedError", "TxType", "__name", "trezorManifest", "config", "WalletTypes", "init", "__name", "environments", "getInstance", "getTrezorInstance", "isTrezorInitialized", "connect", "namespaces", "results", "TrezorConnect", "getTrezorModule", "evmNamespace", "namespaceItem", "setDerivationPath", "getTrezorNormalizedDerivationPath", "accounts", "getEthereumAccounts", "getSigners", "getWalletInfo", "allBlockChains", "supportedChains", "ethereumBlockchain", "chain", "Networks", "allBlockchains", "index"]
7
- }