![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@ton-community/contract-verifier-sdk
Advanced tools
TON verifier SDK - sources fetcher + code viewer for FunC with code highlighting
TON verifier data fetcher and code viewer with FunC code highlighting
This repo is a part of the following:
Add this to your HTML structure
<div id="myVerifierContainer">
<div id="myVerifierFiles">
</div>
<div id="myVerifierContent">
</div>
</div>
npm install @ton-community/contract-verifier-sdk
<script src="https://cdn.jsdelivr.net/gh/ton-community/contract-verifier-sdk@1.1.0/dist/index.min.js"></script>
import { ContractVerifier } from "@ton-community/contract-verifier-sdk";
const ipfsLink = await ContractVerifier.getSourcesJsonUrl(
"45cE5NYJuT5l2bJ+HfRI0hUhR3LsBI6wER6yralqPyY=",
{
testnet: false
}
);
const src = await ContractVerifier.getSourcesData(ipfsLink!, {testnet: false});
// use contract data
<script>
document.addEventListener("DOMContentLoaded", async function () {
const codeCellHash = "/rX/aCDi/w2Ug+fg1iyBfYRniftK5YDIeIZtlZ2r1cA=";
const ipfslink = await ContractVerifier.getSourcesJsonUrl(codeCellHash);
// means there exists a verified source for this contract
if (ipfslink) {
// By default, it's best to leave the default IPFS gateway as it has all verified source code pinned and ready
const sourcesData = await ContractVerifier.getSourcesData(ipfslink);
const theme = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
ContractVerifierUI.loadSourcesData(sourcesData, {
containerSelector: "#myVerifierContainer",
fileListSelector: "#myVerifierFiles",
contentSelector: "#myVerifierContent",
theme
});
}
});
</script>
interface GetSourcesOptions {
verifier?: string, // Defaults to "orbs.com"
httpApiEndpointV4?: string, // Defaults to an Orbs L3 TON Gateway
testnet?: boolean
}
// Returns an `ipfs://` prefixed URL if the given code cell hash has a corresponding source verifier contract
async ContractVerifier.getSourcesJsonUrl(codeCellHash: string, options?: GetSourcesOptions): Promise<string | null>;
interface SourcesData {
files: { name: string; content: string }[];
commandLine: string;
compiler: string;
version: string;
verificationDate: Date;
}
type IpfsUrlConverterFunc (ipfsUrl: string) => string;
// Returns file names and their source code content
async ContractVerifier.getSourcesData(sourcesJsonUrl: string, options?: {
ipfsConverter?: IpfsUrlConverterFunc;
testnet?: boolean;
}): Promise<SourcesData>;
ContractVerifierUI.loadSourcesData(sourcesData: SourcesData, opts: {
containerSelector: string; // main container
fileListSelector?: string; // if omitted, the file list will not be populated and the setCode function can be used instead to switch between files
contentSelector: string; // code container
theme: Theme; // "light" or "dark"
});
// To be used usually only if the file list is manually built
ContractVerifierUI.setCode(contentSelector: string, content: string);
npm install
npm run build
example/vanilla-minimal
index.html
example/vanilla-vite
npm install
npm link ../../
npm run dev
example/node
npm install
npm link ../../
ts-node index.ts
The widget will attach the following classnames to its components:
contract-verifier-container
contract-verifier-files
contract-verifier-file
contract-verifier-code
Which can be customized according to your needs.
MIT
FAQs
TON verifier SDK - sources fetcher + code viewer for FunC with code highlighting
We found that @ton-community/contract-verifier-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.