Module-level declarations

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
function delete_auth_descriptor_resolver(args: gtv, account_id: byte_array, auth_descriptor_ids: list<byte_array>): byte_array?
function delete_auth_descriptors_for_signer_resolver(args: gtv, account_id: byte_array, auth_descriptor_ids: list<byte_array>): byte_array?
Link copied to clipboard
@extend(auth_handler) function (): map<text, _auth_handler>
Link copied to clipboard
@extend(auth_handler) function (): map<text, _auth_handler>
Link copied to clipboard
@extend(auth_handler) function (): map<text, _auth_handler>
Link copied to clipboard
@extend(auth_handler) function (): map<text, _auth_handler>
Link copied to clipboard
@extend(auth_handler) function (): map<text, _auth_handler>
Link copied to clipboard
function update_main_auth_descriptor_resolver(args: gtv, account_id: byte_array, auth_descriptor_ids: list<byte_array>): byte_array?

Queries

Link copied to clipboard
@mount("ft4.get_account_auth_descriptor_by_id") query get_account_auth_descriptor_by_id(account_id: byte_array, id: byte_array): (id: byte_array, account_id: byte_array, auth_type: auth_type, args: gtv, rules: gtv, created: integer)

Retrieves an auth descriptor from an account.

Throws an error if no auth descriptor matches the provided arguments. Common cases include:

  • the account id or auth descriptor id was not found

  • the auth descriptor in question was not found on the account in question

Link copied to clipboard
@mount("ft4.get_account_auth_descriptors") query get_account_auth_descriptors(id: byte_array): list<(id: byte_array, account_id: byte_array, auth_type: auth_type, args: gtv, rules: gtv, created: integer)>

Returns all auth descriptors associated with the specified account.

Returns a list which should in most cases contain at least one value (the main auth descriptor). An empty list from this query when fetching auth descriptors for a user account would be indicative of either:

  • a bug in the dapp logic that caused the main auth descriptor to be removed

  • the account ID passed refers to a non-user account, which does not have auth descriptors

Link copied to clipboard
@mount("ft4.get_account_auth_descriptors_by_signer") query get_account_auth_descriptors_by_signer(account_id: byte_array, signer: byte_array): list<(id: byte_array, account_id: byte_array, auth_type: auth_type, args: gtv, rules: gtv, created: integer)>

Returns all the auth descriptors associated with a specific account for which the provided pubkey is a signer. Either as a single signer or as part of a multisig auth descriptor.

Returns an empty list if no auth descriptors match

Link copied to clipboard
@mount("ft4.get_account_by_id") query get_account_by_id(id: byte_array): byte_array?

Retrieves an account by its id. If no account with the specified id exists, then this query will return null

Link copied to clipboard
@mount("ft4.get_account_main_auth_descriptor") query get_account_main_auth_descriptor(account_id: byte_array): (id: byte_array, account_id: byte_array, auth_type: auth_type, args: gtv, rules: gtv, created: integer)

Retrieves the main auth descriptor of an account.

Throws an error if there is no main auth descriptor associated with the account. Common cases include:

  • the provided account id is the id of a system or lock account

  • there was a bug in the dapp code which deleted the main auth descriptor of a user account without adding a new one

Link copied to clipboard
@mount("ft4.get_account_rate_limit_last_update") query get_account_rate_limit_last_update(account_id: byte_array): (points: integer, last_update: integer)

Retrieves rate limit information about the specified account id. More specifically, the current number of points available and when this was last updated.

If it was a while ago since the account was accessed, the points returned might be outdated (as they might have regenerated in the meantime). The correct current number can be queried by combining the response of this query with that of get_config()

Link copied to clipboard
@mount("ft4.get_accounts_by_auth_descriptor_id") query get_accounts_by_auth_descriptor_id(id: byte_array, page_size: integer?, page_cursor: text?): paged_result

Retrieves all accounts which the provided auth descriptor id is associated with. Since there might potentially be many accounts that match this criteria, the response of this query is paginated.

Link copied to clipboard
@mount("ft4.get_accounts_by_signer") query get_accounts_by_signer(id: byte_array, page_size: integer?, page_cursor: text?): paged_result

