# Create Aptos Sponsored

```typescript
import 'dotenv/config';
import { NetworkNames, initializeSdkGateway } from '@kanalabs/mirai';
import { randomPrivateKey } from '@etherspot/prime-sdk/dist/sdk/common';

(async () => {
    
    // Generate a random private key for the user
    const key = randomPrivateKey();
    
    // initializating sdk...
    const sdk = await initializeSdkGateway(
        { privateKey: key as string },
        { 
          networks: [NetworkNames.AptosTestnet, NetworkNames.Mumbai], 
          sponsor: process.env.SPONSOR_KEY as string,
          bundlerApiKey: process.env.BUNDLER_API_KEY
        },
      );
    
    // Get the Aptos instance for AptosTestnet
    const apt = sdk.getAptosInstance(NetworkNames.AptosTestnet);
    
    // Create a sponsored account using the Aptos instance's controller and log the result
    console.log(await apt.createAccountSponsored(apt.controller, [], []));
    
    // Log the SmartWallet details
    console.log(await apt.getSmartWalletDetails());
})()

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kanalabs.io/smart-wallet-sdk/mirai-sdk-the-evm-smart-wallet-and-paymaster/examples/create-aptos-sponsored.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
