Im trying to fetch all transactions of a certain tron address - blockchain

i couldnt find a way to get the history of transactions a certain Tron address is involved in
i tried the tronweb API : https://api.trongrid.io/v1/accounts/TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh/transactions/trc20?limit=100&contract_address=TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
yet this didnt do anything.
so has anyone managed to find a way to do this ?

It's quiet simple just make a GET request to the following url:
https://api.trongrid.io/v1/accounts/{wallet-address}/transactions/{standard}?&contract_address={contract-address}
Replace {wallet-address} with your desired tron wallet address.
Replace {standard} with the standard of token that you want e.g. trc20.
Replace {contract_address} with the address of the contract of your target token e.g. TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t (USD Tether).
Here are all possible parameters :
only_confirmed (boolean) :
true | false. If false, it returns both confirmed and unconfirmed transactions. If no param is specified, it returns both confirmed and unconfirmed transactions. Cannot be used at the same time with only_unconfirmed param.
only_unconfirmed (boolean) :
true | false. If false, it returns both confirmed and unconfirmed transactions. If no param is specified, it returns both confirmed and unconfirmed transactions. Cannot be used at the same time with only_confirmed param.
limit (int32) :
number of transactions per page, default 20, max 200
fingerprint (string) :
fingerprint of the last transaction returned by the previous page; when using it, the other parameters and filters should remain the same
order_by (string) :
block_timestamp,asc | block_timestamp,desc (default)
min_timestamp (date-time) :
minimum block_timestamp, default 0
max_timestamp (date-time) :
maximum block_timestamp, default now
contract_address (string) :
contract address in base58 or hex
only_to (boolean) :
true | false. If true, only transactions to this address, default: false
only_from (boolean)
true | false. If true, only transactions from this address, default: false

I had success by hitting this endpoint: (docs here)
https://api.trongrid.io/v1/contracts/${contractAddress}/events?block_number=${blockNumber}&only_confirmed=true
It looks like another option is to use TronWeb's getEvents() endpoint:
How to get TRC20 transactions to an address
There is also this, which seems kind of similar:
https://developers.tron.network/reference/geteventresult

The tron GET endpoint you're looking for is: "api.trongrid.io/v1/accounts/{address}/transactions"
Replace {address} with your tron wallet address. Cheers!

You can download it in a CSV format from the tronscan.org
but keep in mind that only the first 10,000 transactions are available.

Related

AWS-sdk no paginators for rds cluster

I just found out that I can get a max of 100 records for DBClusterSnapshots, luckily AWS supports pagination where you can get a list by page. I was going over the documentation for aws-sdk-go to see how my Operation implements pagination. Unfortunately there isn't a pagination method for my Operation.
This is the operation I want to paginate. It says in the doc that it supports pagination.
https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-cluster-snapshots.html
However the pagination method for my operation doesn't appear to be supported
doc: https://docs.aws.amazon.com/sdk-for-go/api/service/rds/
It only supports DBSnapshotsPages but not DBClusterSnapshotsPages
The AWS SDK for Go has the DescribeDBClusterSnapshots function:
func (c *RDS) DescribeDBClusterSnapshots(input *DescribeDBClusterSnapshotsInput) (*DescribeDBClusterSnapshotsOutput, error)
It accepts a parameter of DescribeDBClusterSnapshotsInput, which includes:
Marker *string type:"string"
An optional pagination token provided by a previous DescribeDBClusterSnapshots request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords.
Therefore, your code can call DescribeDBClusterSnapshots, store the marker that is returned, then make another call to DescribeDBClusterSnapshots, passing in that value for marker. This will return the next 'page' of results.
On aws sdk you can handle pagination by yourself using the response's next_page method to verify there's no pages to retrieve. In order to retrieve the next page of results, attaching some ruby example:
# object initializtion:
rds_client = Aws::RDS::Client.new
# implementation:
def self.describe_all_db_snapshots(db_instance_identifier: db_instance_identifier)
response = rds_client.describe_db_snapshots({
db_instance_identifier: db_instance_identifier,
snapshot_type: "automated",
include_shared: false,
include_public: false,
max_records: 100 })
while response.next_page? do
# use the response data here...
puts #{response}
# next pagination iterator
response = response.next_page
end
end
For more details read aws sdk documentation.

Instagram Graph API - Fetch media insights metric when a user switched from personal to business account

