@rango-dev/provider-trezor 0.30.1-next.3 → 0.30.1-next.5
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/actions/utxo.d.ts +2 -2
- package/dist/chunk-PCTGR6CA.js +2 -0
- package/dist/chunk-PCTGR6CA.js.map +7 -0
- package/dist/{ethereum-DOIFSVS7.js → ethereum-INXKZXQW.js} +2 -2
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +3 -3
- package/dist/namespaces/utxo.d.ts +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/{utxo-CA5LKN6D.js → utxo-L7GRAPNY.js} +2 -2
- package/package.json +8 -7
- package/src/actions/utxo.ts +6 -10
- package/src/constants.ts +5 -7
- package/src/namespaces/utxo.ts +3 -3
- package/dist/chunk-UYZGJZGU.js +0 -2
- package/dist/chunk-UYZGJZGU.js.map +0 -7
- /package/dist/{ethereum-DOIFSVS7.js.map → ethereum-INXKZXQW.js.map} +0 -0
- /package/dist/{utxo-CA5LKN6D.js.map → utxo-L7GRAPNY.js.map} +0 -0
package/dist/actions/utxo.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import type { Bip122ChainId, UtxoActions } from '@hub3js/bip122';
|
|
1
2
|
import type { Context, FunctionWithContext } from '@hub3js/core';
|
|
2
|
-
import type { UtxoActions } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
3
3
|
/**
|
|
4
4
|
* Connect the Bitcoin account for the selected derivation path: derive the receive
|
|
5
5
|
* address and return it CAIP-encoded with the bip122 Bitcoin chain id. The path is kept
|
|
6
6
|
* (like the EVM namespace does) because Rango's PSBT has no derivation data, so the
|
|
7
7
|
* signer needs it at signing time.
|
|
8
8
|
*/
|
|
9
|
-
export declare function connect(): FunctionWithContext<UtxoActions['connect'], Context>;
|
|
9
|
+
export declare function connect(network: Bip122ChainId): FunctionWithContext<UtxoActions['connect'], Context>;
|
|
10
10
|
export declare const utxoActions: {
|
|
11
11
|
connect: typeof connect;
|
|
12
12
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var m=Object.defineProperty;var t=(e,r)=>m(e,"name",{value:r,configurable:!0});var a="";function y(e){a=e}t(y,"setDerivationPath");function s(){return a}t(s,"getDerivationPath");var p="";function f(e){p=e}t(f,"setBitcoinDerivationPath");function I(){return p}t(I,"getBitcoinDerivationPath");import{CAIP_BITCOIN_CHAIN_ID as S,isChainSupported as T}from"@hub3js/bip122";import{CAIP_ETHEREUM_CHAIN_ID as u,isEvmNamespace as E}from"@hub3js/evm";import{getChainIdFromCaip2ChainId as D}from"@hub3js/std/utils";import{DefaultSignerFactory as l,TransactionType as c}from"rango-types";async function n(){let e=new l,{EthereumSigner:r}=await import("./ethereum-INXKZXQW.js"),{BTCSigner:i}=await import("./utxo-L7GRAPNY.js");return e.registerSigner(c.EVM,new r),e.registerSigner(c.TRANSFER,new i),e}t(n,"getSigners");var w="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 _(e){let r=Number.parseInt(e.replace(/^m\//,"").split("/")[0]?.replace(/['h]$/,"")??"",10),i=o.find(d=>d.purpose===r);if(!i)throw new Error(`Unsupported Bitcoin derivation path: ${e}`);return i.inputScriptType}t(_,"resolveBitcoinScriptType");var L="trezor",h=16,g=`0x${Number(u).toString(h)}`,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",isChainSupported:e=>E(e)&&D(e)===u},{label:"Bitcoin",value:"UTXO",id:"BTC",isChainSupported:T([S])}]}},{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}`},...o.map(e=>({id:`bitcoin-${e.id}`,label:`${e.label} (m/${e.purpose}'/0'/index')`,namespace:"UTXO",generateDerivationPath:r=>`${e.purpose}'/0'/${r}'/0/0`}))]}},{name:"signers",value:{getSigners:async()=>n()}}]};var k={Failure_ActionCancelled:"User rejected the transaction."};async function P(){let e=await import("@trezor/connect-web");return e.default.default?e.default.default:e.default}t(P,"getTrezorModule");async function X(){let e=await P(),r=s(),i=await e.ethereumGetAddress({path:r});if(!i.success)throw new Error(i.payload.error);return{accounts:[i.payload.address],chainId:g,derivationPath:r}}t(X,"getEthereumAccounts");var j=t(e=>e&&!e.startsWith("m/")?"m/"+e:e,"getTrezorNormalizedDerivationPath");export{t as a,y as b,s as c,f as d,I as e,k as f,P as g,X as h,j as i,w as j,_ as k,L as l,g as m,W as n};
|
|
2
|
+
//# sourceMappingURL=chunk-PCTGR6CA.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/state.ts", "../src/constants.ts", "../src/signer.ts", "../src/utxo/config.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 { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_BITCOIN_CHAIN_ID,\n isChainSupported as isBip122ChainSupported,\n} from '@hub3js/bip122';\nimport { CAIP_ETHEREUM_CHAIN_ID, isEvmNamespace } from '@hub3js/evm';\nimport { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';\n\nimport getSigners from './signer.js';\nimport { BITCOIN_ADDRESS_TYPES } from './utxo/config.js';\n\nexport const WALLET_ID = 'trezor';\n\nconst HEXADECIMAL_BASE = 16;\nexport const ETHEREUM_CHAIN_ID = `0x${Number(CAIP_ETHEREUM_CHAIN_ID).toString(\n HEXADECIMAL_BASE\n)}`;\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 isChainSupported: (chainId: string) =>\n isEvmNamespace(chainId) &&\n getChainIdFromCaip2ChainId(chainId) === CAIP_ETHEREUM_CHAIN_ID,\n },\n {\n label: 'Bitcoin',\n value: 'UTXO',\n id: 'BTC',\n isChainSupported: isBip122ChainSupported([CAIP_BITCOIN_CHAIN_ID]),\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 * Bitcoin derivation templates. The BIP-43 purpose (and thus the address\n * type) is what the user picks here; `index` selects the account.\n */\n ...BITCOIN_ADDRESS_TYPES.map((addressType) => ({\n id: `bitcoin-${addressType.id}`,\n label: `${addressType.label} (m/${addressType.purpose}'/0'/index')`,\n namespace: 'UTXO',\n generateDerivationPath: (index: string) =>\n `${addressType.purpose}'/0'/${index}'/0/0`,\n })),\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners() },\n },\n ],\n};\n", "import type { SignerFactory } from 'rango-types';\n\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 import('./signers/ethereum.js');\n const { BTCSigner } = await import('./signers/utxo.js');\n signers.registerSigner(TxType.EVM, new EthereumSigner());\n signers.registerSigner(TxType.TRANSFER, new BTCSigner());\n return signers;\n}\n", "/*\n * Trezor needs the input `script_type` to sign a Bitcoin input. It is determined by the\n * BIP-43 `purpose` of the derivation path the address was derived from, so we expose the\n * four common address types and let the user connect whichever one they hold funds on.\n */\nexport type TrezorInputScriptType =\n | 'SPENDADDRESS'\n | 'SPENDP2SHWITNESS'\n | 'SPENDWITNESS'\n | 'SPENDTAPROOT';\n\nexport interface BitcoinAddressType {\n /** Stable id used in the derivationPath metadata entries. */\n id: 'legacy' | 'nested-segwit' | 'native-segwit' | 'taproot';\n label: string;\n /** BIP-43 purpose: 44 legacy, 49 nested segwit, 84 native segwit, 86 taproot. */\n purpose: number;\n inputScriptType: TrezorInputScriptType;\n}\n\nexport const BITCOIN_COIN_NAME = 'btc';\n\nexport const BITCOIN_ADDRESS_TYPES: readonly BitcoinAddressType[] = [\n {\n id: 'native-segwit',\n label: 'Native SegWit',\n purpose: 84,\n inputScriptType: 'SPENDWITNESS',\n },\n {\n id: 'nested-segwit',\n label: 'Nested SegWit',\n purpose: 49,\n inputScriptType: 'SPENDP2SHWITNESS',\n },\n {\n id: 'legacy',\n label: 'Legacy',\n purpose: 44,\n inputScriptType: 'SPENDADDRESS',\n },\n {\n id: 'taproot',\n label: 'Taproot',\n purpose: 86,\n inputScriptType: 'SPENDTAPROOT',\n },\n] as const;\n\n/**\n * Resolve the Trezor input script type for a derivation path by reading its BIP-43\n * purpose (the first hardened level). The path always comes from one of our own\n * derivation templates, so an unknown purpose is a programming error.\n */\nexport function resolveBitcoinScriptType(path: string): TrezorInputScriptType {\n const purpose = Number.parseInt(\n path.replace(/^m\\//, '').split('/')[0]?.replace(/['h]$/, '') ?? '',\n 10\n );\n const addressType = BITCOIN_ADDRESS_TYPES.find(\n (type) => type.purpose === purpose\n );\n if (!addressType) {\n throw new Error(`Unsupported Bitcoin derivation path: ${path}`);\n }\n return addressType.inputScriptType;\n}\n", "import type { TrezorConnect } from '@trezor/connect-web';\n\nimport { ETHEREUM_CHAIN_ID } from './constants.js';\nimport { getDerivationPath } from './state.js';\n\ntype DeviceAccounts = {\n accounts: string[];\n chainId: string;\n derivationPath: string;\n};\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 async function getEthereumAccounts(): Promise<DeviceAccounts> {\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,yBAAAC,EACA,oBAAoBC,MACf,iBACP,OAAS,0BAAAC,EAAwB,kBAAAC,MAAsB,cACvD,OAAS,8BAAAC,MAAkC,oBCL3C,OAAS,wBAAAC,EAAsB,mBAAmBC,MAAc,cAEhE,eAAOC,GAA4D,CACjE,IAAMC,EAAU,IAAIC,EACd,CAAE,eAAAC,CAAe,EAAI,KAAM,QAAO,wBAAuB,EACzD,CAAE,UAAAC,CAAU,EAAI,KAAM,QAAO,oBAAmB,EACtD,OAAAH,EAAQ,eAAeI,EAAO,IAAK,IAAIF,CAAgB,EACvDF,EAAQ,eAAeI,EAAO,SAAU,IAAID,CAAW,EAChDH,CACT,CAP8BK,EAAAN,EAAA,cCgBvB,IAAMO,EAAoB,MAEpBC,EAAuD,CAClE,CACE,GAAI,gBACJ,MAAO,gBACP,QAAS,GACT,gBAAiB,cACnB,EACA,CACE,GAAI,gBACJ,MAAO,gBACP,QAAS,GACT,gBAAiB,kBACnB,EACA,CACE,GAAI,SACJ,MAAO,SACP,QAAS,GACT,gBAAiB,cACnB,EACA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ACX,uBAAyBF,GACvB,GAAGE,EAAY,OAAO,QAAQF,CAAK,OACvC,EAAE,CACJ,CACF,CACF,EACA,CACE,KAAM,UACN,MAAO,CAAE,WAAY,SAAYG,EAAW,CAAE,CAChD,CACF,CACF,EG9EO,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,mBAatB,eAAsBG,GAA+C,CACnE,IAAMC,EAAgB,MAAMJ,EAAgB,EACtCK,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", "CAIP_BITCOIN_CHAIN_ID", "isBip122ChainSupported", "CAIP_ETHEREUM_CHAIN_ID", "isEvmNamespace", "getChainIdFromCaip2ChainId", "DefaultSignerFactory", "TxType", "getSigners", "signers", "DefaultSignerFactory", "EthereumSigner", "BTCSigner", "TxType", "__name", "BITCOIN_COIN_NAME", "BITCOIN_ADDRESS_TYPES", "resolveBitcoinScriptType", "path", "purpose", "addressType", "type", "__name", "WALLET_ID", "HEXADECIMAL_BASE", "ETHEREUM_CHAIN_ID", "CAIP_ETHEREUM_CHAIN_ID", "metadata", "chainId", "isEvmNamespace", "getChainIdFromCaip2ChainId", "isBip122ChainSupported", "CAIP_BITCOIN_CHAIN_ID", "index", "BITCOIN_ADDRESS_TYPES", "addressType", "getSigners", "trezorErrorMessages", "getTrezorModule", "mod", "__name", "getEthereumAccounts", "TrezorConnect", "derivationPath", "getDerivationPath", "result", "ETHEREUM_CHAIN_ID", "getTrezorNormalizedDerivationPath", "path"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p,c as u,f as P,g as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=ethereum-
|
|
1
|
+
import{a as p,c as u,f as P,g as h}from"./chunk-PCTGR6CA.js";import{cleanEvmError as G,DEFAULT_ETHEREUM_RPC_URL as z,toHexQuantity as s}from"@rango-dev/signer-evm";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 E=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),f=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(f.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{E as EthereumSigner,R as getTrezorErrorMessage};
|
|
2
|
+
//# sourceMappingURL=ethereum-INXKZXQW.js.map
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const versions: () => readonly [readonly ["1.0.0", import("@hub3js/core").Provider<Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@
|
|
1
|
+
declare const versions: () => readonly [readonly ["1.0.0", import("@hub3js/core").Provider<Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@hub3js/bip122").UtxoActions>>]];
|
|
2
2
|
export { versions };
|
|
3
3
|
export { WALLET_ID } from './constants.js';
|
package/dist/mod.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t,b as
|
|
1
|
+
import{a as t,b as p,d as u,g as c,h as f,i as a,j as l,k as h,l as i,m as T,n as A}from"./chunk-PCTGR6CA.js";import{defineVersions as q}from"@hub3js/core/utils";import{ProviderBuilder as k}from"@hub3js/core";import{NamespaceBuilder as B}from"@hub3js/core";import{builders as z,utils as g}from"@hub3js/evm";import*as I from"@hub3js/std/builders";import{standardizeAndThrowError as D}from"@hub3js/std/operators";var v=!1;async function m(){if(v)return;await(await c()).init({lazyLoad:!0,manifest:x()}),v=!0}t(m,"initTrezor");var N=z.connect().action(async function(n,e,o){if(!o?.derivationPath)throw new Error("Derivation Path can not be empty.");p(a(o.derivationPath)),await m();let r=await f();return{accounts:g.formatAccountsToCAIP(r.accounts,r.chainId),network:r.chainId}}).or(D).build(),L=I.disconnect().build(),M=z.getChainId().action(()=>T).build(),b=new B("EVM",i).action(N).action(L).action(M).build();import{builders as j,CAIP_BITCOIN_CHAIN_ID as O}from"@hub3js/bip122";import{NamespaceBuilder as H}from"@hub3js/core";import*as E from"@hub3js/std/builders";import{standardizeAndThrowError as S}from"@hub3js/std/operators";import{utils as U}from"@hub3js/bip122";function W(n){return async(e,o)=>{if(!o?.derivationPath)throw new Error("Derivation Path can not be empty.");await m();let r=a(o.derivationPath),d=h(r);u(r);let s=await(await c()).getAddress({path:r,coin:l,scriptType:d,showOnTrezor:!1});if(!s.success)throw new Error(s.payload.error);let{address:_}=s.payload;return U.formatAccountsToCAIP([_],n)}}t(W,"connect");var w={connect:W};var F=j.connect().action(w.connect(O)).or(S).build(),V=E.disconnect().build(),C=new H("UTXO",i).action(F).action(V).build();var y,x=t(()=>y,"getTrezorManifest"),P=t(()=>new k(i).init(function(n,e){let[,o]=n.state();if(!e.manifest)throw new Error("Trezor manifest is required");y=e.manifest,o("installed",!0),console.debug("[trezor] instance detected.",n)}).config("metadata",A).add("evm",b).add("utxo",C).build(),"buildProvider");var Ct=t(()=>q().version("1.0.0",P()).build(),"versions");export{i as WALLET_ID,Ct as versions};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
package/dist/mod.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/mod.ts", "../src/provider.ts", "../src/namespaces/evm.ts", "../src/init.ts", "../src/namespaces/utxo.ts", "../src/actions/utxo.ts"],
|
|
4
|
-
"sourcesContent": ["import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions().version('1.0.0', buildProvider()).build();\n\nexport { versions };\nexport { WALLET_ID } from './constants.js';\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';\nimport { utxo } from './namespaces/utxo.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 .add('utxo', utxo)\n .build();\n\nexport { buildProvider };\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';\n\nimport { ETHEREUM_CHAIN_ID, WALLET_ID } from '../constants.js';\nimport { initTrezor } from '../init.js';\nimport { setDerivationPath } from '../state.js';\nimport {\n getEthereumAccounts,\n getTrezorNormalizedDerivationPath,\n} from '../utils.js';\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 await initTrezor();\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", "import { getTrezorManifest } from './provider.js';\nimport { getTrezorModule } from './utils.js';\n\nlet isTrezorInitialized = false;\n\n/*\n * `TrezorConnect.init` throws if called twice, so initialization is shared across every\n * namespace (EVM, UTXO). `lazyLoad` defers iframe injection until the first method call.\n */\nexport async function initTrezor() {\n if (isTrezorInitialized) {\n return;\n }\n const TrezorConnect = await getTrezorModule();\n await TrezorConnect.init({\n lazyLoad: true,\n manifest: getTrezorManifest(),\n });\n isTrezorInitialized = true;\n}\n", "import type { UtxoActions } from '@
|
|
5
|
-
"mappings": "8GAAA,OAAS,kBAAAA,MAAsB,qBCE/B,OAAS,mBAAAC,MAAuB,eCAhC,OAAS,oBAAAC,MAAwB,eACjC,OAAS,YAAAC,EAAU,SAAAC,MAAa,cAChC,UAAYC,MAAoB,uBAChC,OAAS,4BAAAC,MAAgC,wBCFzC,IAAIC,EAAsB,GAM1B,eAAsBC,GAAa,CACjC,GAAID,EACF,OAGF,MADsB,MAAME,EAAgB,GACxB,KAAK,CACvB,SAAU,GACV,SAAUC,EAAkB,CAC9B,CAAC,EACDH,EAAsB,EACxB,CAVsBI,EAAAH,EAAA,cDMtB,IAAMI,EAAUC,EACb,QAAQ,EACR,OAAO,eAAgBC,EAAUC,EAAQC,EAAS,CACjD,GAAI,CAACA,GAAS,eACZ,MAAM,IAAI,MAAM,mCAAmC,EAErDC,EACEC,EAAkCF,EAAQ,cAAc,CAC1D,EAEA,MAAMG,EAAW,EAEjB,IAAMC,EAAS,MAAMC,EAAoB,EAOzC,MAAO,CACL,SANqBC,EAAM,qBAC3BF,EAAO,SACPA,EAAO,OACT,EAIE,QAASA,EAAO,OAClB,CACF,CAAC,EACA,GAAGG,CAAwB,EAC3B,MAAM,EAEHC,EAA4B,aAAuB,EAAE,MAAM,EAE3DC,EAAaZ,EAChB,WAAW,EACX,OAAO,IAAMa,CAAiB,EAC9B,MAAM,EAEHC,EAAM,IAAIC,EAA6B,MAAOC,CAAS,EAC1D,OAAOjB,CAAO,EACd,OAAOY,CAAU,EACjB,OAAOC,CAAU,EACjB,MAAM,EEnDT,OAAS,
|
|
6
|
-
"names": ["defineVersions", "ProviderBuilder", "NamespaceBuilder", "builders", "utils", "commonBuilders", "standardizeAndThrowError", "isTrezorInitialized", "initTrezor", "getTrezorModule", "getTrezorManifest", "__name", "connect", "builders", "_context", "_chain", "options", "setDerivationPath", "getTrezorNormalizedDerivationPath", "initTrezor", "result", "getEthereumAccounts", "utils", "standardizeAndThrowError", "disconnect", "getChainId", "ETHEREUM_CHAIN_ID", "evm", "NamespaceBuilder", "WALLET_ID", "
|
|
4
|
+
"sourcesContent": ["import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions().version('1.0.0', buildProvider()).build();\n\nexport { versions };\nexport { WALLET_ID } from './constants.js';\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';\nimport { utxo } from './namespaces/utxo.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 .add('utxo', utxo)\n .build();\n\nexport { buildProvider };\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';\n\nimport { ETHEREUM_CHAIN_ID, WALLET_ID } from '../constants.js';\nimport { initTrezor } from '../init.js';\nimport { setDerivationPath } from '../state.js';\nimport {\n getEthereumAccounts,\n getTrezorNormalizedDerivationPath,\n} from '../utils.js';\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 await initTrezor();\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", "import { getTrezorManifest } from './provider.js';\nimport { getTrezorModule } from './utils.js';\n\nlet isTrezorInitialized = false;\n\n/*\n * `TrezorConnect.init` throws if called twice, so initialization is shared across every\n * namespace (EVM, UTXO). `lazyLoad` defers iframe injection until the first method call.\n */\nexport async function initTrezor() {\n if (isTrezorInitialized) {\n return;\n }\n const TrezorConnect = await getTrezorModule();\n await TrezorConnect.init({\n lazyLoad: true,\n manifest: getTrezorManifest(),\n });\n isTrezorInitialized = true;\n}\n", "import type { UtxoActions } from '@hub3js/bip122';\n\nimport { builders, CAIP_BITCOIN_CHAIN_ID } from '@hub3js/bip122';\nimport { NamespaceBuilder } from '@hub3js/core';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { utxoActions } from '../actions/utxo.js';\nimport { WALLET_ID } from '../constants.js';\n\nconst connect = builders\n .connect()\n .action(utxoActions.connect(CAIP_BITCOIN_CHAIN_ID))\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders.disconnect<UtxoActions>().build();\n\nconst utxo = new NamespaceBuilder<UtxoActions>('UTXO', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .build();\n\nexport { utxo };\n", "import type { Bip122ChainId, UtxoActions } from '@hub3js/bip122';\nimport type { Context, FunctionWithContext } from '@hub3js/core';\n\nimport { utils } from '@hub3js/bip122';\n\nimport { initTrezor } from '../init.js';\nimport { setBitcoinDerivationPath } from '../state.js';\nimport {\n getTrezorModule,\n getTrezorNormalizedDerivationPath,\n} from '../utils.js';\nimport { BITCOIN_COIN_NAME, resolveBitcoinScriptType } from '../utxo/config.js';\n\n/**\n * Connect the Bitcoin account for the selected derivation path: derive the receive\n * address and return it CAIP-encoded with the bip122 Bitcoin chain id. The path is kept\n * (like the EVM namespace does) because Rango's PSBT has no derivation data, so the\n * signer needs it at signing time.\n */\nexport function connect(\n network: Bip122ChainId\n): FunctionWithContext<UtxoActions['connect'], Context> {\n return async (_context, options) => {\n if (!options?.derivationPath) {\n throw new Error('Derivation Path can not be empty.');\n }\n\n await initTrezor();\n\n const path = getTrezorNormalizedDerivationPath(options.derivationPath);\n const inputScriptType = resolveBitcoinScriptType(path);\n setBitcoinDerivationPath(path);\n\n const TrezorConnect = await getTrezorModule();\n const result = await TrezorConnect.getAddress({\n path,\n coin: BITCOIN_COIN_NAME,\n scriptType: inputScriptType,\n showOnTrezor: false,\n });\n\n if (!result.success) {\n throw new Error(result.payload.error);\n }\n\n const { address } = result.payload;\n\n return utils.formatAccountsToCAIP([address], network);\n };\n}\n\nexport const utxoActions = { connect };\n"],
|
|
5
|
+
"mappings": "8GAAA,OAAS,kBAAAA,MAAsB,qBCE/B,OAAS,mBAAAC,MAAuB,eCAhC,OAAS,oBAAAC,MAAwB,eACjC,OAAS,YAAAC,EAAU,SAAAC,MAAa,cAChC,UAAYC,MAAoB,uBAChC,OAAS,4BAAAC,MAAgC,wBCFzC,IAAIC,EAAsB,GAM1B,eAAsBC,GAAa,CACjC,GAAID,EACF,OAGF,MADsB,MAAME,EAAgB,GACxB,KAAK,CACvB,SAAU,GACV,SAAUC,EAAkB,CAC9B,CAAC,EACDH,EAAsB,EACxB,CAVsBI,EAAAH,EAAA,cDMtB,IAAMI,EAAUC,EACb,QAAQ,EACR,OAAO,eAAgBC,EAAUC,EAAQC,EAAS,CACjD,GAAI,CAACA,GAAS,eACZ,MAAM,IAAI,MAAM,mCAAmC,EAErDC,EACEC,EAAkCF,EAAQ,cAAc,CAC1D,EAEA,MAAMG,EAAW,EAEjB,IAAMC,EAAS,MAAMC,EAAoB,EAOzC,MAAO,CACL,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A8B,OAAQC,CAAS,EAC7D,OAAOR,CAAO,EACd,OAAOK,CAAU,EACjB,MAAM,EHbT,IAAII,EAESC,EAAoBC,EAAA,IAAMF,EAAN,qBAE3BG,EAAgBD,EAAA,IACpB,IAAIE,EAAgBC,CAAS,EAC1B,KAAK,SAAUC,EAASC,EAA4B,CACnD,GAAM,CAAC,CAAEC,CAAQ,EAAIF,EAAQ,MAAM,EAEnC,GAAI,CAACC,EAAa,SAChB,MAAM,IAAI,MAAM,6BAA6B,EAG/CP,EAAiBO,EAAa,SAC9BC,EAAS,YAAa,EAAI,EAC1B,QAAQ,MAAM,8BAA+BF,CAAO,CACtD,CAAC,EACA,OAAO,WAAYG,CAAQ,EAC3B,IAAI,MAAOC,CAAG,EACd,IAAI,OAAQC,CAAI,EAChB,MAAM,EAhBW,iBDRtB,IAAMC,GAAWC,EAAA,IACfC,EAAe,EAAE,QAAQ,QAASC,EAAc,CAAC,EAAE,MAAM,EAD1C",
|
|
6
|
+
"names": ["defineVersions", "ProviderBuilder", "NamespaceBuilder", "builders", "utils", "commonBuilders", "standardizeAndThrowError", "isTrezorInitialized", "initTrezor", "getTrezorModule", "getTrezorManifest", "__name", "connect", "builders", "_context", "_chain", "options", "setDerivationPath", "getTrezorNormalizedDerivationPath", "initTrezor", "result", "getEthereumAccounts", "utils", "standardizeAndThrowError", "disconnect", "getChainId", "ETHEREUM_CHAIN_ID", "evm", "NamespaceBuilder", "WALLET_ID", "builders", "CAIP_BITCOIN_CHAIN_ID", "NamespaceBuilder", "commonBuilders", "standardizeAndThrowError", "utils", "connect", "network", "_context", "options", "initTrezor", "path", "getTrezorNormalizedDerivationPath", "inputScriptType", "resolveBitcoinScriptType", "setBitcoinDerivationPath", "result", "getTrezorModule", "BITCOIN_COIN_NAME", "address", "utils", "__name", "utxoActions", "connect", "builders", "utxoActions", "CAIP_BITCOIN_CHAIN_ID", "standardizeAndThrowError", "disconnect", "utxo", "NamespaceBuilder", "WALLET_ID", "trezorManifest", "getTrezorManifest", "__name", "buildProvider", "ProviderBuilder", "WALLET_ID", "context", "environments", "setState", "metadata", "evm", "utxo", "versions", "__name", "defineVersions", "buildProvider"]
|
|
7
7
|
}
|
package/dist/provider.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export declare const getTrezorManifest: () => {
|
|
|
2
2
|
appUrl: string;
|
|
3
3
|
email: string;
|
|
4
4
|
};
|
|
5
|
-
declare const buildProvider: () => import("@hub3js/core").Provider<Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@
|
|
5
|
+
declare const buildProvider: () => import("@hub3js/core").Provider<Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@hub3js/bip122").UtxoActions>>;
|
|
6
6
|
export { buildProvider };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s,e as g,g as m,j as d,k as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=utxo-
|
|
1
|
+
import{a as s,e as g,g as m,j as d,k as h}from"./chunk-PCTGR6CA.js";import{isBitcoinBlockchain as B}from"@rango-dev/internal-blockchains";import{SignerError as S}from"rango-types";import*as x from"@bitcoinerlab/secp256k1";import*as n from"bitcoinjs-lib";n.initEccLib(x);var z=s(o=>Buffer.from(o).reverse().toString("hex"),"reverseTxid");function l(o,e,c=n.networks.bitcoin){let r=n.Psbt.fromBase64(o,{network:c}),u=h(e),T=r.txInputs.map((t,p)=>{let i=r.data.inputs[p];if(i.sighashType!=null&&i.sighashType!==n.Transaction.SIGHASH_ALL)throw new Error(`PSBT input #${p} uses sighash type ${i.sighashType}; only SIGHASH_ALL is supported.`);let a=i.witnessUtxo??n.Transaction.fromBuffer(i.nonWitnessUtxo).outs[t.index];return{address_n:e,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:(n.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 S.UnimplementedError("signMessage")}async signAndSendTx(e){let{blockchain:c}=e.asset;if(!B(c))throw new Error(`Signing ${c} transactions is not supported by Trezor.`);let{psbt:r}=e;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(e){if(e.txid)return e.txid;if(!e.serializedTx)throw new Error("Trezor did not return a transaction id.");let r=await(await m()).pushTransaction({tx:e.serializedTx,coin:d});if(!r.success)throw w(r.payload);return r.payload.txid}};export{b as BTCSigner};
|
|
2
|
+
//# sourceMappingURL=utxo-L7GRAPNY.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-trezor",
|
|
3
|
-
"version": "0.30.1-next.
|
|
3
|
+
"version": "0.30.1-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/mod.ts",
|
|
@@ -22,12 +22,13 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@bitcoinerlab/secp256k1": "^1.2.0",
|
|
25
|
-
"@hub3js/
|
|
26
|
-
"@hub3js/
|
|
27
|
-
"@hub3js/
|
|
28
|
-
"@
|
|
29
|
-
"@rango-dev/
|
|
30
|
-
"@rango-dev/
|
|
25
|
+
"@hub3js/bip122": "^0.2.1",
|
|
26
|
+
"@hub3js/core": "^0.62.0",
|
|
27
|
+
"@hub3js/evm": "^0.5.0",
|
|
28
|
+
"@hub3js/std": "^0.4.0",
|
|
29
|
+
"@rango-dev/internal-blockchains": "^0.1.1-next.2",
|
|
30
|
+
"@rango-dev/signer-evm": "^0.45.1-next.1",
|
|
31
|
+
"@rango-dev/wallets-core": "^0.61.1-next.2",
|
|
31
32
|
"@trezor/connect-web": "^9.5.0",
|
|
32
33
|
"bitcoinjs-lib": "^6.1.7",
|
|
33
34
|
"ethers": "^6.13.2",
|
package/src/actions/utxo.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import type { Bip122ChainId, UtxoActions } from '@hub3js/bip122';
|
|
1
2
|
import type { Context, FunctionWithContext } from '@hub3js/core';
|
|
2
|
-
import type { UtxoActions } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
CAIP_BITCOIN_CHAIN_ID,
|
|
6
|
-
utils,
|
|
7
|
-
} from '@rango-dev/wallets-core/namespaces/utxo';
|
|
4
|
+
import { utils } from '@hub3js/bip122';
|
|
8
5
|
|
|
9
6
|
import { initTrezor } from '../init.js';
|
|
10
7
|
import { setBitcoinDerivationPath } from '../state.js';
|
|
@@ -20,10 +17,9 @@ import { BITCOIN_COIN_NAME, resolveBitcoinScriptType } from '../utxo/config.js';
|
|
|
20
17
|
* (like the EVM namespace does) because Rango's PSBT has no derivation data, so the
|
|
21
18
|
* signer needs it at signing time.
|
|
22
19
|
*/
|
|
23
|
-
export function connect(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
> {
|
|
20
|
+
export function connect(
|
|
21
|
+
network: Bip122ChainId
|
|
22
|
+
): FunctionWithContext<UtxoActions['connect'], Context> {
|
|
27
23
|
return async (_context, options) => {
|
|
28
24
|
if (!options?.derivationPath) {
|
|
29
25
|
throw new Error('Derivation Path can not be empty.');
|
|
@@ -49,7 +45,7 @@ export function connect(): FunctionWithContext<
|
|
|
49
45
|
|
|
50
46
|
const { address } = result.payload;
|
|
51
47
|
|
|
52
|
-
return utils.formatAccountsToCAIP([address],
|
|
48
|
+
return utils.formatAccountsToCAIP([address], network);
|
|
53
49
|
};
|
|
54
50
|
}
|
|
55
51
|
|
package/src/constants.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ProviderMetadata } from '@hub3js/core';
|
|
2
2
|
|
|
3
|
-
import { CAIP_ETHEREUM_CHAIN_ID, isEvmNamespace } from '@hub3js/evm';
|
|
4
|
-
import { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';
|
|
5
3
|
import {
|
|
6
4
|
CAIP_BITCOIN_CHAIN_ID,
|
|
7
|
-
|
|
8
|
-
} from '@
|
|
5
|
+
isChainSupported as isBip122ChainSupported,
|
|
6
|
+
} from '@hub3js/bip122';
|
|
7
|
+
import { CAIP_ETHEREUM_CHAIN_ID, isEvmNamespace } from '@hub3js/evm';
|
|
8
|
+
import { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';
|
|
9
9
|
|
|
10
10
|
import getSigners from './signer.js';
|
|
11
11
|
import { BITCOIN_ADDRESS_TYPES } from './utxo/config.js';
|
|
@@ -41,9 +41,7 @@ export const metadata: ProviderMetadata = {
|
|
|
41
41
|
label: 'Bitcoin',
|
|
42
42
|
value: 'UTXO',
|
|
43
43
|
id: 'BTC',
|
|
44
|
-
isChainSupported: (
|
|
45
|
-
isUtxoNamespace(chainId) &&
|
|
46
|
-
getChainIdFromCaip2ChainId(chainId) === CAIP_BITCOIN_CHAIN_ID,
|
|
44
|
+
isChainSupported: isBip122ChainSupported([CAIP_BITCOIN_CHAIN_ID]),
|
|
47
45
|
},
|
|
48
46
|
],
|
|
49
47
|
},
|
package/src/namespaces/utxo.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { UtxoActions } from '@
|
|
1
|
+
import type { UtxoActions } from '@hub3js/bip122';
|
|
2
2
|
|
|
3
|
+
import { builders, CAIP_BITCOIN_CHAIN_ID } from '@hub3js/bip122';
|
|
3
4
|
import { NamespaceBuilder } from '@hub3js/core';
|
|
4
5
|
import * as commonBuilders from '@hub3js/std/builders';
|
|
5
6
|
import { standardizeAndThrowError } from '@hub3js/std/operators';
|
|
6
|
-
import { builders } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
7
7
|
|
|
8
8
|
import { utxoActions } from '../actions/utxo.js';
|
|
9
9
|
import { WALLET_ID } from '../constants.js';
|
|
10
10
|
|
|
11
11
|
const connect = builders
|
|
12
12
|
.connect()
|
|
13
|
-
.action(utxoActions.connect())
|
|
13
|
+
.action(utxoActions.connect(CAIP_BITCOIN_CHAIN_ID))
|
|
14
14
|
.or(standardizeAndThrowError)
|
|
15
15
|
.build();
|
|
16
16
|
|
package/dist/chunk-UYZGJZGU.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var d=Object.defineProperty;var t=(e,r)=>d(e,"name",{value:r,configurable:!0});var a="";function f(e){a=e}t(f,"setDerivationPath");function s(){return a}t(s,"getDerivationPath");var p="";function h(e){p=e}t(h,"setBitcoinDerivationPath");function I(){return p}t(I,"getBitcoinDerivationPath");import{CAIP_ETHEREUM_CHAIN_ID as g,isEvmNamespace as T}from"@hub3js/evm";import{getChainIdFromCaip2ChainId as u}from"@hub3js/std/utils";import{CAIP_BITCOIN_CHAIN_ID as E,isUtxoNamespace as D}from"@rango-dev/wallets-core/namespaces/utxo";import{DefaultSignerFactory as S,TransactionType as c}from"rango-types";async function n(){let e=new S,{EthereumSigner:r}=await import("./ethereum-DOIFSVS7.js"),{BTCSigner:i}=await import("./utxo-CA5LKN6D.js");return e.registerSigner(c.EVM,new r),e.registerSigner(c.TRANSFER,new i),e}t(n,"getSigners");var w="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 _(e){let r=Number.parseInt(e.replace(/^m\//,"").split("/")[0]?.replace(/['h]$/,"")??"",10),i=o.find(l=>l.purpose===r);if(!i)throw new Error(`Unsupported Bitcoin derivation path: ${e}`);return i.inputScriptType}t(_,"resolveBitcoinScriptType");var L="trezor",P=16,m=`0x${Number(g).toString(P)}`,U={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",isChainSupported:e=>T(e)&&u(e)===g},{label:"Bitcoin",value:"UTXO",id:"BTC",isChainSupported:e=>D(e)&&u(e)===E}]}},{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}`},...o.map(e=>({id:`bitcoin-${e.id}`,label:`${e.label} (m/${e.purpose}'/0'/index')`,namespace:"UTXO",generateDerivationPath:r=>`${e.purpose}'/0'/${r}'/0/0`}))]}},{name:"signers",value:{getSigners:async()=>n()}}]};var k={Failure_ActionCancelled:"User rejected the transaction."};async function v(){let e=await import("@trezor/connect-web");return e.default.default?e.default.default:e.default}t(v,"getTrezorModule");async function X(){let e=await v(),r=s(),i=await e.ethereumGetAddress({path:r});if(!i.success)throw new Error(i.payload.error);return{accounts:[i.payload.address],chainId:m,derivationPath:r}}t(X,"getEthereumAccounts");var j=t(e=>e&&!e.startsWith("m/")?"m/"+e:e,"getTrezorNormalizedDerivationPath");export{t as a,f as b,s as c,h as d,I as e,k as f,v as g,X as h,j as i,w as j,_ as k,L as l,m,U as n};
|
|
2
|
-
//# sourceMappingURL=chunk-UYZGJZGU.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/state.ts", "../src/constants.ts", "../src/signer.ts", "../src/utxo/config.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 { ProviderMetadata } from '@hub3js/core';\n\nimport { CAIP_ETHEREUM_CHAIN_ID, isEvmNamespace } from '@hub3js/evm';\nimport { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';\nimport {\n CAIP_BITCOIN_CHAIN_ID,\n isUtxoNamespace,\n} from '@rango-dev/wallets-core/namespaces/utxo';\n\nimport getSigners from './signer.js';\nimport { BITCOIN_ADDRESS_TYPES } from './utxo/config.js';\n\nexport const WALLET_ID = 'trezor';\n\nconst HEXADECIMAL_BASE = 16;\nexport const ETHEREUM_CHAIN_ID = `0x${Number(CAIP_ETHEREUM_CHAIN_ID).toString(\n HEXADECIMAL_BASE\n)}`;\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 isChainSupported: (chainId: string) =>\n isEvmNamespace(chainId) &&\n getChainIdFromCaip2ChainId(chainId) === CAIP_ETHEREUM_CHAIN_ID,\n },\n {\n label: 'Bitcoin',\n value: 'UTXO',\n id: 'BTC',\n isChainSupported: (chainId: string) =>\n isUtxoNamespace(chainId) &&\n getChainIdFromCaip2ChainId(chainId) === CAIP_BITCOIN_CHAIN_ID,\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 * Bitcoin derivation templates. The BIP-43 purpose (and thus the address\n * type) is what the user picks here; `index` selects the account.\n */\n ...BITCOIN_ADDRESS_TYPES.map((addressType) => ({\n id: `bitcoin-${addressType.id}`,\n label: `${addressType.label} (m/${addressType.purpose}'/0'/index')`,\n namespace: 'UTXO',\n generateDerivationPath: (index: string) =>\n `${addressType.purpose}'/0'/${index}'/0/0`,\n })),\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners() },\n },\n ],\n};\n", "import type { SignerFactory } from 'rango-types';\n\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 import('./signers/ethereum.js');\n const { BTCSigner } = await import('./signers/utxo.js');\n signers.registerSigner(TxType.EVM, new EthereumSigner());\n signers.registerSigner(TxType.TRANSFER, new BTCSigner());\n return signers;\n}\n", "/*\n * Trezor needs the input `script_type` to sign a Bitcoin input. It is determined by the\n * BIP-43 `purpose` of the derivation path the address was derived from, so we expose the\n * four common address types and let the user connect whichever one they hold funds on.\n */\nexport type TrezorInputScriptType =\n | 'SPENDADDRESS'\n | 'SPENDP2SHWITNESS'\n | 'SPENDWITNESS'\n | 'SPENDTAPROOT';\n\nexport interface BitcoinAddressType {\n /** Stable id used in the derivationPath metadata entries. */\n id: 'legacy' | 'nested-segwit' | 'native-segwit' | 'taproot';\n label: string;\n /** BIP-43 purpose: 44 legacy, 49 nested segwit, 84 native segwit, 86 taproot. */\n purpose: number;\n inputScriptType: TrezorInputScriptType;\n}\n\nexport const BITCOIN_COIN_NAME = 'btc';\n\nexport const BITCOIN_ADDRESS_TYPES: readonly BitcoinAddressType[] = [\n {\n id: 'native-segwit',\n label: 'Native SegWit',\n purpose: 84,\n inputScriptType: 'SPENDWITNESS',\n },\n {\n id: 'nested-segwit',\n label: 'Nested SegWit',\n purpose: 49,\n inputScriptType: 'SPENDP2SHWITNESS',\n },\n {\n id: 'legacy',\n label: 'Legacy',\n purpose: 44,\n inputScriptType: 'SPENDADDRESS',\n },\n {\n id: 'taproot',\n label: 'Taproot',\n purpose: 86,\n inputScriptType: 'SPENDTAPROOT',\n },\n] as const;\n\n/**\n * Resolve the Trezor input script type for a derivation path by reading its BIP-43\n * purpose (the first hardened level). The path always comes from one of our own\n * derivation templates, so an unknown purpose is a programming error.\n */\nexport function resolveBitcoinScriptType(path: string): TrezorInputScriptType {\n const purpose = Number.parseInt(\n path.replace(/^m\\//, '').split('/')[0]?.replace(/['h]$/, '') ?? '',\n 10\n );\n const addressType = BITCOIN_ADDRESS_TYPES.find(\n (type) => type.purpose === purpose\n );\n if (!addressType) {\n throw new Error(`Unsupported Bitcoin derivation path: ${path}`);\n }\n return addressType.inputScriptType;\n}\n", "import type { TrezorConnect } from '@trezor/connect-web';\n\nimport { ETHEREUM_CHAIN_ID } from './constants.js';\nimport { getDerivationPath } from './state.js';\n\ntype DeviceAccounts = {\n accounts: string[];\n chainId: string;\n derivationPath: string;\n};\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 async function getEthereumAccounts(): Promise<DeviceAccounts> {\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,OAAS,0BAAAC,EAAwB,kBAAAC,MAAsB,cACvD,OAAS,8BAAAC,MAAkC,oBAC3C,OACE,yBAAAC,EACA,mBAAAC,MACK,0CCLP,OAAS,wBAAAC,E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oCP,EAC/CQ,GACIA,GAAQ,CAACA,EAAK,WAAW,IAAI,EAAI,KAAOA,EAAOA,EAFJ",
|
|
6
|
-
"names": ["derivationPath", "setDerivationPath", "path", "__name", "getDerivationPath", "bitcoinDerivationPath", "setBitcoinDerivationPath", "getBitcoinDerivationPath", "CAIP_ETHEREUM_CHAIN_ID", "isEvmNamespace", "getChainIdFromCaip2ChainId", "CAIP_BITCOIN_CHAIN_ID", "isUtxoNamespace", "DefaultSignerFactory", "TxType", "getSigners", "signers", "DefaultSignerFactory", "EthereumSigner", "BTCSigner", "TxType", "__name", "BITCOIN_COIN_NAME", "BITCOIN_ADDRESS_TYPES", "resolveBitcoinScriptType", "path", "purpose", "addressType", "type", "__name", "WALLET_ID", "HEXADECIMAL_BASE", "ETHEREUM_CHAIN_ID", "CAIP_ETHEREUM_CHAIN_ID", "metadata", "chainId", "isEvmNamespace", "getChainIdFromCaip2ChainId", "isUtxoNamespace", "CAIP_BITCOIN_CHAIN_ID", "index", "BITCOIN_ADDRESS_TYPES", "addressType", "getSigners", "trezorErrorMessages", "getTrezorModule", "mod", "__name", "getEthereumAccounts", "TrezorConnect", "derivationPath", "getDerivationPath", "result", "ETHEREUM_CHAIN_ID", "getTrezorNormalizedDerivationPath", "path"]
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|