@rango-dev/provider-trezor 0.13.1-next.1 → 0.13.1-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-C6TCVRNL.js +2 -0
- package/dist/chunk-C6TCVRNL.js.map +7 -0
- package/dist/{ethereum-2ZKMGNFA.js → ethereum-56FGPA2J.js} +2 -2
- package/dist/helpers.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/provider-trezor.build.json +1 -1
- package/package.json +2 -2
- package/src/helpers.ts +9 -6
- package/dist/chunk-VKZ2HTGF.js +0 -2
- package/dist/chunk-VKZ2HTGF.js.map +0 -7
- /package/dist/{ethereum-2ZKMGNFA.js.map → ethereum-56FGPA2J.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var a=Object.defineProperty;var e=(t,r)=>a(t,"name",{value:r,configurable:!0});var o="";function g(t){o=t}e(g,"setDerivationPath");function s(){return o}e(s,"getDerivationPath");import{ETHEREUM_CHAIN_ID as i,Networks as c}from"@rango-dev/wallets-shared";var E={Failure_ActionCancelled:"User rejected the transaction."};async function u(){let t=await import("@trezor/connect-web");return t.default.default?t.default.default:t.default}e(u,"getTrezorModule");function h(){let t=new Map;return t.set(c.ETHEREUM,{chainId:i}),t}e(h,"getTrezorInstance");async function x(){let t=await u(),r=s(),n=await t.ethereumGetAddress({path:r});if(!n.success)throw new Error(n.payload.error);return{accounts:[n.payload.address],chainId:i,derivationPath:r}}e(x,"getEthereumAccounts");var I=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,s as c,E as d,u as e,h as f,x as g,I as h,T as i};
|
|
2
|
+
//# sourceMappingURL=chunk-C6TCVRNL.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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 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 import('@trezor/connect-web');\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,qBAAAC,EACA,YAAAC,MAEK,4BAIA,IAAMC,EAAwD,CACnE,wBAAyB,gCAC3B,EAGA,eAAsBC,GAAkB,CACtC,IAAMC,EAAM,KAAM,QAAO,qBAAqB,EAG9C,OAAIA,EAAI,QAAQ,QAGPA,EAAI,QAAQ,QAGdA,EAAI,OACb,CAXsBC,EAAAF,EAAA,mBAaf,SAASG,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,MAAMR,EAAgB,EACtCS,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", "ETHEREUM_CHAIN_ID", "Networks", "trezorErrorMessages", "getTrezorModule", "mod", "__name", "getTrezorInstance", "instances", "Networks", "ETHEREUM_CHAIN_ID", "getEthereumAccounts", "TrezorConnect", "derivationPath", "getDerivationPath", "result", "valueToHex", "value", "ZERO_BIGINT", "getTrezorNormalizedDerivationPath", "path"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p,c as u,d as P,e as h,h as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=ethereum-
|
|
1
|
+
import{a as p,c as u,d as P,e as h,h as e}from"./chunk-C6TCVRNL.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-56FGPA2J.js.map
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TrezorConnect } from '@trezor/connect-web';
|
|
2
|
+
import { type ProviderConnectResult } from '@rango-dev/wallets-shared';
|
|
2
3
|
export declare const trezorErrorMessages: {
|
|
3
4
|
[statusCode: string]: string;
|
|
4
5
|
};
|
|
@@ -10,9 +11,6 @@ export declare function getTrezorModule(): Promise<TrezorConnect | (Omit<TrezorC
|
|
|
10
11
|
requestWebUSBDevice: () => void;
|
|
11
12
|
})>;
|
|
12
13
|
export declare function getTrezorInstance(): Map<any, any>;
|
|
13
|
-
export declare function getEthereumAccounts(): Promise<
|
|
14
|
-
accounts: string[];
|
|
15
|
-
chainId: string;
|
|
16
|
-
}>;
|
|
14
|
+
export declare function getEthereumAccounts(): Promise<ProviderConnectResult>;
|
|
17
15
|
export declare const valueToHex: (value: string) => string;
|
|
18
16
|
export declare const getTrezorNormalizedDerivationPath: (path: string) => string;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r,b as s,e as c,f as l,g as m,i as p}from"./chunk-
|
|
1
|
+
import{a as r,b as s,e as c,f as l,g as m,i as p}from"./chunk-C6TCVRNL.js";import{Networks as g,WalletTypes as y}from"@rango-dev/wallets-shared";import"rango-types";import{DefaultSignerFactory as f,TransactionType as u}from"rango-types";async function i(){let t=new f,{EthereumSigner:n}=await import("./ethereum-56FGPA2J.js");return t.registerSigner(u.EVM,new n),t}r(i,"getSigners");var h={appUrl:"",email:""},S={type:y.TREZOR},b=r(t=>{h=t.manifest},"init"),k=l,d=!1,D=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 m();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"),C=i,I=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{S as config,D as connect,k as getInstance,C as getSigners,I as getWalletInfo,b as init};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/state.ts":{"bytes":290,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/state.ts":{"bytes":290,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":2343,"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":394,"imports":[{"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":7139},"dist/index.js":{"imports":[{"path":"dist/chunk-C6TCVRNL.js","kind":"import-statement"},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"dist/ethereum-56FGPA2J.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":218}},"bytes":2120},"dist/ethereum-56FGPA2J.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6222},"dist/ethereum-56FGPA2J.js":{"imports":[{"path":"dist/chunk-C6TCVRNL.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-C6TCVRNL.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4206},"dist/chunk-C6TCVRNL.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":761}},"bytes":1054}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-trezor",
|
|
3
|
-
"version": "0.13.1-next.
|
|
3
|
+
"version": "0.13.1-next.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@rango-dev/signer-evm": "^0.37.1-next.0",
|
|
28
|
-
"@rango-dev/wallets-shared": "^0.46.1-next.
|
|
28
|
+
"@rango-dev/wallets-shared": "^0.46.1-next.3",
|
|
29
29
|
"@trezor/connect-web": "^9.5.0",
|
|
30
30
|
"ethers": "^6.13.2",
|
|
31
31
|
"rango-types": "^0.1.88"
|
package/src/helpers.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { TrezorConnect } from '@trezor/connect-web';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ETHEREUM_CHAIN_ID,
|
|
5
|
+
Networks,
|
|
6
|
+
type ProviderConnectResult,
|
|
7
|
+
} from '@rango-dev/wallets-shared';
|
|
4
8
|
|
|
5
9
|
import { getDerivationPath } from './state.js';
|
|
6
10
|
|
|
@@ -34,13 +38,11 @@ export function getTrezorInstance() {
|
|
|
34
38
|
return instances;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
export async function getEthereumAccounts(): Promise<{
|
|
38
|
-
accounts: string[];
|
|
39
|
-
chainId: string;
|
|
40
|
-
}> {
|
|
41
|
+
export async function getEthereumAccounts(): Promise<ProviderConnectResult> {
|
|
41
42
|
const TrezorConnect = await getTrezorModule();
|
|
43
|
+
const derivationPath = getDerivationPath();
|
|
42
44
|
const result = await TrezorConnect.ethereumGetAddress({
|
|
43
|
-
path:
|
|
45
|
+
path: derivationPath,
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
if (!result.success) {
|
|
@@ -50,6 +52,7 @@ export async function getEthereumAccounts(): Promise<{
|
|
|
50
52
|
return {
|
|
51
53
|
accounts: [result.payload.address],
|
|
52
54
|
chainId: ETHEREUM_CHAIN_ID,
|
|
55
|
+
derivationPath,
|
|
53
56
|
};
|
|
54
57
|
}
|
|
55
58
|
|
package/dist/chunk-VKZ2HTGF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var r=(t,e)=>i(t,"name",{value:e,configurable:!0});var n="";function g(t){n=t}r(g,"setDerivationPath");function o(){return n}r(o,"getDerivationPath");import{ETHEREUM_CHAIN_ID as s,Networks as a}from"@rango-dev/wallets-shared";var E={Failure_ActionCancelled:"User rejected the transaction."};async function c(){let t=await import("@trezor/connect-web");return t.default.default?t.default.default:t.default}r(c,"getTrezorModule");function h(){let t=new Map;return t.set(a.ETHEREUM,{chainId:s}),t}r(h,"getTrezorInstance");async function x(){let e=await(await c()).ethereumGetAddress({path:o()});if(!e.success)throw new Error(e.payload.error);return{accounts:[e.payload.address],chainId:s}}r(x,"getEthereumAccounts");var I=r(t=>{let e=BigInt(0);return BigInt(t)>e?`0x${BigInt(t).toString(16)}`:"0x0"},"valueToHex"),T=r(t=>t&&!t.startsWith("m/")?"m/"+t:t,"getTrezorNormalizedDerivationPath");export{r as a,g as b,o as c,E as d,c as e,h as f,x as g,I as h,T as i};
|
|
2
|
-
//# sourceMappingURL=chunk-VKZ2HTGF.js.map
|
|
@@ -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 { ETHEREUM_CHAIN_ID, Networks } 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 import('@trezor/connect-web');\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<{\n accounts: string[];\n chainId: string;\n}> {\n const TrezorConnect = await getTrezorModule();\n const result = await TrezorConnect.ethereumGetAddress({\n path: getDerivationPath(),\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 };\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,OAAS,qBAAAC,EAAmB,YAAAC,MAAgB,4BAIrC,IAAMC,EAAwD,CACnE,wBAAyB,gCAC3B,EAGA,eAAsBC,GAAkB,CACtC,IAAMC,EAAM,KAAM,QAAO,qBAAqB,EAG9C,OAAIA,EAAI,QAAQ,QAGPA,EAAI,QAAQ,QAGdA,EAAI,OACb,CAXsBC,EAAAF,EAAA,mBAaf,SAASG,GAAoB,CAKlC,IAAMC,EAAY,IAAI,IAEtB,OAAAA,EAAU,IAAIC,EAAS,SAAU,CAAE,QAASC,CAAkB,CAAC,EAExDF,CACT,CAVgBF,EAAAC,EAAA,qBAYhB,eAAsBI,GAGnB,CAED,IAAMC,EAAS,MADO,MAAMR,EAAgB,GACT,mBAAmB,CACpD,KAAMS,EAAkB,CAC1B,CAAC,EAED,GAAI,CAACD,EAAO,QACV,MAAM,IAAI,MAAMA,EAAO,QAAQ,KAAK,EAGtC,MAAO,CACL,SAAU,CAACA,EAAO,QAAQ,OAAO,EACjC,QAASF,CACX,CACF,CAjBsBJ,EAAAK,EAAA,uBAuBf,IAAMG,EAAaR,EAACS,GAAkB,CAC3C,IAAMC,EAAc,OAAO,CAAC,EAE5B,OAAO,OAAOD,CAAK,EAAIC,EACnB,KAAK,OAAOD,CAAK,EAAE,SAFN,EAEuB,CAAC,GACrC,KACN,EAN0B,cAQbE,EAAoCX,EAC/CY,GACIA,GAAQ,CAACA,EAAK,WAAW,IAAI,EAAI,KAAOA,EAAOA,EAFJ",
|
|
6
|
-
"names": ["derivationPath", "setDerivationPath", "path", "__name", "getDerivationPath", "ETHEREUM_CHAIN_ID", "Networks", "trezorErrorMessages", "getTrezorModule", "mod", "__name", "getTrezorInstance", "instances", "Networks", "ETHEREUM_CHAIN_ID", "getEthereumAccounts", "result", "getDerivationPath", "valueToHex", "value", "ZERO_BIGINT", "getTrezorNormalizedDerivationPath", "path"]
|
|
7
|
-
}
|
|
File without changes
|