I'm looking for a way to fetch Media Insights metrics in Instagram Graph API (https://developers.facebook.com/docs/instagram-api/reference/media/insights) with a nested query based on the userId, even when a client switched from a Personal to a Business account.
I use this nested query to fetch all the data I need : https://graph.facebook.com/v3.2/{userId}?fields=followers_count,media{media_type,caption,timestamp,like_count,insights.metric(reach, impressions)} (this part causes the error: insights.metric(reach, impressions) - it works however for an account that has always been a Business one)
However, because some media linked to the userId were posted before the user switched to a Business account, instead of returning the data only for the media posted after, the API returns this error:
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_data": {
"blame_field_specs": [
[
""
]
]
},
"error_subcode": 2108006,
"is_transient": false,
"error_user_title": "Media Posted Before Business Account Conversion",
"error_user_msg": "The media was posted before the most recent time that the user's account was converted to a business account from a personal account.",
"fbtrace_id": "Gs85pUz14JC"
}
}
Is there a way to know, thru the API, which media were created before and after the account switch from Personal to Business? Or is there a way to fetch the date on which the account was switched?
The only way I currently see to get the data I need is to use the /media edge and query insights for each media until I get an error. Then I would get approximately the date I need. However, this is not optimized at all since we are rate limited to 200 calls per user per hour.
I have the same problem.
For now, I'm Switch between queries (if first have error)
"userId"?fields=id,media.limit(100){insights.metric(reach, impressions)}
"userId"?fields=id,media.limit(100)
I show the user all insights in zero.
I don't know if they're the best alternative, like identify the time of conversion to business and get the post between this range of DateTime
I got the same problem and solved it like this:
Use the nested query just like you did, including insights.metric
If the error appears, do another call without insights.metric - to at least get all other data
For most accounts, it works and there is no additional API call. For the rest, i just cannot get the insights and i have to live with it, i guess - until Facebook/IG fixes the issue.
I got the same problem and solved it like this:
Step1: Convert your Instagram account to a Professional account.
Step2: Then According to Error Post a new post on Instagram and get their Post-ID.
Step3: Then try to get a request using that Post-ID.
{Post-ID}?fields=comments_count,like_count,timestamp,insights.metric(reach,impressions)
curl -i -X GET "https://graph.facebook.com/v12.0/{Post-ID}?fields=comments_count%2Clike_count%2Ctimestamp%2Cinsights.metric(reach%2Cimpressions)&access_token={access_token}"
For more: insights
Here is the relevant logic from a script that can handle this error while still doing a full import. It works by reducing the requested limit to 1 once the error is encountered. It will keep requesting insights until it encounters the error again, then removes insights from the fields and returns to the requested limit.
limit = 50
error_2108006 = False
metrics = 'insights.metric%28impressions%29%2C' # Must be URL encoded for replacement
url = '/PAGE_ID/media?fields=%sid,caption,media_url,media_type&limit=%s' % (metrics, limit)
# While we have more pages
while True:
# Make your API call to Instagram
posts = get_posts_from_instagram(url)
# Check for error 2108006
if posts == 2108006:
# First time getting this error, keep trying to get insights but one by one
if error_2108006 is False:
error_2108006 = True
url = url.replace('limit={}'.format(limit), 'limit=1')
continue
# Not the first time. Strip out insights and return to desired limit.
url = url.replace(metrics, '')
url = url.replace('limit=1', 'limit='.format(limit))
continue
# Do something with the data
for post in posts:
continue
# If there are more pages, fetch the next URL
if 'paging' in posts and 'next' in posts['paging']:
url = posts['paging']['next']
continue
# Done
break

Can you manually set 'phone_number_verified' to true on an AWS Cognito user, without having the end user need to interact with your web-app?

We just solved an issue where entering a wrong phone number (starting digit was missing) resulted in 'phone_number_verified' defaulting to false. Now that the issue is resolved, we do still have a lot of registered users who have had an activation sent to them (and entered said code) whose statuses are CONFIRMED in AWS Cognito, but have the 'phone_number_verified' property still set to false. Is there any way to edit this property in bulk / per user in Cognito itself or is there an API call that needs to be made? Or any solution that does not require the end user to go through the activation process again themselves.
(Further Info)
- AngularJS as Front-End
- Node v6.9 as Back-End
The recommendation here is that the users should call GetUserAttributeVerificationCode and receive a code to verify the phone/email which is then supplied to VerifyUserAttribute. This will ensure that if their numbers are verified.
Although if you are sure that all of their numbers are verified, you can use AdminUpdateUserAttributes to mark them verified. We do not have a batch API right now.
The phone number verified can be set to true by using the following example payload:
let parameters = {
UserPoolId : `${USER_POOL_ID}`,
Username : `${Username}`,
UserAttributes : [
{
'Name': "phone_number" ,
'Value': `${phoneNumber}`
},{
'Name':"phone_number_verified",
'Value': "true"
}]
}
cognitoIdentityServiceProvider.adminUpdateUserAttributes(parameters,function (err, result) {
if(err)
console.log(err);
else
console.log("Attribute updated successfully");
})

What does annotate mean at a request rate limiter

I'm using Django Ratelimit to limit the rate my views can be called by an IP.
But I don't know what the parameter block means, documented here.
When I set it to True, I get a 403 when my rate limit is exceeded.
But I don't understand what happens when it is set to False. The doc says:
block – False Whether to block the request instead of annotating.
My question is: What does "annotate" mean in this context.
As you say, the decorator raises a Ratelimited exception when block=True. This returns a 403 Permission Denied response to the user.
If block=False, no exception is raised. However, a boolean limited has been set on the request object. In your view, you can check for this 'annotation' using getattr, and handle it however you like.
was_limited = getattr(request, 'limited', False):
if was_limited:
return HttpResponse("You have been rate limited")
So if you use block=False, it's up to you to check the value request.limited, and handle it properly.

auth.net - Prior Auth Capture in Test Mode

I'm attempting to use Auth.net to authorize a transaction, then later capture it with prior_auth_capture. This works fine in a sandbox, but running against production in test mode I get some problems:
PRODUCTION_TESTMODE : Transaction Id: 0
PRODUCTION_TESTMODE : CC Authorization is APPROVED for 41.0 - customer Test User.
PRODUCTION_TESTMODE : Auth Code: 000000
Credit card transaction was successful - card was approved for 41.00.
Later, when we try to capture the transaction, we have a problem because auth.net won't accept the transaction ID 0:
PRODUCTION_TESTMODE : CC Capture is ERROR for 41.0 - transaction ID 0
PRODUCTION_TESTMODE : RRC_3_33 : (TESTMODE) A valid referenced transaction ID is required.
Credit card capture was not successful - reason: (TESTMODE) A valid referenced transaction ID is required.
I haven't been successful in finding any documentation around this. Is it normal that prior_auth_capture fails like this in test mode? Is there a way we can handle this, or must we check for transaction ID == 0 and introduce special handling here?
You must be running in Live Mode to process transactions.
Test mode doesn't actually process a transaction, it simply validates that the API Login and Transaction Key are correct for the targeted endpoint, and returns success.