import { describe, expect, it } from 'vitest';
import { GraphV2, IpfsV2 } from '~/index.js';
import { getSmartAccountWalletClient } from './smart-wallet.js';
describe('getSmartAccountWalletClient', { timeout: 6000000 }, () => {
    it('should create a client with the default RPC URL when no RPC URL is provided', async () => {
        const address = '0x7fd1BF705f4202C76434A494b88E7E1515D7688A';
        const spaceId = '0f3aa347-efa3-4919-91d1-bb63a382553d';
        const client = await getSmartAccountWalletClient({
            privateKey: '0x9054bbced0e1a05a5dea2ff9446ea30fc98eb1934342bd2232b8753ffc46894d',
            // rpcUrl: 'https://geo.rpc.pinax.network/v1/b970125fc31219b50e40d56c345496157b71ad1d9ee0016b/',
        });
        console.log('Your spaceId is:', spaceId);
        // Once you have a personal space you can write data to it. Generate
        // ops for your data using Triple.make or Relation.make accordingly.
        const testEntity = await GraphV2.createEntity({
            name: 'Test Entity 4 by Nik',
        });
        console.log('Test Entity Id:', testEntity.id);
        console.log('Test Entity Ops:', testEntity.ops);
        const { cid } = await IpfsV2.publishEdit({
            name: 'creating a test entity',
            author: address,
            ops: testEntity.ops,
        });
        console.log('CID:', cid);
        // This returns the correct contract address and calldata depending on the space id
        // Make sure you use the correct space id in the URL below and the correct network.
        const result = await fetch(`https://api-testnet.grc-20.thegraph.com/space/${spaceId}/edit/calldata`, {
            method: 'POST',
            body: JSON.stringify({
                cid: cid,
                // Optionally specify TESTNET or MAINNET. Defaults to MAINNET
                // network: "TESTNET",
                network: 'MAINNET',
            }),
        });
        const { to, data } = await result.json();
        console.log('To:', to);
        console.log('Data:', data);
        const transaction = await client.sendTransaction({
            to: to,
            value: 0n,
            data: data,
        });
        console.log('Transaction hash:', transaction);
        expect(client).toBeDefined();
    });
});
//# sourceMappingURL=smart-wallet-2.test.js.map