@avalabs/bitcoin-module
Advanced tools
Comparing version 0.0.19 to 0.0.20
# @avalabs/bitcoin-module | ||
## 0.0.20 | ||
### Patch Changes | ||
- 9bfa82d: Implement balance fetching for BitcoinModule | ||
- Updated dependencies [9bfa82d] | ||
- @avalabs/vm-module-types@0.0.20 | ||
## 0.0.19 | ||
@@ -4,0 +12,0 @@ |
import * as _metamask_rpc_errors from '@metamask/rpc-errors'; | ||
import * as _avalabs_vm_module_types_dist_transaction_history from '@avalabs/vm-module-types/dist/transaction-history'; | ||
import { Module, Environment, Manifest, Network, NetworkFees, GetTransactionHistory, RpcRequest } from '@avalabs/vm-module-types'; | ||
import * as _avalabs_vm_module_types_dist_balance from '@avalabs/vm-module-types/dist/balance'; | ||
import { Module, Environment, GetBalancesParams, Manifest, Network, NetworkFees, GetTransactionHistory, RpcRequest } from '@avalabs/vm-module-types'; | ||
@@ -11,3 +12,3 @@ declare class BitcoinModule implements Module { | ||
getAddress(): Promise<string>; | ||
getBalances(): Promise<{}>; | ||
getBalances({ addresses, currency, network, storage }: GetBalancesParams): Promise<_avalabs_vm_module_types_dist_balance.GetBalancesResponse>; | ||
getManifest(): Manifest | undefined; | ||
@@ -14,0 +15,0 @@ getNetworkFee(network: Network): Promise<NetworkFees>; |
{ | ||
"name": "@avalabs/bitcoin-module", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"main": "dist/index.cjs", | ||
@@ -9,7 +9,13 @@ "module": "dist/index.js", | ||
"dependencies": { | ||
"@avalabs/vm-module-types": "0.0.19", | ||
"@avalabs/wallets-sdk": "2.8.0-alpha.188", | ||
"@metamask/rpc-errors": "6.3.0" | ||
"@avalabs/vm-module-types": "0.0.20", | ||
"@avalabs/wallets-sdk": "2.8.0-alpha.193", | ||
"@avalabs/coingecko-sdk": "v2.8.0-alpha.193", | ||
"@avalabs/utils-sdk": "2.8.0-alpha.193", | ||
"@metamask/rpc-errors": "6.3.0", | ||
"big.js": "6.2.1", | ||
"bn.js": "5.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/big.js": "6.2.2", | ||
"@types/bn.js": "5.1.5", | ||
"@types/jest": "29.5.7", | ||
@@ -16,0 +22,0 @@ "jest": "29.7.0", |
@@ -5,5 +5,7 @@ import { Environment, type Network } from '@avalabs/vm-module-types'; | ||
import { getNetworkFee } from './handlers/get-network-fee'; | ||
import { getBalances } from './handlers/get-balances'; | ||
import { devEnv, prodEnv } from './env'; | ||
jest.mock('./handlers/get-network-fee'); | ||
jest.mock('./handlers/get-balances'); | ||
@@ -30,2 +32,28 @@ describe('bitcoin-module', () => { | ||
}); | ||
describe('getBalances()', () => { | ||
it('uses the get-balances handler', async () => { | ||
const params = { | ||
network: { isTestnet: true } as Network, | ||
addresses: ['address-1'], | ||
currency: 'USD', | ||
}; | ||
const devModule = new BitcoinModule({ environment: Environment.DEV }); | ||
await devModule.getBalances(params); | ||
expect(getBalances).toHaveBeenCalledWith({ | ||
...params, | ||
proxyApiUrl: devEnv.proxyApiUrl, | ||
}); | ||
const prodModule = new BitcoinModule({ environment: Environment.PRODUCTION }); | ||
await prodModule.getBalances(params); | ||
expect(getBalances).toHaveBeenCalledWith({ | ||
...params, | ||
proxyApiUrl: prodEnv.proxyApiUrl, | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -9,2 +9,3 @@ import type { | ||
Environment, | ||
GetBalancesParams, | ||
} from '@avalabs/vm-module-types'; | ||
@@ -18,2 +19,3 @@ import { parseManifest } from '@avalabs/vm-module-types'; | ||
import { getTransactionHistory } from './handlers/get-transaction-history'; | ||
import { getBalances } from './handlers/get-balances'; | ||
@@ -32,4 +34,10 @@ export class BitcoinModule implements Module { | ||
getBalances() { | ||
return Promise.resolve({}); | ||
getBalances({ addresses, currency, network, storage }: GetBalancesParams) { | ||
return getBalances({ | ||
addresses, | ||
currency, | ||
network, | ||
proxyApiUrl: this.#proxyApiUrl, | ||
storage, | ||
}); | ||
} | ||
@@ -36,0 +44,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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
2479435
35
3147
7
9
29
9
+ Addedbig.js@6.2.1
+ Addedbn.js@5.2.1
+ Added@avalabs/vm-module-types@0.0.20(transitive)
+ Addedbig.js@6.2.1(transitive)
+ Addedbn.js@5.2.1(transitive)
- Removed@avalabs/vm-module-types@0.0.19(transitive)