Retrieves all accounts of which the provided pubkey has at least one auth descriptor attached where it is part of the signers. Since there might potentially be many accounts that matches this criteria, the response of this query is paginated.

Link copied to clipboard
@mount("ft4.get_accounts_by_type") query get_accounts_by_type(type: text, page_size: integer, page_cursor: text?): paged_result

Retrieves all accounts of the specified type. Since there might potentially be many accounts that match this criteria, the response of this query is paginated.

Link copied to clipboard
@mount("ft4.get_auth_descriptor_counter") query get_auth_descriptor_counter(account_id: byte_array, auth_descriptor_id: byte_array): integer?

Retrieves the current counter value of an auth descriptor.

Link copied to clipboard
@mount("ft4.get_config") query get_config(): (rate_limit: rate_limit_config, auth_descriptor: auth_descriptor_config)

Fetches the account related part of the config used by this dapp. As specified in module args configuration.

Link copied to clipboard
@mount("ft4.is_auth_descriptor_valid") query is_auth_descriptor_valid(account_id: byte_array, auth_descriptor_id: byte_array): boolean

Checks if the specified auth descriptor is valid for the specified account. By valid, it is meant that none of the rules of the auth descriptor has been violated yet.

Due to the nature of the available rules, a truthy response of this query should be considered as valid only at the point of calling the query and might have changed between the time of calling this query and the time when the auth descriptor is actually used.

Operations

Link copied to clipboard
@mount("ft4.add_auth_descriptor") operation add_auth_descriptor(new_desc: auth_descriptor)

Adds a new auth descriptor to an account. The account in question will be the account which is referred to by the preceding auth operation.

Must be signed by an auth descriptor with accounts.auth_flags.ACCOUNT that is already associated with the account, as well as the signer of the new auth descriptor. In case the new auth descriptor is a multi sig auth descriptor, every signer that is part of the auth descriptor must sign this operation, even if the number of required signatures is less than the number of signers.

Link copied to clipboard
@mount("ft4.delete_all_auth_descriptors_except_main") operation delete_all_auth_descriptors_except_main()

This operation does what it says on the label, it removes all the auth descriptors that is associated with an account except for the main one.

This function can be called only by the main auth descriptor, which is also supposed to have the accounts.auth_flags.ACCOUNT.

Note: Deleting auth descriptors using this operation will delete the auth descriptors from every account they are associated with.

Link copied to clipboard
@mount("ft4.delete_auth_descriptor") operation delete_auth_descriptor(auth_descriptor_id: byte_array)

Deletes the auth descriptor with the specified id.

Must be signed by an auth descriptor with accounts.auth_flags.ACCOUNT.

If the auth descriptor to delete is the same that is authorizing the operation, the account flag restriction is removed.

Note: Deleting an auth descriptor using this operation will delete the auth descriptor from every account it is associated with.

If the provided auth descriptor happens to be the main auth descriptor of any account, this operation will fail.

Link copied to clipboard
@mount("ft4.delete_auth_descriptors_for_signer") operation delete_auth_descriptors_for_signer(signer: byte_array)

Deletes all auth descriptors from an account for which the provided signer is included in the signers array.

Must be signed by an auth descriptor with accounts.auth_flags.ACCOUNT.

Note: Deleting an auth descriptor using this operation will delete the auth descriptor from every account it is associated with.

If any of the matched auth descriptors happens to be the main auth descriptor of any account, this operation will fail.

Link copied to clipboard
@mount("ft4.update_main_auth_descriptor") operation update_main_auth_descriptor(new_desc: auth_descriptor)

Sets provided auth descriptor as main auth descriptor, deleting the previous one.

Must be signed by an auth descriptor with accounts.auth_flags.ACCOUNT and it must be signed by all the signers contained in the new auth descriptor. Any combination of swapping single sig and multisig auth descriptors as main auth descriptor is valid, so long as the number of signatures requirements are fulfilled.

Throws an error if the new auth descriptor has any other value than GTV_NULL in the rules field.

Throws an error if the new auth descriptor does not have all the mandatory flags.