Skip to content

Added CORS#175

Open
freaker2k7 wants to merge 2 commits intotoncenter:masterfrom
freaker2k7:master
Open

Added CORS#175
freaker2k7 wants to merge 2 commits intotoncenter:masterfrom
freaker2k7:master

Conversation

@freaker2k7
Copy link

I had issues when running the following code in the browser:

import { Address, beginCell, toNano } from '@ton/core';
import { TonClient } from '@ton/ton';

const client = new TonClient({ endpoint: 'http://localhost:8082/jsonRPC' });

const contractAddress = Address.parse('0:1da77f0269bbbb76c862ea424b257df63bd1acb0d4eb681b68c9aadfbf553b93');

const totalBalance = Number(await client.getBalance(contractAddress)) / 1e9;

When await client.getBalance() was throwing a CORS error in the browser.

So I added CORS support to the FastAPI server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant