Am I missing something or is this information not available via web3 in the browser even if the ETH USD rate is displayed in Metamask.
Cannot find anything in the docu.
is the standard practice to use a cross-crypto API?
Ethereum Protocol Doesn't Care About Ether/Fiat Exchange:
The fiat price of Ether is not recorded on the Ethereum network, nor is it handled by the Ethereum protocol. The only reason MetaMask show this information is because it is a useful feature for users, but they get this information from exchanges that trade Ether for fiat.
Sources of Exchange Data:
Because Ether is traded on the free market there is no central organisation dictating the price. The best thing you can do to find the "current price" is to query the APIs of exchanges (https://poloniex.com/exchange, https://www.kraken.com/) and/or market tracking sites (https://coinmarketcap.com/). You can interrogate these APIs and use the rates presented as your guide for the Ether/Fiat exchange rate.
https://api.coinmarketcap.com/v1/ticker/ethereum
[
{
"id": "ethereum",
"name": "Ethereum",
"symbol": "ETH",
"rank": "2",
"price_usd": "211.824",
"price_btc": "0.0930788",
"24h_volume_usd": "1191280000.0",
"market_cap_usd": "19499368103.0",
"available_supply": "92054574.0",
"total_supply": "92054574.0",
"percent_change_1h": "-0.51",
"percent_change_24h": "21.85",
"percent_change_7d": "20.51",
"last_updated": "1496138662"
}
]
Please note :
Exchanges will tend to have different prices depending on their user's activity, most the time the price won't vary much but they can do. That's why market tracking sites are more accurate as they give weighted averages.
Related
When my plugin retrieves data from the banno consumer api, Credit Cards, Mortgages, and Investment accounts are all coming through with an account type and subtype that look like this
type: "Third Party"
subtype: "Other"
My plugin needs to be able to determine the difference between these types of accounts, however the Banno consumer api does not define Credit Card or Mortgage as an account type. Furthermore, the documentation states that the subtype field should not be used.
Does the banno consumer api provide any way to accurately determine the type of Credit Card, Mortgage, Investment, or any of these "Third Party" accounts?
The accountType of "Other" is a result of the way that an account is configured within the underlying core (and there are 4 cores that Jack Henry supports..3 for banks and 1 for credit unions).
There often isn't much information available within the core itself about the account, which is how you end up with an accountType of "Other" and accountSubType of "Third Party".
There are credit cards represented (with accountType of "Line of Credit" and accountSubType of "Credit Card"), depending upon the configuration.
Mortgages generally aren't represented directly via accountType and accountSubType and the best that is known from the core is that the account is some type of "Loan".
With Metamask, users have to manually import tokens to their account for these to show up in the Assets section. This is has a neat security feature as dust attack and other "spam" tokens are out of sight from the user. You wallet is usually full of spam as well.
Now I want to relay these user intentions (import of a token) to a custom dApp and filter the tokens according to what the user has imported on his Metamask.
i.e can you access the tokens user has imported to his Metamask and thus see the "whitelisted" contract addresses on users Metamask using the ehtereum or other API?
I have more or less read through the Metamask API docs but didn't find anything.
Only hint I found was in this article saying it cannot be done.
unfortunately we can not get all the tokens the wallet has access to, we need to know first the smart contract addresses.
To best of my knowledge it cannot be done, but what you can do is access the tokens that the user has in their wallet (Not the ones imported into metamask)
Using the Moralis Web3 SDK you can retrieve all token balances of a current user or specified address using:
const balances = await Moralis.Web3API.account.getTokenBalances({address: "any_address"});
And you get an object with the number of tokens and the array of token objects
Example:
[
{
"token_address": "0x2d30ca6f024dbc1307ac8a1a44ca27de6f797ec22ef20627a1307243b0ab7d09",
"name": "Kylin Network",
"symbol": "KYL",
"logo": "https://cdn.moralis.io/eth/0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c.png",
"thumbnail": "https://cdn.moralis.io/eth/0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c_thumb.png",
"decimals": "18",
"balance": "123456789"
},
{other tokens}
]
To filter out the spam token you could iterate over the result and query the user allowance for each of the token contracts. We could suppose that the tokens with allowance != 0 are the token are not spam
Can I use the Paypal API to allow users to send money to other users without leaving my website?
I have a website where users can become friends, much like Facebook. Can I embed a Paypal form that allows users to send each other money directly without leaving my site to Paypal?
So User1 would select their friend User2, and send him money via paypal. Then the money would go straight to User2's paypal account.
thanks!
Setting up payee is a relatively new feature in paypal. Its fairly simple and i found it here. When you setup a payment using some parameters like below
{
"intent": "sale",
"payer":
{
"payment_method": "paypal"
},
...
Just add a payee object to it.
"payee": {
"email": "paypal-de#paypal.com"
}
You can find more info on payee here
With Google retiring the old iframe version in March 2015 we have to switch to the in-app payment route for our extension.
How can we implement repeated purchases of the same product? I see you use the
google.payments.inapp.getPurchases({...
However in our case the user should be able to purchase the same product multiple times. The thought here was just relying on the server postback but it looks like they are removing that too?
{
"response": {
"details": [
{
"kind": "chromewebstore#payment",
"itemId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sku": "giant_tv",
"createdTime": "1387221267248",
"state": "ACTIVE"
}
]
}
}
I must be missing something here, why would Google not implement a way to allow repeated purchases of the same sku or at least allow us to tag the purchase with additional information?
For complete information on the new payments API see:
https://developer.chrome.com/webstore/payments-iap
To answer your question, purchases for the same SKU will only be accepted if you first call
google.payments.inapp.consumePurchase and pass in the SKU that matches a product the profile/user already owns. This is similar to how the Google Play API works.
I know how to determine if account type is personal or not personal by max_upload_size using v2 API:
https://api.box.com/2.0/users/me
or add extra fields can_see_managed_users or is_exempt_from_device_limits, then check the response.
But I assume the business account has the storage limitation, which means the response of is_exempt_from_device_limits should be false for business account. So I created a business account and tested on it. The result is true instead.
So is there any api or flags which can be used to determine the difference?
Thanks in advance.
You are correct that you can determine that an account is a business or enterprise account by the max_upload_size setting. You've also discovered an administrative feature, that the admins can set on their enterprise account. They can decide if their users are allowed to have multiple devices of the same kind that are allowed to login.
There isn't a specific API at the moment to determine what type of account the user has. We're contemplating it, but for now, the max_upload_size is probably the best way to gauge. Keep in mind that Box keeps changing that limit. We have been slowly raising that limit on various types of accounts.
Box user API now returns an enterprise object. I believe we can use this to determine if it is a business account or enterprise account like this:
"enterprise": {
"type": "enterprise",
"id": "17077211",
"name": "seanrose enterprise"
}