@rango-dev/provider-trezor 0.28.1-next.3 → 0.29.1-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 CHANGED
@@ -1,3 +1,12 @@
1
+ # [0.29.0](https://github.com/rango-exchange/rango-client/compare/provider-trezor@0.28.0...provider-trezor@0.29.0) (2026-07-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **walletconnect:** send eth_sendTransaction params as hex ([57141a8](https://github.com/rango-exchange/rango-client/commit/57141a85ce9548038f4fe527407cbf5cfcfb7383))
7
+
8
+
9
+
1
10
  # [0.28.0](https://github.com/rango-exchange/rango-client/compare/provider-trezor@0.27.0...provider-trezor@0.28.0) (2026-07-07)
2
11
 
3
12
 
@@ -0,0 +1,2 @@
1
+ var s=Object.defineProperty;var e=(t,r)=>s(t,"name",{value:r,configurable:!0});var n="";function l(t){n=t}e(l,"setDerivationPath");function i(){return n}e(i,"getDerivationPath");var a="";function m(t){a=t}e(m,"setBitcoinDerivationPath");function p(){return a}e(p,"getBitcoinDerivationPath");import{dynamicImportWithRefinedError as c,ETHEREUM_CHAIN_ID as u}from"@rango-dev/wallets-shared";var w={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");async function x(){let t=await d(),r=i(),o=await t.ethereumGetAddress({path:r});if(!o.success)throw new Error(o.payload.error);return{accounts:[o.payload.address],chainId:u,derivationPath:r}}e(x,"getEthereumAccounts");var y=e(t=>t&&!t.startsWith("m/")?"m/"+t:t,"getTrezorNormalizedDerivationPath");export{e as a,l as b,i as c,m as d,p as e,w as f,d as g,x as h,y as i};
2
+ //# sourceMappingURL=chunk-FTGT4J2G.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/state.ts", "../src/utils.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\n/*\n * Bitcoin's connect-time path, kept for the same reason as the EVM one: Rango's PSBT\n * carries no derivation data, so the signer must remember which path to sign with. Kept\n * separate from the EVM path so the two namespaces never collide.\n */\nlet bitcoinDerivationPath = '';\n\nexport function setBitcoinDerivationPath(path: string) {\n bitcoinDerivationPath = path;\n}\n\nexport function getBitcoinDerivationPath() {\n return bitcoinDerivationPath;\n}\n", "import type { TrezorConnect } from '@trezor/connect-web';\n\nimport {\n dynamicImportWithRefinedError,\n ETHEREUM_CHAIN_ID,\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 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,qBAShB,IAAIC,EAAwB,GAErB,SAASC,EAAyBJ,EAAc,CACrDG,EAAwBH,CAC1B,CAFgBC,EAAAG,EAAA,4BAIT,SAASC,GAA2B,CACzC,OAAOF,CACT,CAFgBF,EAAAI,EAAA,4BCpBhB,OACE,iCAAAC,EACA,qBAAAC,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,mBAetB,eAAsBI,GAAsD,CAC1E,IAAMC,EAAgB,MAAML,EAAgB,EACtCM,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,QAASC,EACT,eAAAH,CACF,CACF,CAhBsBH,EAAAC,EAAA,uBAsBf,IAAMM,EAAaP,EAACQ,GAAkB,CAC3C,IAAMC,EAAc,OAAO,CAAC,EAE5B,OAAO,OAAOD,CAAK,EAAIC,EACnB,KAAK,OAAOD,CAAK,EAAE,SAFN,EAEuB,CAAC,GACrC,KACN,EAN0B,cAQbE,EAAoCV,EAC/CW,GACIA,GAAQ,CAACA,EAAK,WAAW,IAAI,EAAI,KAAOA,EAAOA,EAFJ",
6
- "names": ["derivationPath", "setDerivationPath", "path", "__name", "getDerivationPath", "bitcoinDerivationPath", "setBitcoinDerivationPath", "getBitcoinDerivationPath", "dynamicImportWithRefinedError", "ETHEREUM_CHAIN_ID", "trezorErrorMessages", "getTrezorModule", "mod", "dynamicImportWithRefinedError", "__name", "getEthereumAccounts", "TrezorConnect", "derivationPath", "getDerivationPath", "result", "ETHEREUM_CHAIN_ID", "valueToHex", "value", "ZERO_BIGINT", "getTrezorNormalizedDerivationPath", "path"]
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\n/*\n * Bitcoin's connect-time path, kept for the same reason as the EVM one: Rango's PSBT\n * carries no derivation data, so the signer must remember which path to sign with. Kept\n * separate from the EVM path so the two namespaces never collide.\n */\nlet bitcoinDerivationPath = '';\n\nexport function setBitcoinDerivationPath(path: string) {\n bitcoinDerivationPath = path;\n}\n\nexport function getBitcoinDerivationPath() {\n return bitcoinDerivationPath;\n}\n", "import type { TrezorConnect } from '@trezor/connect-web';\n\nimport {\n dynamicImportWithRefinedError,\n ETHEREUM_CHAIN_ID,\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 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\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,qBAShB,IAAIC,EAAwB,GAErB,SAASC,EAAyBJ,EAAc,CACrDG,EAAwBH,CAC1B,CAFgBC,EAAAG,EAAA,4BAIT,SAASC,GAA2B,CACzC,OAAOF,CACT,CAFgBF,EAAAI,EAAA,4BCpBhB,OACE,iCAAAC,EACA,qBAAAC,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,mBAetB,eAAsBI,GAAsD,CAC1E,IAAMC,EAAgB,MAAML,EAAgB,EACtCM,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,QAASC,EACT,eAAAH,CACF,CACF,CAhBsBH,EAAAC,EAAA,uBAkBf,IAAMM,EAAoCP,EAC/CQ,GACIA,GAAQ,CAACA,EAAK,WAAW,IAAI,EAAI,KAAOA,EAAOA,EAFJ",
6
+ "names": ["derivationPath", "setDerivationPath", "path", "__name", "getDerivationPath", "bitcoinDerivationPath", "setBitcoinDerivationPath", "getBitcoinDerivationPath", "dynamicImportWithRefinedError", "ETHEREUM_CHAIN_ID", "trezorErrorMessages", "getTrezorModule", "mod", "dynamicImportWithRefinedError", "__name", "getEthereumAccounts", "TrezorConnect", "derivationPath", "getDerivationPath", "result", "ETHEREUM_CHAIN_ID", "getTrezorNormalizedDerivationPath", "path"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{a as p}from"./chunk-KQD4IRQZ.js";var S="btc",o=[{id:"native-segwit",label:"Native SegWit",purpose:84,inputScriptType:"SPENDWITNESS"},{id:"nested-segwit",label:"Nested SegWit",purpose:49,inputScriptType:"SPENDP2SHWITNESS"},{id:"legacy",label:"Legacy",purpose:44,inputScriptType:"SPENDADDRESS"},{id:"taproot",label:"Taproot",purpose:86,inputScriptType:"SPENDTAPROOT"}];function n(e){let r=Number.parseInt(e.replace(/^m\//,"").split("/")[0]?.replace(/['h]$/,"")??"",10),t=o.find(i=>i.purpose===r);if(!t)throw new Error(`Unsupported Bitcoin derivation path: ${e}`);return t.inputScriptType}p(n,"resolveBitcoinScriptType");export{S as a,o as b,n as c};
2
- //# sourceMappingURL=chunk-4A5SID3U.js.map
1
+ import{a as p}from"./chunk-FTGT4J2G.js";var S="btc",o=[{id:"native-segwit",label:"Native SegWit",purpose:84,inputScriptType:"SPENDWITNESS"},{id:"nested-segwit",label:"Nested SegWit",purpose:49,inputScriptType:"SPENDP2SHWITNESS"},{id:"legacy",label:"Legacy",purpose:44,inputScriptType:"SPENDADDRESS"},{id:"taproot",label:"Taproot",purpose:86,inputScriptType:"SPENDTAPROOT"}];function n(e){let r=Number.parseInt(e.replace(/^m\//,"").split("/")[0]?.replace(/['h]$/,"")??"",10),t=o.find(i=>i.purpose===r);if(!t)throw new Error(`Unsupported Bitcoin derivation path: ${e}`);return t.inputScriptType}p(n,"resolveBitcoinScriptType");export{S as a,o as b,n as c};
2
+ //# sourceMappingURL=chunk-HUUVMU7F.js.map
@@ -0,0 +1,2 @@
1
+ import{a as p,c as u,f as P,g as h}from"./chunk-FTGT4J2G.js";import{cleanEvmError as G,toHexQuantity as s}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 a=await h(),{success:o,payload:t}=await a.ethereumSignMessage({message:e,path:u()});if(!o)throw new Error(t.error);return t.signature}async signAndSendTx(e,a,o){try{let t=await h(),{gasPrice:w,maxFeePerGas:i,maxPriorityFeePerGas:c}=e,n=i&&c;if(n&&!i)throw new Error("Missing maxFeePerGas");if(n&&!c)throw new Error("Missing maxPriorityFeePerGas");if(!n&&!w)throw new Error("Missing gasPrice");let d=new S(z),E=await d.getTransactionCount(a),l=n?{maxFeePerGas:s(i||"0"),maxPriorityFeePerGas:s(c||"0")}:{gasPrice:s(w||"0")},g={to:e.to,data:e.data||"0x",value:s(e.value?.toString()||"0"),gasLimit:s(e.gasLimit?.toString()||"0"),chainId:Number.parseInt(o),nonce:s(E.toString()),...l},{success:y,payload:m}=await t.ethereumSignTransaction({path:u(),transaction:g});if(!y){let F=P[m?.code||""]||m.error;throw new Error(F)}let{r:T,s:M,v}=m,x=b.from({...g,nonce:Number.parseInt(g.nonce),type:n?2:0,signature:{r:T,s:M,v:parseInt(v)}}).serialized;return{hash:(await d.broadcastTransaction(x)).hash}}catch(t){throw R(t)}}};export{f as EthereumSigner,R as getTrezorErrorMessage};
2
+ //# sourceMappingURL=ethereum-WJFMSBHD.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, toHexQuantity } 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 { getDerivationPath } from '../state.js';\nimport { getTrezorModule, trezorErrorMessages } from '../utils.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: toHexQuantity(maxFeePerGas || '0'),\n maxPriorityFeePerGas: toHexQuantity(maxPriorityFeePerGas || '0'),\n }\n : {\n gasPrice: toHexQuantity(gasPrice || '0'),\n };\n\n const transaction = {\n to: tx.to,\n data: tx.data || '0x',\n value: toHexQuantity(tx.value?.toString() || '0'),\n gasLimit: toHexQuantity(tx.gasLimit?.toString() || '0'),\n chainId: Number.parseInt(chainId),\n nonce: toHexQuantity(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": "6DAEA,OAAS,iBAAAA,EAAe,iBAAAC,MAAqB,wBAC7C,OAAS,4BAAAC,MAAgC,4BACzC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,SAC7C,MAAmC,cAK5B,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,CA1BrE,MA0BqE,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,EAAcR,GAAgB,GAAG,EAC/C,qBAAsBQ,EAAcP,GAAwB,GAAG,CACjE,EACA,CACE,SAAUO,EAAcT,GAAY,GAAG,CACzC,EAEEU,EAAc,CAClB,GAAIb,EAAG,GACP,KAAMA,EAAG,MAAQ,KACjB,MAAOY,EAAcZ,EAAG,OAAO,SAAS,GAAK,GAAG,EAChD,SAAUY,EAAcZ,EAAG,UAAU,SAAS,GAAK,GAAG,EACtD,QAAS,OAAO,SAASE,CAAO,EAChC,MAAOU,EAAcF,EAAiB,SAAS,CAAC,EAChD,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", "toHexQuantity", "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", "toHexQuantity", "transaction", "errorMessage", "trezorErrorMessages", "r", "s", "serializedTx", "Transaction"]
7
+ }
package/dist/mod.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as f,b as g,c as h}from"./chunk-4A5SID3U.js";import{a as o,b as d,d as l,g as a,h as u,j as c}from"./chunk-KQD4IRQZ.js";import{defineVersions as J}from"@hub3js/core/utils";import{ProviderBuilder as G}from"@hub3js/core";import{Networks as E,WalletTypes as L}from"@rango-dev/wallets-shared";import"rango-types";import{dynamicImportWithRefinedError as T}from"@rango-dev/wallets-shared";import{DefaultSignerFactory as _,TransactionType as v}from"rango-types";async function p(){let t=new _,{EthereumSigner:e}=await T(async()=>await import("./ethereum-CRCQQH34.js")),{BTCSigner:r}=await T(async()=>await import("./utxo-BVUYSP2M.js"));return t.registerSigner(v.EVM,new e),t.registerSigner(v.TRANSFER,new r),t}o(p,"getSigners");var i=L.TREZOR,w={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:t=>t.filter(e=>e.name===E.ETHEREUM)},{label:"Bitcoin",value:"UTXO",id:"BTC",getSupportedChains:t=>t.filter(e=>e.name===E.BTC)}]}},{name:"derivationPath",value:{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}`},...g.map(t=>({id:`bitcoin-${t.id}`,label:`${t.label} (m/${t.purpose}'/0'/index')`,namespace:"UTXO",generateDerivationPath:e=>`${t.purpose}'/0'/${e}'/0/0`}))]}},{name:"signers",value:{getSigners:async()=>p()}}]};import{NamespaceBuilder as N}from"@hub3js/core";import{builders as A,utils as U}from"@hub3js/evm";import*as b from"@hub3js/std/builders";import{standardizeAndThrowError as k}from"@hub3js/std/operators";import{ETHEREUM_CHAIN_ID as O}from"@rango-dev/wallets-shared";var x=!1;async function s(){if(x)return;await(await a()).init({lazyLoad:!0,manifest:y()}),x=!0}o(s,"initTrezor");var R=A.connect().action(async function(t,e,r){if(!r?.derivationPath)throw new Error("Derivation Path can not be empty.");d(c(r.derivationPath)),await s();let n=await u();return{accounts:U.formatAccountsToCAIP(n.accounts,n.chainId),network:n.chainId}}).or(k).build(),W=b.disconnect().build(),$=A.getChainId().action(()=>O).build(),z=new N("EVM",i).action(R).action(W).action($).build();import{NamespaceBuilder as j}from"@hub3js/core";import*as C from"@hub3js/std/builders";import{standardizeAndThrowError as X}from"@hub3js/std/operators";import{builders as q}from"@rango-dev/wallets-core/namespaces/utxo";import{CAIP_BITCOIN_CHAIN_ID as V,utils as F}from"@rango-dev/wallets-core/namespaces/utxo";function H(){return async(t,e)=>{if(!e?.derivationPath)throw new Error("Derivation Path can not be empty.");await s();let r=c(e.derivationPath),n=h(r);l(r);let m=await(await a()).getAddress({path:r,coin:f,scriptType:n,showOnTrezor:!1});if(!m.success)throw new Error(m.payload.error);let{address:S}=m.payload;return F.formatAccountsToCAIP([S],V)}}o(H,"connect");var P={connect:H};var Y=q.connect().action(P.connect()).or(X).build(),Z=C.disconnect().build(),I=new j("UTXO",i).action(Y).action(Z).build();var M,y=o(()=>M,"getTrezorManifest"),B=o(()=>new G(i).init(function(t,e){let[,r]=t.state();if(!e.manifest)throw new Error("Trezor manifest is required");M=e.manifest,r("installed",!0),console.debug("[trezor] instance detected.",t)}).config("metadata",w).add("evm",z).add("utxo",I).build(),"buildProvider");var $t=o(()=>J().version("1.0.0",B()).build(),"versions");export{$t as versions};
1
+ import{a as f,b as g,c as h}from"./chunk-HUUVMU7F.js";import{a as o,b as d,d as l,g as a,h as u,i as c}from"./chunk-FTGT4J2G.js";import{defineVersions as J}from"@hub3js/core/utils";import{ProviderBuilder as G}from"@hub3js/core";import{Networks as E,WalletTypes as L}from"@rango-dev/wallets-shared";import"rango-types";import{dynamicImportWithRefinedError as T}from"@rango-dev/wallets-shared";import{DefaultSignerFactory as _,TransactionType as v}from"rango-types";async function p(){let t=new _,{EthereumSigner:e}=await T(async()=>await import("./ethereum-WJFMSBHD.js")),{BTCSigner:r}=await T(async()=>await import("./utxo-MZNQ2QK4.js"));return t.registerSigner(v.EVM,new e),t.registerSigner(v.TRANSFER,new r),t}o(p,"getSigners");var i=L.TREZOR,w={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:t=>t.filter(e=>e.name===E.ETHEREUM)},{label:"Bitcoin",value:"UTXO",id:"BTC",getSupportedChains:t=>t.filter(e=>e.name===E.BTC)}]}},{name:"derivationPath",value:{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}`},...g.map(t=>({id:`bitcoin-${t.id}`,label:`${t.label} (m/${t.purpose}'/0'/index')`,namespace:"UTXO",generateDerivationPath:e=>`${t.purpose}'/0'/${e}'/0/0`}))]}},{name:"signers",value:{getSigners:async()=>p()}}]};import{NamespaceBuilder as N}from"@hub3js/core";import{builders as A,utils as U}from"@hub3js/evm";import*as b from"@hub3js/std/builders";import{standardizeAndThrowError as k}from"@hub3js/std/operators";import{ETHEREUM_CHAIN_ID as O}from"@rango-dev/wallets-shared";var x=!1;async function s(){if(x)return;await(await a()).init({lazyLoad:!0,manifest:y()}),x=!0}o(s,"initTrezor");var R=A.connect().action(async function(t,e,r){if(!r?.derivationPath)throw new Error("Derivation Path can not be empty.");d(c(r.derivationPath)),await s();let n=await u();return{accounts:U.formatAccountsToCAIP(n.accounts,n.chainId),network:n.chainId}}).or(k).build(),W=b.disconnect().build(),$=A.getChainId().action(()=>O).build(),z=new N("EVM",i).action(R).action(W).action($).build();import{NamespaceBuilder as j}from"@hub3js/core";import*as C from"@hub3js/std/builders";import{standardizeAndThrowError as X}from"@hub3js/std/operators";import{builders as q}from"@rango-dev/wallets-core/namespaces/utxo";import{CAIP_BITCOIN_CHAIN_ID as V,utils as F}from"@rango-dev/wallets-core/namespaces/utxo";function H(){return async(t,e)=>{if(!e?.derivationPath)throw new Error("Derivation Path can not be empty.");await s();let r=c(e.derivationPath),n=h(r);l(r);let m=await(await a()).getAddress({path:r,coin:f,scriptType:n,showOnTrezor:!1});if(!m.success)throw new Error(m.payload.error);let{address:S}=m.payload;return F.formatAccountsToCAIP([S],V)}}o(H,"connect");var P={connect:H};var Y=q.connect().action(P.connect()).or(X).build(),Z=C.disconnect().build(),I=new j("UTXO",i).action(Y).action(Z).build();var M,y=o(()=>M,"getTrezorManifest"),B=o(()=>new G(i).init(function(t,e){let[,r]=t.state();if(!e.manifest)throw new Error("Trezor manifest is required");M=e.manifest,r("installed",!0),console.debug("[trezor] instance detected.",t)}).config("metadata",w).add("evm",z).add("utxo",I).build(),"buildProvider");var $t=o(()=>J().version("1.0.0",B()).build(),"versions");export{$t as versions};
2
2
  //# sourceMappingURL=mod.js.map
