diff --git a/ecosystem/python/sdk/aptos_sdk/aptos_token_client.py b/ecosystem/python/sdk/aptos_sdk/aptos_token_client.py index 882059fbcb26c2..e8d1ffaebe353d 100644 --- a/ecosystem/python/sdk/aptos_sdk/aptos_token_client.py +++ b/ecosystem/python/sdk/aptos_sdk/aptos_token_client.py @@ -521,7 +521,12 @@ async def mint_soul_bound_token( async def transfer_token( self, owner: Account, token: AccountAddress, to: AccountAddress ) -> str: # <:!:transfer_token - return await self.client.transfer_object(owner, token, to) + return await self.client.transfer_object( + owner, + token, + to, + TypeTag(StructTag.from_str("0x4::aptos_token::AptosToken")), + ) async def burn_token(self, creator: Account, token: AccountAddress) -> str: payload = EntryFunction.natural( diff --git a/ecosystem/python/sdk/aptos_sdk/async_client.py b/ecosystem/python/sdk/aptos_sdk/async_client.py index 0d0cb679bba6e1..dd1fabb2ec098c 100644 --- a/ecosystem/python/sdk/aptos_sdk/async_client.py +++ b/ecosystem/python/sdk/aptos_sdk/async_client.py @@ -22,6 +22,7 @@ TransactionArgument, TransactionPayload, ) +from .type_tag import StructTag, TypeTag U64_MAX = 18446744073709551615 @@ -751,9 +752,13 @@ async def get_collection( "0x3::token::CollectionData", collection_name, ) - + async def transfer_object( - self, owner: Account, object: AccountAddress, to: AccountAddress + self, + owner: Account, + object: AccountAddress, + to: AccountAddress, + type_tag: TypeTag = TypeTag(StructTag.from_str("0x1::object::ObjectCore")), ) -> str: transaction_arguments = [ TransactionArgument(object, Serializer.struct), @@ -762,8 +767,8 @@ async def transfer_object( payload = EntryFunction.natural( "0x1::object", - "transfer_call", - [], + "transfer", + [type_tag], transaction_arguments, ) diff --git a/ecosystem/python/sdk/examples/aptos-token.py b/ecosystem/python/sdk/examples/aptos-token.py index 8f324abc90b524..cf874bf7321d1f 100644 --- a/ecosystem/python/sdk/examples/aptos-token.py +++ b/ecosystem/python/sdk/examples/aptos-token.py @@ -5,7 +5,7 @@ from aptos_sdk.account import Account from aptos_sdk.account_address import AccountAddress -from aptos_sdk.aptos_token_client import AptosTokenClient, Property, PropertyMap, Object +from aptos_sdk.aptos_token_client import AptosTokenClient, Object, Property, PropertyMap from aptos_sdk.async_client import FaucetClient, RestClient from .common import FAUCET_URL, NODE_URL @@ -113,7 +113,7 @@ async def main(): print(f"Token: {token_addr}\n") print(f"Owner: {token_data.resources[Object].owner}") print(" ...transferring... ") - txn_hash = await rest_client.transfer_object(alice, token_addr, bob.address()) + txn_hash = await token_client.transfer_token(alice, token_addr, bob.address()) await rest_client.wait_for_transaction(txn_hash) token_data = await token_client.read_object(token_addr) print(f"Owner: {token_data.resources[Object].owner}\n")