Find Tron Energy Estimate Before transaction? - tron

i want to calculate energy before transaction in tron blockchain, So we can show end users fees for transaction before transaction in app. But i am din't able to find any docs or any function any api for this. please help me in this.

I hope this isn't too late :)
This documentation should cover your need i believe:
https://tronprotocol.github.io/documentation-en/mechanism-algorithm/resource/#2-how-to-set-fee-limit-caller-must-read
Tron GET Endpoint: https://api.trongrid.io/v1/accounts/{contract}/transactions?only_confirmed=true you may add &limit= your preferred stop point [type=int e.g 200].
From the data returned you can get the energy_usage_total for each then average it.
This gives insight into the energy consumed for the x numbers of latest transactions you requested for.

Related

XERO API - Budget Variance Summary

Has anyone successfully got a budget veriance working from XERO API? It doesn't provide it as an end point and I've been tryingt to come up with soltions to self generate it. But I'm finding bottle necks everywhere I turn.
I was thinking we could fetch all the transactions and build it again locally, but they are lacking massively as each one in the 'BankTransactions' report contains very little details, so I would then need to fetch all the details per transaction, if theres say 1,000 transactions in the last year then we use our 1/5 of our allowance and it's 60 API calls a minute so that will take forever.
Has anyone come up with a solution?

Binance API transaction history

I am trying to display a users transaction history in binance, including fund deposits and withdrawals as well as buying and selling of different crypto's. Does anyone know which binance API endpoints I would use to do this? It seems quite complicated in comparison to other trading platforms.
Thanks
This is the link to the docs: https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
I can see the Wallet endpoints "Withdraw" and "Deposit", but this won't cover crypto trading will it?, The account trade list call would be ideal, but it requires a symbol input which I'm not sure how I would obtain dynamically.
I would also like this endpoint to provide me with the data so I can get the avg buy price for a crypto
Currently this is not supported. See: https://dev.binance.vision/t/fetch-all-account-orders/279/3
This is the route you're looking for to get the user trade history. The big downside is that you have to specify the exchange symbol, you cannot get the history of the account with just one request:
https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
Get your account information first. You can then extract non-zero balances from here to get symbols for transactions. You can then loop through each currency pair and get its transaction history. This seems to be the most optimistic way we can get right now
You can also try to use caching. For example, you can remember balance for a particular coin, and if it has not changed by the next launch, then it is likely (but not 100%) that no transactions were made with it
You can also connect to WebSocket, but this is still a terrible crutch and requires a DOS attack to get the necessary data
Please note that here the balances for Savings wallet have LD prefix added to their ticker. For example, BTC in the Savings wallet is labeled as LDBTC

create field55, set token or pan

I create Field55 to make emv transaction from NFC-terminal, all work fine but it's need to set by what method user make pay: token (Apple/Google Pay) or by physical card (pan). I know how to get it when read payment but, but can not find which tag in filed55 responsible for this information. If anyone know - please help. Thanks!
It's a little hard to understand what you are doing. Card emulation on tokenized wallet transactions in face to face interface produces exactly the same data as for any other card. If you are trying to produce face to face transactions from ecommerce tokens - it's not possible as this will generate in best case a 3DS cryptogram, not EMV data (with an irrelevant exception).
Can you maybe explain better what you are trying to achieve?

Funding Chainlink VRF Dynamically

I am trying to wrap my head around how Chainlink VRF integrates into Solidity contracts, such as in this randomly generated NFT tutorial: https://blog.chain.link/random-numbers-nft-erc721/
My question is around the actual funding of the oracle. In the Chainlink VRF documents, this warning is displayed: "Requesting randomness will fail unless your deployed contract has enough LINK to pay for it. Learn how to Acquire testnet LINK and Fund your contract." An example is given of how to fund the VRF contract with metamask and Remix.
However, I'm not really sure how this would work on a large scale. If you have an NFT "factory" that becomes very popular with potentially many requests per day/hour/minute, are you just expected to front run the funding of this VRF contract to avoid the aforementioned warning (seems like the costs would be non-trivial / hard to predict)?
Alternatively, if you wanted your NFT consumer to fund it, would you have to build in some logic that converts Ether to Link and then sends it to the oracle contract? (or make them go buy Link token?)
I could be looking at this the wrong way, but the scalability just doesn't seem well described in the documentation and only looked at from a testing / test network standpoint. Thank you.
You can:
Move the costs directly to the caller
Require LINK payment, or some other form of payment that will cover the costs of oracle request
Request the oracle data in a smaller frequency (if your use case allows it)
Are you receiving some price info from an oracle? Is it sufficient to update the price info once a day instead of once an hour?
Change your contract logic to not require (that much) oracle data
Does your factory really need off-chain random number generation? Wouldn't be sufficient to generate "random" number from the blockhash, difficulty, etc.?
My suggestion is, maybe a little awkward, but for the sake of decentralization, could work.
You charge your Contract1 with a sufficient link to get started
Charge every minter the equivalent link transaction cost in eth (+ the % that covers the costs of the trade to link and transfer between contracts)
As they mint, it is incorporated into the price and the eth is sent to Contract2.
In Contract2 simply exists a public callable function to initiate a swap for the link via routerV2 or a similar contract.
By placing a call to this function and contract, you can then just let any minter activate the swap contract function
The eth in Contract2 will be sent back to Contract1 as a link.
You could have a counter go and then call Contract2 every time the link fund is low and refill it automatically.
If you build it into the mint, then the inter will cover the fees.

Paypal Recurring Payment Negative Testing

I am developing recurring payments using PayPal Pro and the NVP APIs. I have read here: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_payflowpro_recurringbilling_guide.pdf that negative testing should work with recurring payments. I have my profile setup to allow for negative testing.
I am looking cause my initial payment to fail. To do this I have set my AMT and INITAMT to 2010. According to the documentation, I thought this would cause a payment failure, but instead the initial payment is successful.
Has anyone got negative testing with recurring payments to work? For either the scheduled payment or the initial Payment? If so, could you please provide any steps and/or tips?
Thanks!
Try this:
PARTNER=PayPal
PWD=yourpass
VENDOR=yourvendor
USER=youruser
ACTION=A
TENDER=C
ACCT=5105105105105100
EXPDATE=0115
TRXTYPE=R
PROFILENAME=MonthlySubscription
AMT=50000
START=12122013
PAYPERIOD=MONT
TERM=12
OPTIONALTRX=S
OPTIONALTRXAMT=2000.00
COMMENT1=First Time Customer
Having the OPTIONALTRXAMT=2000 will trigger a decline, or any code you need.