{"id":18755477,"url":"https://github.com/synthetixio/js","last_synced_at":"2025-04-13T01:35:36.981Z","repository":{"id":53566271,"uuid":"284860019","full_name":"Synthetixio/js","owner":"Synthetixio","description":"BETA: Javascript library for interacting with the Synthetix protocol","archived":false,"fork":false,"pushed_at":"2021-03-24T20:12:22.000Z","size":15653,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-10T15:58:16.147Z","etag":null,"topics":["defi","ethereum","synthetix"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Synthetixio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-04T02:45:29.000Z","updated_at":"2023-09-08T18:10:54.000Z","dependencies_parsed_at":"2022-09-04T01:03:48.150Z","dependency_job_id":null,"html_url":"https://github.com/Synthetixio/js","commit_stats":null,"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Synthetixio","download_url":"https://codeload.github.com/Synthetixio/js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654030,"owners_count":21140236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["defi","ethereum","synthetix"],"created_at":"2024-11-07T17:32:58.958Z","updated_at":"2025-04-13T01:35:36.373Z","avatar_url":"https://github.com/Synthetixio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Synthetix JS\n\n[![Synthetixio](https://circleci.com/gh/Synthetixio/js.svg?style=svg)](https://github.com/Synthetixio/js)\n\n:warning: This library is still under construction and in BETA, please use with caution.\n\n### The official Javascript library for interacting with Synthetix protocol contracts.\n\nThis library can be used in 2 different environments:\n\n1. Common-js module for node environments\n2. UMD module for browser environments\n\n#### Installation\n\n```\n\n// For node environments:\nconst { synthetix } = require('@synthetixio/js');\n\n// For single page applications:\nimport { synthetix } from '@synthetixio/js';\n\n// For browser environments:\n// after running npm build take the index.browser.js file and put it in a script tag\n// then you can access synthetix on the window object:\nconst { synthetix } = window;\n\n\nconst snxjs = synthetix({ network: 'mainnet' });\n\n\n// Note for typescript applications:\nimport { synthetix, Network } from '@synthetixio/js';\nconst snxjs = synthetix({ network: Network.Mainnet });\n```\n\n#### Usage\n\n```\n// this instance exposes props for the given network: synths, sources, targets, users, etc... as well as helper function toBytes32 - as per synthetix: https://github.com/Synthetixio/synthetix/blob/develop/index.js#L199.\nconst snxjs = synthetix({ network: 'mainnet' });\n\n// If you want to interact with a contract, simply follow the convention:\n// await snxjs[contractName].methodName(arguments)\n// many arguments require being formatted toBytes32, which we also provide with the library\n// Note can optionally pass in a { blockTag: someBlockNumber } to get data from a specific block instead of {}\nE.g:\nconst unformattedSnxPrice = await snxjs.contracts.ExchangeRates.rateForCurrency(snxjs.toBytes32('SNX'), {});\nconst unformattedTotalSupply = await snxjs.contracts.SynthsUSD.totalSupply({});\n\n// We also expose ethers utils which provides handy methods for formatting responses to queries.\nconst { formatEther } = snxjs.utils;\n\nconst snxPrice = formatEther(unformattedSnxPrice);\nconst totalSupply = formatEther(unformattedTotalSupply);\n\n```\n\nSee the examples folder for more usage details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynthetixio%2Fjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynthetixio%2Fjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynthetixio%2Fjs/lists"}