@@ -1 +1 @@
1
- {"inputs":{"src/state.ts":{"bytes":744,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utils.ts":{"bytes":2068,"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":3804,"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/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utxo/config.ts":{"bytes":1961,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utxo/psbt.ts":{"bytes":3426,"imports":[{"path":"@bitcoinerlab/secp256k1","kind":"import-statement","external":true},{"path":"bitcoinjs-lib","kind":"import-statement","external":true},{"path":"src/utxo/config.ts","kind":"import-statement","original":"./config.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/utxo.ts":{"bytes":2629,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"src/utxo/config.ts","kind":"import-statement","original":"../utxo/config.js"},{"path":"src/utxo/psbt.ts","kind":"import-statement","original":"../utxo/psbt.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":702,"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":"src/signers/utxo.ts","kind":"dynamic-import","original":"./signers/utxo.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":2728,"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/utxo/config.ts","kind":"import-statement","original":"./utxo/config.js"}],"format":"esm"},"src/init.ts":{"bytes":571,"imports":[{"path":"src/provider.ts","kind":"import-statement","original":"./provider.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm.ts":{"bytes":1477,"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/init.ts","kind":"import-statement","original":"../init.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"}],"format":"esm"},"src/actions/utxo.ts":{"bytes":1692,"imports":[{"path":"@rango-dev/wallets-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"src/init.ts","kind":"import-statement","original":"../init.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"src/utxo/config.ts","kind":"import-statement","original":"../utxo/config.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/utxo.ts":{"bytes":736,"imports":[{"path":"@hub3js/core","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-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"src/actions/utxo.ts","kind":"import-statement","original":"../actions/utxo.js"},{"path":"src/constants.ts","kind":"import-statement","original":"../constants.js"}],"format":"esm"},"src/provider.ts":{"bytes":878,"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":"src/namespaces/utxo.ts","kind":"import-statement","original":"./namespaces/utxo.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/mod.ts":{"bytes":209,"imports":[{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"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":14560},"dist/mod.js":{"imports":[{"path":"dist/chunk-4A5SID3U.js","kind":"import-statement"},{"path":"dist/chunk-KQD4IRQZ.js","kind":"import-statement"},{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"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":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"dist/ethereum-CRCQQH34.js","kind":"dynamic-import"},{"path":"dist/utxo-BVUYSP2M.js","kind":"dynamic-import"},{"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":"@hub3js/core","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-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/utxo","kind":"import-statement","external":true}],"exports":["versions"],"entryPoint":"src/mod.ts","inputs":{"src/mod.ts":{"bytesInOutput":110},"src/provider.ts":{"bytesInOutput":353},"src/constants.ts":{"bytesInOutput":1141},"src/signer.ts":{"bytesInOutput":412},"src/namespaces/evm.ts":{"bytesInOutput":650},"src/init.ts":{"bytesInOutput":113},"src/namespaces/utxo.ts":{"bytesInOutput":342},"src/actions/utxo.ts":{"bytesInOutput":470}},"bytes":3776},"dist/ethereum-CRCQQH34.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6375},"dist/ethereum-CRCQQH34.js":{"imports":[{"path":"dist/chunk-KQD4IRQZ.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/utxo-BVUYSP2M.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":9115},"dist/utxo-BVUYSP2M.js":{"imports":[{"path":"dist/chunk-4A5SID3U.js","kind":"import-statement"},{"path":"dist/chunk-KQD4IRQZ.js","kind":"import-statement"},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@bitcoinerlab/secp256k1","kind":"import-statement","external":true},{"path":"bitcoinjs-lib","kind":"import-statement","external":true}],"exports":["BTCSigner"],"entryPoint":"src/signers/utxo.ts","inputs":{"src/signers/utxo.ts":{"bytesInOutput":1107},"src/utxo/psbt.ts":{"bytesInOutput":1006}},"bytes":2280},"dist/chunk-4A5SID3U.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2802},"dist/chunk-4A5SID3U.js":{"imports":[{"path":"dist/chunk-KQD4IRQZ.js","kind":"import-statement"}],"exports":["a","b","c"],"inputs":{"src/utxo/config.ts":{"bytesInOutput":585}},"bytes":698},"dist/chunk-KQD4IRQZ.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4510},"dist/chunk-KQD4IRQZ.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","j"],"inputs":{"src/state.ts":{"bytesInOutput":212},"src/utils.ts":{"bytesInOutput":709}},"bytes":1122}}}
1
+ {"inputs":{"src/state.ts":{"bytes":744,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utils.ts":{"bytes":1690,"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":3825,"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/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utxo/config.ts":{"bytes":1961,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utxo/psbt.ts":{"bytes":3426,"imports":[{"path":"@bitcoinerlab/secp256k1","kind":"import-statement","external":true},{"path":"bitcoinjs-lib","kind":"import-statement","external":true},{"path":"src/utxo/config.ts","kind":"import-statement","original":"./config.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signers/utxo.ts":{"bytes":2629,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"src/utxo/config.ts","kind":"import-statement","original":"../utxo/config.js"},{"path":"src/utxo/psbt.ts","kind":"import-statement","original":"../utxo/psbt.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":702,"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":"src/signers/utxo.ts","kind":"dynamic-import","original":"./signers/utxo.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":2728,"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/utxo/config.ts","kind":"import-statement","original":"./utxo/config.js"}],"format":"esm"},"src/init.ts":{"bytes":571,"imports":[{"path":"src/provider.ts","kind":"import-statement","original":"./provider.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm.ts":{"bytes":1477,"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/init.ts","kind":"import-statement","original":"../init.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"}],"format":"esm"},"src/actions/utxo.ts":{"bytes":1692,"imports":[{"path":"@rango-dev/wallets-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"src/init.ts","kind":"import-statement","original":"../init.js"},{"path":"src/state.ts","kind":"import-statement","original":"../state.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"src/utxo/config.ts","kind":"import-statement","original":"../utxo/config.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/utxo.ts":{"bytes":736,"imports":[{"path":"@hub3js/core","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-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"src/actions/utxo.ts","kind":"import-statement","original":"../actions/utxo.js"},{"path":"src/constants.ts","kind":"import-statement","original":"../constants.js"}],"format":"esm"},"src/provider.ts":{"bytes":878,"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":"src/namespaces/utxo.ts","kind":"import-statement","original":"./namespaces/utxo.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/mod.ts":{"bytes":209,"imports":[{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"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":14560},"dist/mod.js":{"imports":[{"path":"dist/chunk-HUUVMU7F.js","kind":"import-statement"},{"path":"dist/chunk-FTGT4J2G.js","kind":"import-statement"},{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"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":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"dist/ethereum-WJFMSBHD.js","kind":"dynamic-import"},{"path":"dist/utxo-MZNQ2QK4.js","kind":"dynamic-import"},{"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":"@hub3js/core","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-core/namespaces/utxo","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/utxo","kind":"import-statement","external":true}],"exports":["versions"],"entryPoint":"src/mod.ts","inputs":{"src/mod.ts":{"bytesInOutput":110},"src/provider.ts":{"bytesInOutput":353},"src/constants.ts":{"bytesInOutput":1141},"src/signer.ts":{"bytesInOutput":412},"src/namespaces/evm.ts":{"bytesInOutput":650},"src/init.ts":{"bytesInOutput":113},"src/namespaces/utxo.ts":{"bytesInOutput":342},"src/actions/utxo.ts":{"bytesInOutput":470}},"bytes":3776},"dist/ethereum-WJFMSBHD.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6428},"dist/ethereum-WJFMSBHD.js":{"imports":[{"path":"dist/chunk-FTGT4J2G.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":1474}},"bytes":1637},"dist/utxo-MZNQ2QK4.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":9115},"dist/utxo-MZNQ2QK4.js":{"imports":[{"path":"dist/chunk-HUUVMU7F.js","kind":"import-statement"},{"path":"dist/chunk-FTGT4J2G.js","kind":"import-statement"},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@bitcoinerlab/secp256k1","kind":"import-statement","external":true},{"path":"bitcoinjs-lib","kind":"import-statement","external":true}],"exports":["BTCSigner"],"entryPoint":"src/signers/utxo.ts","inputs":{"src/signers/utxo.ts":{"bytesInOutput":1107},"src/utxo/psbt.ts":{"bytesInOutput":1006}},"bytes":2280},"dist/chunk-HUUVMU7F.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2802},"dist/chunk-HUUVMU7F.js":{"imports":[{"path":"dist/chunk-FTGT4J2G.js","kind":"import-statement"}],"exports":["a","b","c"],"inputs":{"src/utxo/config.ts":{"bytesInOutput":585}},"bytes":698},"dist/chunk-FTGT4J2G.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3943},"dist/chunk-FTGT4J2G.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":212},"src/utils.ts":{"bytesInOutput":615}},"bytes":1021}}}
package/dist/utils.d.ts CHANGED
@@ -11,5 +11,4 @@ export declare function getTrezorModule(): Promise<TrezorConnect | (Omit<TrezorC
11
11
  requestWebUSBDevice: () => void;
12
12
  })>;
13
13
  export declare function getEthereumAccounts(): Promise<ProviderConnectResult>;
14
- export declare const valueToHex: (value: string) => string;
15
14
  export declare const getTrezorNormalizedDerivationPath: (path: string) => string;
@@ -1,2 +1,2 @@
1
- import{a as d,c as h}from"./chunk-4A5SID3U.js";import{a as s,e as g,g as m}from"./chunk-KQD4IRQZ.js";import{Networks as S}from"@rango-dev/wallets-shared";import{SignerError as B}from"rango-types";import*as x from"@bitcoinerlab/secp256k1";import*as e from"bitcoinjs-lib";e.initEccLib(x);var z=s(o=>Buffer.from(o).reverse().toString("hex"),"reverseTxid");function l(o,n,c=e.networks.bitcoin){let r=e.Psbt.fromBase64(o,{network:c}),u=h(n),T=r.txInputs.map((t,p)=>{let i=r.data.inputs[p];if(i.sighashType!=null&&i.sighashType!==e.Transaction.SIGHASH_ALL)throw new Error(`PSBT input #${p} uses sighash type ${i.sighashType}; only SIGHASH_ALL is supported.`);let a=i.witnessUtxo??e.Transaction.fromBuffer(i.nonWitnessUtxo).outs[t.index];return{address_n:n,prev_hash:z(t.hash),prev_index:t.index,amount:a.value.toString(),script_type:u,sequence:t.sequence}}),f=r.txOutputs.map(t=>t.address?{script_type:"PAYTOADDRESS",address:t.address,amount:t.value.toString()}:{script_type:"PAYTOOPRETURN",amount:"0",op_return_data:(e.script.decompile(t.script)?.find(Buffer.isBuffer)??Buffer.alloc(0)).toString("hex")});return{inputs:T,outputs:f,version:r.version,locktime:r.locktime}}s(l,"buildTrezorBitcoinTransaction");function w(o){return new Error(o.code?`${o.error} (${o.code})`:o.error)}s(w,"getTrezorErrorMessage");var b=class{static{s(this,"BTCSigner")}async signMessage(){throw B.UnimplementedError("signMessage")}async signAndSendTx(n){let{blockchain:c}=n.asset;if(c!==S.BTC)throw new Error(`Signing ${c} transactions is not supported by Trezor.`);let{psbt:r}=n;if(!r)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");let u=g();if(!u)throw new Error("No connected Bitcoin account found. Please connect the wallet first.");let T=await m(),{inputs:f,outputs:t,version:p,locktime:i}=l(r.unsignedPsbtBase64,u),a=await T.signTransaction({coin:d,inputs:f,outputs:t,version:p,locktime:i,push:!0});if(!a.success)throw w(a.payload);return{hash:await this.#r(a.payload)}}async#r(n){if(n.txid)return n.txid;if(!n.serializedTx)throw new Error("Trezor did not return a transaction id.");let r=await(await m()).pushTransaction({tx:n.serializedTx,coin:d});if(!r.success)throw w(r.payload);return r.payload.txid}};export{b as BTCSigner};
2
- //# sourceMappingURL=utxo-BVUYSP2M.js.map
1
+ import{a as d,c as h}from"./chunk-HUUVMU7F.js";import{a as s,e as g,g as m}from"./chunk-FTGT4J2G.js";import{Networks as S}from"@rango-dev/wallets-shared";import{SignerError as B}from"rango-types";import*as x from"@bitcoinerlab/secp256k1";import*as e from"bitcoinjs-lib";e.initEccLib(x);var z=s(o=>Buffer.from(o).reverse().toString("hex"),"reverseTxid");function l(o,n,c=e.networks.bitcoin){let r=e.Psbt.fromBase64(o,{network:c}),u=h(n),T=r.txInputs.map((t,p)=>{let i=r.data.inputs[p];if(i.sighashType!=null&&i.sighashType!==e.Transaction.SIGHASH_ALL)throw new Error(`PSBT input #${p} uses sighash type ${i.sighashType}; only SIGHASH_ALL is supported.`);let a=i.witnessUtxo??e.Transaction.fromBuffer(i.nonWitnessUtxo).outs[t.index];return{address_n:n,prev_hash:z(t.hash),prev_index:t.index,amount:a.value.toString(),script_type:u,sequence:t.sequence}}),f=r.txOutputs.map(t=>t.address?{script_type:"PAYTOADDRESS",address:t.address,amount:t.value.toString()}:{script_type:"PAYTOOPRETURN",amount:"0",op_return_data:(e.script.decompile(t.script)?.find(Buffer.isBuffer)??Buffer.alloc(0)).toString("hex")});return{inputs:T,outputs:f,version:r.version,locktime:r.locktime}}s(l,"buildTrezorBitcoinTransaction");function w(o){return new Error(o.code?`${o.error} (${o.code})`:o.error)}s(w,"getTrezorErrorMessage");var b=class{static{s(this,"BTCSigner")}async signMessage(){throw B.UnimplementedError("signMessage")}async signAndSendTx(n){let{blockchain:c}=n.asset;if(c!==S.BTC)throw new Error(`Signing ${c} transactions is not supported by Trezor.`);let{psbt:r}=n;if(!r)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");let u=g();if(!u)throw new Error("No connected Bitcoin account found. Please connect the wallet first.");let T=await m(),{inputs:f,outputs:t,version:p,locktime:i}=l(r.unsignedPsbtBase64,u),a=await T.signTransaction({coin:d,inputs:f,outputs:t,version:p,locktime:i,push:!0});if(!a.success)throw w(a.payload);return{hash:await this.#r(a.payload)}}async#r(n){if(n.txid)return n.txid;if(!n.serializedTx)throw new Error("Trezor did not return a transaction id.");let r=await(await m()).pushTransaction({tx:n.serializedTx,coin:d});if(!r.success)throw w(r.payload);return r.payload.txid}};export{b as BTCSigner};
2
+ //# sourceMappingURL=utxo-MZNQ2QK4.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/provider-trezor",
3
- "version": "0.28.1-next.3",
3
+ "version": "0.29.1-next.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/mod.ts",
@@ -25,8 +25,8 @@
25
25
  "@hub3js/core": "^0.61.0",
26
26
  "@hub3js/evm": "^0.3.0",
27
27
  "@hub3js/std": "^0.2.0",
28
- "@rango-dev/signer-evm": "^0.43.0",
29
- "@rango-dev/wallets-shared": "^0.61.1-next.2",
28
+ "@rango-dev/signer-evm": "^0.44.0",
29
+ "@rango-dev/wallets-shared": "^0.61.1-next.3",
30
30
  "@trezor/connect-web": "^9.5.0",
31
31
  "bitcoinjs-lib": "^6.1.7",
32
32
  "ethers": "^6.13.2",
@@ -1,12 +1,12 @@
1
1
  import type { EvmTransaction } from 'rango-types/mainApi';
2
2
 
3
- import { cleanEvmError } from '@rango-dev/signer-evm';
3
+ import { cleanEvmError, toHexQuantity } from '@rango-dev/signer-evm';
4
4
  import { DEFAULT_ETHEREUM_RPC_URL } from '@rango-dev/wallets-shared';
5
5
  import { JsonRpcProvider, Transaction } from 'ethers';
6
6
  import { type GenericSigner } from 'rango-types';
7
7
 
8
8
  import { getDerivationPath } from '../state.js';
9
- import { getTrezorModule, trezorErrorMessages, valueToHex } from '../utils.js';
9
+ import { getTrezorModule, trezorErrorMessages } from '../utils.js';
10
10
 
11
11
  export function getTrezorErrorMessage(error: unknown) {
12
12
  if (
@@ -61,20 +61,20 @@ export class EthereumSigner implements GenericSigner<EvmTransaction> {
61
61
  const transactionCount = await provider.getTransactionCount(fromAddress); // Get nonce
62
62
  const additionalFields = isEIP1559
63
63
  ? {
64
- maxFeePerGas: valueToHex(maxFeePerGas || '0'),
65
- maxPriorityFeePerGas: valueToHex(maxPriorityFeePerGas || '0'),
64
+ maxFeePerGas: toHexQuantity(maxFeePerGas || '0'),
65
+ maxPriorityFeePerGas: toHexQuantity(maxPriorityFeePerGas || '0'),
66
66
  }
67
67
  : {
68
- gasPrice: valueToHex(gasPrice || '0'),
68
+ gasPrice: toHexQuantity(gasPrice || '0'),
69
69
  };
70
70
 
71
71
  const transaction = {
72
72
  to: tx.to,
73
73
  data: tx.data || '0x',
74
- value: valueToHex(tx.value?.toString() || '0'),
75
- gasLimit: valueToHex(tx.gasLimit?.toString() || '0'),
74
+ value: toHexQuantity(tx.value?.toString() || '0'),
75
+ gasLimit: toHexQuantity(tx.gasLimit?.toString() || '0'),
76
76
  chainId: Number.parseInt(chainId),
77
- nonce: valueToHex(transactionCount.toString()),
77
+ nonce: toHexQuantity(transactionCount.toString()),
78
78
  ...additionalFields,
79
79
  };
80
80
 
package/src/utils.ts CHANGED
@@ -46,18 +46,6 @@ export async function getEthereumAccounts(): Promise<ProviderConnectResult> {
46
46
  };
47
47
  }
48
48
 
49
- /*
50
- * Using BigInt in the valueToHex function ensures that the function
51
- * can handle very large integer values that exceed the range of standard JavaScript number types.
52
- */
53
- export const valueToHex = (value: string) => {
54
- const ZERO_BIGINT = BigInt(0);
55
- const HEX_BASE = 16;
56
- return BigInt(value) > ZERO_BIGINT
57
- ? `0x${BigInt(value).toString(HEX_BASE)}`
58
- : '0x0';
59
- };
60
-
61
49
  export const getTrezorNormalizedDerivationPath = (
62
50
  path: string // TrezorConnect needs master node to be added to derivation path
63
51
  ) => (path && !path.startsWith('m/') ? 'm/' + path : path);
@@ -1,2 +0,0 @@
1
- var s=Object.defineProperty;var e=(t,r)=>s(t,"name",{value:r,configurable:!0});var n="";function g(t){n=t}e(g,"setDerivationPath");function i(){return n}e(i,"getDerivationPath");var a="";function l(t){a=t}e(l,"setBitcoinDerivationPath");function m(){return a}e(m,"getBitcoinDerivationPath");import{dynamicImportWithRefinedError as c,ETHEREUM_CHAIN_ID as u}from"@rango-dev/wallets-shared";var P={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");async function v(){let t=await d(),r=i(),o=await t.ethereumGetAddress({path:r});if(!o.success)throw new Error(o.payload.error);return{accounts:[o.payload.address],chainId:u,derivationPath:r}}e(v,"getEthereumAccounts");var I=e(t=>{let r=BigInt(0);return BigInt(t)>r?`0x${BigInt(t).toString(16)}`:"0x0"},"valueToHex"),w=e(t=>t&&!t.startsWith("m/")?"m/"+t:t,"getTrezorNormalizedDerivationPath");export{e as a,g as b,i as c,l as d,m as e,P as f,d as g,v as h,I as i,w as j};
2
- //# sourceMappingURL=chunk-KQD4IRQZ.js.map
@@ -1,2 +0,0 @@
1
- import{a as p,c as u,f as P,g as h,i as t}from"./chunk-KQD4IRQZ.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-CRCQQH34.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 { getDerivationPath } from '../state.js';\nimport { getTrezorModule, trezorErrorMessages, valueToHex } from '../utils.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,cAK5B,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,CA1BrE,MA0BqE,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
- }