Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
snapquanow
Advanced tools
Readme
This MetaMask Snap is used to fetch or stream token pricing data from Aquanow.
getTokenPrice
:This RPC method takes two string parameters, token
and fiat
, and returns the price of the token in the fiat currency selected. For the moment, the fiat currencies supported are USD
and CAD
. As an example, to get the price of ETH in USD:
const response = await ethereum.request({
method: 'wallet_invokeSnap',
params: ['npm:snapquanow', {
method: 'getTokenPrice',
params: {
token: 'ETH',
fiat: 'USD'
}
}]
})
alert(`The current ETH price in USD is ${response.price}`);
streamTokenPrice
(experimental):This RPC method is meant to be called from another Snap. It takes a token
and fiat
just like getTokenPrice
, but additionally takes a callback
parameter of the form {snapId, method}
. It will then call your Snap's callback method repeatedly with the current price of the token, until your method returns false
. Due to current limitations, this method can only be called from another Snap. Example:
// From the calling Snap:
const ensureSnapquanowIsInstalled = async () => {
await wallet.request({
method: 'wallet_enable',
params: [
{
wallet_snap: {
'npm:snapquanow': {},
},
},
],
});
};
const callSnapquanow = async (method, params) => {
await ensureSnapquanowIsInstalled();
return wallet.request({
method: 'wallet_invokeSnap',
params: [
'npm:snapquanow',
{
method,
params,
},
],
});
};
module.exports.onRpcRequest = async ({ request }) => {
switch (request.method) {
case 'monitorEthereumPrice': {
await callSnapquanow('streamTokenPrice', {
token: 'ETH',
fiat: 'USD',
callback: {
snapId: 'YOUR_SNAPS_ID',
method: 'receiveEthereumPrice',
},
});
return true;
}
case 'receiveEthereumPrice':
console.log('Received ETH price', request.params);
return true; // Keeps streaming forever. Use a more appropriate logic to decide when to stop streaming
default:
throw new Error('Method not found.');
}
};
FAQs
Metamask Snap to get price feeds from Aquanow's API
The npm package snapquanow receives a total of 0 weekly downloads. As such, snapquanow popularity was classified as not popular.
We found that snapquanow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.