@avalabs/bitcoin-module
Advanced tools
Comparing version 0.0.0-feat-bitcoin-tx-history-20240719145649 to 0.0.0-feat-bitcoin-tx-history-20240719170627
# @avalabs/bitcoin-module | ||
## 0.0.0-feat-bitcoin-tx-history-20240719145649 | ||
## 0.0.0-feat-bitcoin-tx-history-20240719170627 | ||
@@ -8,2 +8,2 @@ ### Patch Changes | ||
- de9824c: feat: created bitcoin module | ||
- @avalabs/vm-module-types@0.0.0-feat-bitcoin-tx-history-20240719145649 | ||
- @avalabs/vm-module-types@0.0.0-feat-bitcoin-tx-history-20240719170627 |
@@ -5,3 +5,3 @@ import { parseManifest, Environment, TokenType, TransactionType } from '@avalabs/vm-module-types'; | ||
var m=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var p=(e,t,r)=>(m(e,t,"read from private field"),r?r.call(e):t.get(e)),d=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r);},l=(e,t,r,s)=>(m(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);var T={glacierApiUrl:"https://glacier-api.avax.network",proxyApiUrl:"https://proxy-api.avax.network"},x={glacierApiUrl:"https://glacier-api-dev.avax.network",proxyApiUrl:"https://proxy-api-dev.avax.network"},g=e=>{switch(e){case Environment.PRODUCTION:return T;case Environment.DEV:return x}};var v={name:"Bitcoin",description:"",version:"0.0.1",sources:{module:{checksum:"",location:{npm:{filePath:"dist/bundle.js",packageName:"@avalabs/bitcoin-module",registry:"https://registry.npmjs.org"}}},provider:{checksum:"",location:{npm:{filePath:"dist/provider.js",packageName:"@avalabs/bitcoin-module",registry:"https://registry.npmjs.org"}}}},network:{chainIds:["bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],namespaces:["bip122"]},cointype:"60",permissions:{rpc:{dapps:!0,methods:["bitcoin_sendTransaction"]}},manifestVersion:"0.0"};var a=({isTestnet:e,proxyApiUrl:t})=>new BitcoinProvider(!e,void 0,`${t}/proxy/nownodes/${e?"btcbook-testnet":"btcbook"}`,`${t}/proxy/nownodes/${e?"btc-testnet":"btc"}`,process.env.GLACIER_API_KEY?{token:process.env.GLACIER_API_KEY}:{});async function u({isTestnet:e,proxyApiUrl:t}){let r=a({isTestnet:e,proxyApiUrl:t}),{high:s,low:i,medium:o}=await r.getFeeRates();return {low:{maxFeePerGas:BigInt(i)},medium:{maxFeePerGas:BigInt(o)},high:{maxFeePerGas:BigInt(s)},isFixedFee:!1}}var k=(e,{address:t,network:r})=>{let{explorerUrl:s,isTestnet:i,networkToken:o}=r,c=e.addresses[0]??"";return {chainId:r.chainId.toString(),explorerLink:`${s}/${i?"btc-testnet":"btc"}/tx/${e.hash}`,from:e.isSender?t:c,gasUsed:e.fee.toString(),hash:e.hash,isContractCall:!1,isIncoming:!e.isSender,isOutgoing:e.isSender,isSender:e.isSender,timestamp:e.receivedTime*1e3,to:e.isSender?c:t,tokens:[{amount:(Math.abs(e.amount)/10**o.decimals).toString(),decimal:o.decimals.toString(),name:o.name,symbol:o.symbol,type:TokenType.NATIVE}],txType:e.isSender?TransactionType.SEND:TransactionType.RECEIVE}};var w=async({address:e,network:t,proxyApiUrl:r})=>(await a({isTestnet:!!t.isTestnet,proxyApiUrl:r}).getTxHistory(e)).map(o=>k(o,{address:e,network:t}));var n,h=class{constructor({environment:t}){d(this,n,void 0);let{proxyApiUrl:r}=g(t);l(this,n,r);}getAddress(){return Promise.resolve("Bitcoin address")}getBalances(){return Promise.resolve({})}getManifest(){let t=parseManifest(v);return t.success?t.data:void 0}getNetworkFee(t){return u({isTestnet:!!t.isTestnet,proxyApiUrl:p(this,n)})}async getTransactionHistory({address:t,network:r}){return {transactions:await w({address:t,network:r,proxyApiUrl:p(this,n)})}}getTokens(t){return Promise.resolve([])}async onRpcRequest(t,r){switch(t.method){default:return {error:rpcErrors.methodNotSupported(`Method ${t.method} not supported`)}}}};n=new WeakMap; | ||
var m=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var p=(e,t,r)=>(m(e,t,"read from private field"),r?r.call(e):t.get(e)),d=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r);},l=(e,t,r,s)=>(m(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);var T={glacierApiUrl:"https://glacier-api.avax.network",proxyApiUrl:"https://proxy-api.avax.network"},x={glacierApiUrl:"https://glacier-api-dev.avax.network",proxyApiUrl:"https://proxy-api-dev.avax.network"},g=e=>{switch(e){case Environment.PRODUCTION:return T;case Environment.DEV:return x}};var v={name:"Bitcoin",description:"",version:"0.0.1",sources:{module:{checksum:"",location:{npm:{filePath:"dist/bundle.js",packageName:"@avalabs/bitcoin-module",registry:"https://registry.npmjs.org"}}},provider:{checksum:"",location:{npm:{filePath:"dist/provider.js",packageName:"@avalabs/bitcoin-module",registry:"https://registry.npmjs.org"}}}},network:{chainIds:["bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],namespaces:["bip122"]},cointype:"0",permissions:{rpc:{dapps:!0,methods:["bitcoin_sendTransaction"]}},manifestVersion:"0.0"};var a=({isTestnet:e,proxyApiUrl:t})=>new BitcoinProvider(!e,void 0,`${t}/proxy/nownodes/${e?"btcbook-testnet":"btcbook"}`,`${t}/proxy/nownodes/${e?"btc-testnet":"btc"}`,process.env.GLACIER_API_KEY?{token:process.env.GLACIER_API_KEY}:{});async function u({isTestnet:e,proxyApiUrl:t}){let r=a({isTestnet:e,proxyApiUrl:t}),{high:s,low:i,medium:o}=await r.getFeeRates();return {low:{maxFeePerGas:BigInt(i)},medium:{maxFeePerGas:BigInt(o)},high:{maxFeePerGas:BigInt(s)},isFixedFee:!1}}var k=(e,{address:t,network:r})=>{let{explorerUrl:s,isTestnet:i,networkToken:o}=r,c=e.addresses[0]??"";return {chainId:r.chainId.toString(),explorerLink:`${s}/${i?"btc-testnet":"btc"}/tx/${e.hash}`,from:e.isSender?t:c,gasUsed:e.fee.toString(),hash:e.hash,isContractCall:!1,isIncoming:!e.isSender,isOutgoing:e.isSender,isSender:e.isSender,timestamp:e.receivedTime*1e3,to:e.isSender?c:t,tokens:[{amount:(Math.abs(e.amount)/10**o.decimals).toString(),decimal:o.decimals.toString(),name:o.name,symbol:o.symbol,type:TokenType.NATIVE}],txType:e.isSender?TransactionType.SEND:TransactionType.RECEIVE}};var w=async({address:e,network:t,proxyApiUrl:r})=>(await a({isTestnet:!!t.isTestnet,proxyApiUrl:r}).getTxHistory(e)).map(o=>k(o,{address:e,network:t}));var n,h=class{constructor({environment:t}){d(this,n,void 0);let{proxyApiUrl:r}=g(t);l(this,n,r);}getAddress(){return Promise.resolve("Bitcoin address")}getBalances(){return Promise.resolve({})}getManifest(){let t=parseManifest(v);return t.success?t.data:void 0}getNetworkFee(t){return u({isTestnet:!!t.isTestnet,proxyApiUrl:p(this,n)})}async getTransactionHistory({address:t,network:r}){return {transactions:await w({address:t,network:r,proxyApiUrl:p(this,n)})}}getTokens(t){return Promise.resolve([])}async onRpcRequest(t,r){switch(t.method){default:return {error:rpcErrors.methodNotSupported(`Method ${t.method} not supported`)}}}};n=new WeakMap; | ||
@@ -8,0 +8,0 @@ export { h as BitcoinModule }; |
@@ -31,3 +31,3 @@ { | ||
}, | ||
"cointype": "60", | ||
"cointype": "0", | ||
"permissions": { | ||
@@ -34,0 +34,0 @@ "rpc": { |
{ | ||
"name": "@avalabs/bitcoin-module", | ||
"version": "0.0.0-feat-bitcoin-tx-history-20240719145649", | ||
"version": "0.0.0-feat-bitcoin-tx-history-20240719170627", | ||
"main": "dist/index.cjs", | ||
@@ -9,3 +9,3 @@ "module": "dist/index.js", | ||
"dependencies": { | ||
"@avalabs/vm-module-types": "0.0.0-feat-bitcoin-tx-history-20240719145649", | ||
"@avalabs/vm-module-types": "0.0.0-feat-bitcoin-tx-history-20240719170627", | ||
"@avalabs/wallets-sdk": "2.8.0-alpha.188", | ||
@@ -20,3 +20,3 @@ "@metamask/rpc-errors": "6.3.0" | ||
"@internal/tsup-config": "0.0.1", | ||
"@internal/utils": "0.0.0-feat-bitcoin-tx-history-20240719145649", | ||
"@internal/utils": "0.0.0-feat-bitcoin-tx-history-20240719170627", | ||
"eslint-config-custom": "0.0.1" | ||
@@ -23,0 +23,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
49546