New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@avalabs/bitcoin-module

Package Overview
Dependencies
Maintainers
0
Versions
460
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avalabs/bitcoin-module - npm Package Compare versions

Comparing version

to
0.0.0-testGetBalance-20240722173538

12

CHANGELOG.md
# @avalabs/bitcoin-module
## 0.0.0-testAvaInit-20240722154418
## 0.0.0-testGetBalance-20240722173538
### Patch Changes
- Updated dependencies [60d04c7]
- @avalabs/vm-module-types@0.0.0-testAvaInit-20240722154418
## 0.0.16
### Patch Changes
- de9824c: feat: created bitcoin module
- Updated dependencies [bc48457]
- @avalabs/vm-module-types@0.0.16
- @avalabs/vm-module-types@0.0.0-testGetBalance-20240722173538

10

dist/index.d.ts
import * as _metamask_rpc_errors from '@metamask/rpc-errors';
import { Module, Environment, Manifest, Network, NetworkFees, GetTransactionHistory, RpcRequest } from '@avalabs/vm-module-types';
import { Module, Manifest, Network, NetworkFees, GetTransactionHistory, RpcRequest } from '@avalabs/vm-module-types';
declare class BitcoinModule implements Module {
#private;
constructor({ environment }: {
environment: Environment;
});
getAddress(): Promise<string>;
getBalances(): Promise<{}>;
getBalances(): Promise<string>;
getManifest(): Manifest | undefined;
getNetworkFee(network: Network): Promise<NetworkFees>;
getNetworkFee(_: Network): Promise<NetworkFees>;
getTransactionHistory(_: GetTransactionHistory): Promise<{

@@ -14,0 +10,0 @@ transactions: never[];

@@ -1,9 +0,8 @@

import { parseManifest, Environment } from '@avalabs/vm-module-types';
import { parseManifest } from '@avalabs/vm-module-types';
import { rpcErrors } from '@metamask/rpc-errors';
import { BitcoinProvider } from '@avalabs/wallets-sdk';
var n=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var i=(r,e,t)=>(n(r,e,"read from private field"),t?t.call(r):e.get(r)),a=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t);},p=(r,e,t,s)=>(n(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);var y={glacierApiUrl:"https://glacier-api.avax.network",proxyApiUrl:"https://proxy-api.avax.network"},f={glacierApiUrl:"https://glacier-api-dev.avax.network",proxyApiUrl:"https://proxy-api-dev.avax.network"},c=r=>{switch(r){case Environment.PRODUCTION:return y;case Environment.DEV:return f}};var d={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 l=({isTestnet:r,proxyApiUrl:e})=>new BitcoinProvider(!r,void 0,`${e}/proxy/nownodes/${r?"btcbook-testnet":"btcbook"}`,`${e}/proxy/nownodes/${r?"btc-testnet":"btc"}`,process.env.GLACIER_API_KEY?{token:process.env.GLACIER_API_KEY}:{});async function v({isTestnet:r,proxyApiUrl:e}){let t=l({isTestnet:r,proxyApiUrl:e}),{high:s,low:u,medium:x}=await t.getFeeRates();return {low:{maxFeePerGas:BigInt(u)},medium:{maxFeePerGas:BigInt(x)},high:{maxFeePerGas:BigInt(s)},isFixedFee:!1}}var o,g=class{constructor({environment:e}){a(this,o,void 0);let{proxyApiUrl:t}=c(e);p(this,o,t);}getAddress(){return Promise.resolve("Bitcoin address")}getBalances(){return Promise.resolve({})}getManifest(){let e=parseManifest(d);return e.success?e.data:void 0}getNetworkFee(e){return v({isTestnet:!!e.isTestnet,proxyApiUrl:i(this,o)})}getTransactionHistory(e){return Promise.resolve({transactions:[]})}getTokens(e){return Promise.resolve([])}async onRpcRequest(e,t){switch(e.method){default:return {error:rpcErrors.methodNotSupported(`Method ${e.method} not supported`)}}}};o=new WeakMap;
var r={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 s=class{getAddress(){return Promise.resolve("Bitcoin address")}getBalances(){return Promise.resolve("Bitcoin balances")}getManifest(){let e=parseManifest(r);return e.success?e.data:void 0}getNetworkFee(e){return Promise.resolve({baseFee:1n,low:{maxFeePerGas:1n},medium:{maxFeePerGas:2n},high:{maxFeePerGas:4n},isFixedFee:!1})}getTransactionHistory(e){return Promise.resolve({transactions:[]})}getTokens(e){return Promise.resolve([])}async onRpcRequest(e,a){switch(e.method){default:return {error:rpcErrors.methodNotSupported(`Method ${e.method} not supported`)}}}};
export { g as BitcoinModule };
export { s as BitcoinModule };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map
{
"name": "@avalabs/bitcoin-module",
"version": "0.0.0-testAvaInit-20240722154418",
"version": "0.0.0-testGetBalance-20240722173538",
"main": "dist/index.cjs",

@@ -9,3 +9,3 @@ "module": "dist/index.js",

"dependencies": {
"@avalabs/vm-module-types": "0.0.0-testAvaInit-20240722154418",
"@avalabs/vm-module-types": "0.0.0-testGetBalance-20240722173538",
"@avalabs/wallets-sdk": "2.8.0-alpha.188",

@@ -20,3 +20,2 @@ "@metamask/rpc-errors": "6.3.0"

"@internal/tsup-config": "0.0.1",
"@internal/utils": "0.0.0-testAvaInit-20240722154418",
"eslint-config-custom": "0.0.1"

@@ -23,0 +22,0 @@ },

@@ -8,19 +8,9 @@ import type {

Network,
Environment,
} from '@avalabs/vm-module-types';
import { parseManifest } from '@avalabs/vm-module-types';
import { rpcErrors } from '@metamask/rpc-errors';
import { getEnv } from './env';
import ManifestJson from '../manifest.json';
import { getNetworkFee } from './handlers/get-network-fee';
export class BitcoinModule implements Module {
#proxyApiUrl: string;
constructor({ environment }: { environment: Environment }) {
const { proxyApiUrl } = getEnv(environment);
this.#proxyApiUrl = proxyApiUrl;
}
getAddress(): Promise<string> {

@@ -31,3 +21,3 @@ return Promise.resolve('Bitcoin address');

getBalances() {
return Promise.resolve({});
return Promise.resolve('Bitcoin balances');
}

@@ -40,6 +30,15 @@

getNetworkFee(network: Network): Promise<NetworkFees> {
return getNetworkFee({
isTestnet: Boolean(network.isTestnet),
proxyApiUrl: this.#proxyApiUrl,
getNetworkFee(_: Network): Promise<NetworkFees> {
return Promise.resolve({
baseFee: 1n,
low: {
maxFeePerGas: 1n,
},
medium: {
maxFeePerGas: 2n,
},
high: {
maxFeePerGas: 4n,
},
isFixedFee: false,
});

@@ -46,0 +45,0 @@ }

@@ -5,11 +5,5 @@ {

"outDir": "./dist",
"declaration": false,
"incremental": false // Need to turn off because of tsup dts
},
"include": ["src"],
"references": [
{
"path": "../../packages-internal/utils/tsconfig.json"
}
]
"include": ["src"]
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet