Skip to content

Latest commit

 

History

History
255 lines (175 loc) · 11.4 KB

AccountsApi.md

File metadata and controls

255 lines (175 loc) · 11.4 KB

aptos_api_dart.api.AccountsApi

Load the API package

import 'package:aptos_api_dart/api.dart';

All URIs are relative to https://raw.githubusercontent.com/v1

Method HTTP request Description
getAccount GET /accounts/{address} Get account
getAccountModule GET /accounts/{address}/module/{module_name} Get account module
getAccountModules GET /accounts/{address}/modules Get account modules
getAccountResource GET /accounts/{address}/resource/{resource_type} Get account resource
getAccountResources GET /accounts/{address}/resources Get account resources

getAccount

AccountData getAccount(address, ledgerVersion)

Get account

Return the authentication key and the sequence number for an account address. Optionally, a ledger version can be specified. If the ledger version is not specified in the request, the latest ledger version is used.

Example

import 'package:aptos_api_dart/api.dart';

final api = AptosApiDart().getAccountsApi();
final String address = address_example; // String | Address of account with or without a `0x` prefix
final String ledgerVersion = ledgerVersion_example; // String | Ledger version to get state of account  If not provided, it will be the latest version

try {
    final response = api.getAccount(address, ledgerVersion);
    print(response);
} catch on DioError (e) {
    print('Exception when calling AccountsApi->getAccount: $e\n');
}

Parameters

Name Type Description Notes
address String Address of account with or without a 0x prefix
ledgerVersion String Ledger version to get state of account If not provided, it will be the latest version [optional]

Return type

AccountData

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/x-bcs

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getAccountModule

MoveModuleBytecode getAccountModule(address, moduleName, ledgerVersion)

Get account module

Retrieves an individual module from a given account and at a specific ledger version. If the ledger version is not specified in the request, the latest ledger version is used. The Aptos nodes prune account state history, via a configurable time window. If the requested ledger version has been pruned, the server responds with a 410.

Example

import 'package:aptos_api_dart/api.dart';

final api = AptosApiDart().getAccountsApi();
final String address = address_example; // String | Address of account with or without a `0x` prefix
final String moduleName = moduleName_example; // String | Name of module to retrieve e.g. `coin`
final String ledgerVersion = ledgerVersion_example; // String | Ledger version to get state of account  If not provided, it will be the latest version

try {
    final response = api.getAccountModule(address, moduleName, ledgerVersion);
    print(response);
} catch on DioError (e) {
    print('Exception when calling AccountsApi->getAccountModule: $e\n');
}

Parameters

Name Type Description Notes
address String Address of account with or without a 0x prefix
moduleName String Name of module to retrieve e.g. coin
ledgerVersion String Ledger version to get state of account If not provided, it will be the latest version [optional]

Return type

MoveModuleBytecode

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/x-bcs

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getAccountModules

BuiltList getAccountModules(address, ledgerVersion, start, limit)

Get account modules

Retrieves all account modules' bytecode for a given account at a specific ledger version. If the ledger version is not specified in the request, the latest ledger version is used. The Aptos nodes prune account state history, via a configurable time window. If the requested ledger version has been pruned, the server responds with a 410.

Example

import 'package:aptos_api_dart/api.dart';

final api = AptosApiDart().getAccountsApi();
final String address = address_example; // String | Address of account with or without a `0x` prefix
final String ledgerVersion = ledgerVersion_example; // String | Ledger version to get state of account  If not provided, it will be the latest version
final String start = start_example; // String | Cursor specifying where to start for pagination  This cursor cannot be derived manually client-side. Instead, you must call this endpoint once without this query parameter specified, and then use the cursor returned in the X-Aptos-Cursor header in the response.
final int limit = 56; // int | Max number of account modules to retrieve  If not provided, defaults to default page size.

try {
    final response = api.getAccountModules(address, ledgerVersion, start, limit);
    print(response);
} catch on DioError (e) {
    print('Exception when calling AccountsApi->getAccountModules: $e\n');
}

Parameters

Name Type Description Notes
address String Address of account with or without a 0x prefix
ledgerVersion String Ledger version to get state of account If not provided, it will be the latest version [optional]
start String Cursor specifying where to start for pagination This cursor cannot be derived manually client-side. Instead, you must call this endpoint once without this query parameter specified, and then use the cursor returned in the X-Aptos-Cursor header in the response. [optional]
limit int Max number of account modules to retrieve If not provided, defaults to default page size. [optional]

Return type

BuiltList<MoveModuleBytecode>

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/x-bcs

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getAccountResource

MoveResource getAccountResource(address, resourceType, ledgerVersion)

Get account resource

Retrieves an individual resource from a given account and at a specific ledger version. If the ledger version is not specified in the request, the latest ledger version is used. The Aptos nodes prune account state history, via a configurable time window. If the requested ledger version has been pruned, the server responds with a 410.

Example

import 'package:aptos_api_dart/api.dart';

final api = AptosApiDart().getAccountsApi();
final String address = address_example; // String | Address of account with or without a `0x` prefix
final String resourceType = resourceType_example; // String | Name of struct to retrieve e.g. `0x1::account::Account`
final String ledgerVersion = ledgerVersion_example; // String | Ledger version to get state of account  If not provided, it will be the latest version

try {
    final response = api.getAccountResource(address, resourceType, ledgerVersion);
    print(response);
} catch on DioError (e) {
    print('Exception when calling AccountsApi->getAccountResource: $e\n');
}

Parameters

Name Type Description Notes
address String Address of account with or without a 0x prefix
resourceType String Name of struct to retrieve e.g. 0x1::account::Account
ledgerVersion String Ledger version to get state of account If not provided, it will be the latest version [optional]

Return type

MoveResource

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/x-bcs

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getAccountResources

BuiltList getAccountResources(address, ledgerVersion, start, limit)

Get account resources

Retrieves all account resources for a given account and a specific ledger version. If the ledger version is not specified in the request, the latest ledger version is used. The Aptos nodes prune account state history, via a configurable time window. If the requested ledger version has been pruned, the server responds with a 410.

Example

import 'package:aptos_api_dart/api.dart';

final api = AptosApiDart().getAccountsApi();
final String address = address_example; // String | Address of account with or without a `0x` prefix
final String ledgerVersion = ledgerVersion_example; // String | Ledger version to get state of account  If not provided, it will be the latest version
final String start = start_example; // String | Cursor specifying where to start for pagination  This cursor cannot be derived manually client-side. Instead, you must call this endpoint once without this query parameter specified, and then use the cursor returned in the X-Aptos-Cursor header in the response.
final int limit = 56; // int | Max number of account resources to retrieve  If not provided, defaults to default page size.

try {
    final response = api.getAccountResources(address, ledgerVersion, start, limit);
    print(response);
} catch on DioError (e) {
    print('Exception when calling AccountsApi->getAccountResources: $e\n');
}

Parameters

Name Type Description Notes
address String Address of account with or without a 0x prefix
ledgerVersion String Ledger version to get state of account If not provided, it will be the latest version [optional]
start String Cursor specifying where to start for pagination This cursor cannot be derived manually client-side. Instead, you must call this endpoint once without this query parameter specified, and then use the cursor returned in the X-Aptos-Cursor header in the response. [optional]
limit int Max number of account resources to retrieve If not provided, defaults to default page size. [optional]

Return type

BuiltList<MoveResource>

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/x-bcs

[Back to top] [Back to API list] [Back to Model list] [Back to README]