Problem with send argument:Address to get func (TACT, TON)

44 Views Asked by At

Please help :( I don't know if it's related to the blueprint, but I think it is. After building my contract, everything goes well and so does the deployment.

I want to send an address to a function (I tried also to send to simple functions, just empty ones that take an address as an argumentnet).

Function in contract:

get fun ContractPatient(owner: Address): Address
    {
        return contractAddress(initOf Patient(myAddress(),owner));
    }

In react js , vite:

const patient = useAsyncInitialize(async () =>
    {
        if (!patientsContract || !client) return;
        console.log(patientsContract);

        const addr = await patientsContract.getContractPatient(
            Address.parse(wallet)
        )

        return client.open(Patient.fromAddress(addr))
    }, [patientsContract, client])

And I get the following error, what could this be related to? (I dont' know, but address of my wallet not equal address this (first letter and last three letter not equal with my wallet, maybe is feature ?)

Uncaught (in promise) Error: Invalid address. Got EQD47c2WNNyLqSVPS0-x6DiAjWx1EzB_FVqwSThYKeI2Fe34
    at BitBuilder.writeAddress (BitBuilder.js:266:15)
    at _Builder.storeAddress (Builder.js:237:20)
    at TupleBuilder.writeAddress (builder.js:102:80)
    at Patients.getContractPatient (tact_Patients.ts:711:17)
    at Proxy.<anonymous> (openContract.js:38:47)
    at useIntegrationContract.js:29:45
    at useAsyncInitialize.js:11:28
    at useAsyncInitialize.js:12:11
    at commitHookEffectListMount (react-dom_client.js:24344:34)
    at commitPassiveMountOnFiber (react-dom_client.js:25592:19)

I'm using JS. Blueprint test < it's OK! Example (Success.)

it('reg', async () =>
    {
        const message: Registration =
        {
            $$type: 'Registration',
            address: deployer.address.toString()
        }

        await patients.send(deployer.getSender(),
            {
                value: toNano("0.5")
            }, message);

        const addressContract = await patients.getContractPatient(deployer.address);
        const patient = blockchain.openContract(Patient.fromAddress(addressContract));

        console.log((await patient.getAllDocs()).values());
        expect((await patient.getAllDocs()).values().length === 0);
    });

I tried changing the contract to a simple one with the argument being accepted as an address. But the tests went well, and when I deployed it, I got the following error from the client. Now I’ll try to translate it to TS, it may be related to this (since it refused to work on webpack except vite, maybe the same story is here)

0

There are 0 best solutions below