{"id":20812691,"url":"https://github.com/coti-io/coti-sdk-typescript-examples","last_synced_at":"2025-05-11T20:30:27.419Z","repository":{"id":236160421,"uuid":"790047419","full_name":"coti-io/coti-sdk-typescript-examples","owner":"coti-io","description":"TypeScript SDK for COTI v2 - Confidentially Enabling L2","archived":true,"fork":false,"pushed_at":"2024-12-12T14:44:54.000Z","size":101,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T18:48:37.543Z","etag":null,"topics":["l2"],"latest_commit_sha":null,"homepage":"https://coti.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coti-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-22T07:05:11.000Z","updated_at":"2025-01-27T04:55:33.000Z","dependencies_parsed_at":"2024-05-05T10:25:20.905Z","dependency_job_id":"fecf00a6-c0c3-4acb-9458-c37a47e8ef16","html_url":"https://github.com/coti-io/coti-sdk-typescript-examples","commit_stats":null,"previous_names":["coti-io/coti-sdk-typescript","coti-io/coti-sdk-typescript-examples"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coti-io%2Fcoti-sdk-typescript-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coti-io%2Fcoti-sdk-typescript-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coti-io%2Fcoti-sdk-typescript-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coti-io%2Fcoti-sdk-typescript-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coti-io","download_url":"https://codeload.github.com/coti-io/coti-sdk-typescript-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253631836,"owners_count":21939360,"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":["l2"],"created_at":"2024-11-17T20:56:58.249Z","updated_at":"2025-05-11T20:30:27.389Z","avatar_url":"https://github.com/coti-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!WARNING]\n\u003e This repository has been deprecated and moved to [coti-typescript-examples](https://github.com/coti-io/coti-typescript-examples)\n\n# COTI V2 Confidentiality Preserving L2 | SDKs and Examples\n\n\u003e [!NOTE]\n\u003e Please refer to the latest [tags](https://github.com/coti-io/coti-sdk-typescript-examples/tags) to find the most stable version to use.\n\nAll repositories specified below contain smart contracts that implement confidentiality features using the COTI V2 protocol.\nThe contracts provide examples for various use cases, such as Non-Fungible Tokens (NFTs), ERC20 tokens, Auction, and Identity management.\n\nThese contracts demonstrate how to leverage the confidentiality features of the COTI V2 protocol to enhance privacy and security in decentralized applications.\nThe contracts are of Solidity and can be compiled and deployed using popular development tools like Hardhat and Foundry (Work in progress).\n\n#### Important Links:\n\n[Docs](https://docs.coti.io) | [Devnet Explorer](https://explorer-devnet.coti.io) | [Discord](https://discord.gg/cuCykh8P4m) | [Faucet](https://faucet.coti.io)\n\nInteract with the network using any of the following:\n\n1. [Python SDK](https://github.com/coti-io/coti-sdk-python) | [Python SDK Examples](https://github.com/coti-io/coti-sdk-python-examples)\n2. [Typescript SDK](https://github.com/coti-io/coti-sdk-typescript) | [Typescript SDK Examples](https://github.com/coti-io/coti-sdk-typescript-examples)\n3. [Hardhat Dev Environment](https://github.com/coti-io/confidentiality-contracts)\n\nThe following contracts are available in each of the packages:\n\n| Contract                       |            | python sdk  | hardhat sdk | typescript sdk | Contract Description                                                                                                                          |\n|--------------------------------|------------|-------------|-------------|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `AccountOnboard`               | deployment | ✅ *        | ✅           | ❌              | Onboard a EOA account - During onboard network creates AES unique for that EOA which is used for decrypting values sent back from the network |\n| `AccountOnboard`               | execution  | ✅          | ✅           | ✅              | \"                                                                                                                                             |\n| `ERC20Example`                 | deployment | ✅          | ✅           | ❌              | Confidential ERC20 - deploy and transfer encrypted amount of funds                                                                            |\n| `ERC20Example`                 | execution  | ✅          | ✅           | ✅              | \"                                                                                                                                             |\n| `NFTExample`                   | deployment | ❌          | ✅           | ❌              | Confidential NFT example - saving encrypted data                                                                                              |\n| `NFTExample`                   | execution  | ❌          | ✅           | ❌              | \"                                                                                                                                             |\n| `ConfidentialAuction`          | deployment | ❌          | ✅           | ❌              | Confidential auction - encrypted bid amount                                                                                                   |\n| `ConfidentialAuction`          | execution  | ❌          | ✅           | ❌              | \"                                                                                                                                             |\n| `ConfidentialIdentityRegistry` | deployment | ❌          | ✅           | ❌              | Confidential Identity Registry - Encrypted identity data                                                                                      |\n| `ConfidentialIdentityRegistry` | execution  | ❌          | ✅           | ❌              | \"                                                                                                                                             |\n| `DataOnChain`                  | deployment | ✅          | ❌           | ❌              | Basic encryption and decryption - Good place to start explorining network capabilties                                                         |\n| `DataOnChain`                  | execution  | ✅          | ❌           | ✅              | \"                                                                                                                                             |\n| `Precompile`                   | deployment | ✅          | ✅           | ❌              | Thorough examples of the precompile functionality                                                                                             |\n| `Precompile`                   | execution  | ✅          | ✅           | ❌              | \"                                                                                                                                             |-              |              \n\n(*) no deployment needed (system contract)\n\n\u003e [!NOTE]  \n\u003e Due to the nature of ongoing development, future version might break existing functionality\n\n### Faucet\n\n🤖 To request devnet/testnet funds use our [faucet](https://faucet.coti.io)\n\n# COTI v2 Typescript SDK Examples\n\n\u003e [!NOTE]\n\u003e Please refer to the latest [tags](https://github.com/coti-io/coti-sdk-typescript-examples/tags) to find the most stable version to use.\n\nExamples that described above resides in [coti-sdk-typescript/src/examples], the solidity contracts are in the [confidentiality-contracts](https://github.com/coti-io/confidentiality-contracts) repo that is imported as a git submodule.\n\nThe following examples are available for **execution**:\n\n| Contract       | Contract Description                                                                                                                          |\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| AccountOnboard | Onboard a EOA account - During onboard network creates AES unique for that EOA which is used for decrypting values sent back from the network |\n| ERC20Example   | Confidential ERC20 - deploy and transfer encrypted amount of funds                                                                            |\n| DataOnChain    | Basic encryption and decryption - Good place to start explorining network capabilties                                                         |\n\n## Usage\n\n1.  Clone the Typescript examples repo along with its submodules into your desired location\n\n    ```bash\n    git clone --recurse-submodules https://github.com/coti-io/coti-sdk-typescript-examples.git\n    ```\n\n\n2.  Change directory to the newly create one\n\n    ```bash\n    cd coti-sdk-typescript-examples\n    ```\n\n\n3.  Install dependencies\n\n    ```bash\n    yarn\n    ```\n\n\n\u003e [!NOTE]  \n\u003e Ensure your environment meets all the pre-requisites. Visit the [pre-requisites section of the readme](https://github.com/coti-io/coti-sdk-typescript-examples/blob/main/README.md).\n\n### ERC20\n\nThe following process will help you run the [**`erc20.ts`**](https://github.com/coti-io/coti-sdk-typescript-examples/blob/main/src/examples/erc20.ts) example from the [**COTI Typescript SDK Examples**](https://github.com/coti-io/coti-sdk-typescript-examples) project. The script includes functions for transferring tokens, approving allowances, and handling confidential transactions. The script uses various utilities from the SDK to manage confidential accounts, decrypt values, and ensure correct balances and allowances during transactions. It will also:\n\n* Create a EOA (Externally Owned Account)\n* Validate minimum balance\n\n1.  Run `erc20.ts` script\n\n    ```bash\n    yarn erc20\n    ```\n\n    \\\n    Running this test will automatically create an account and a key/value pair with name: `SIGNING_KEY` (visible in the .env file). The script will output something like this:\\\n\n\n    ```bash\n    yarn run v1.22.22\n    $ ts-node src/main.ts erc20\n    ************* Created new account  0x87c13D0f5903a68bE8288E52b23A220CeC6b1aB6  and saved into .env file *************\n    /Users/user/projects/coti-sdk-typescript-examples/src/util/onboard.ts:13\n          throw new Error(`Please use faucet to fund account ${wallet.address}`)\n                ^\n    Error: Please use faucet to fund account 0x87c13D0f5903a68bE8288E52b23A220CeC6b1aB6\n    ```\n\n    \\\n    It is normal to receive the exception `Error: Please use faucet to fund account` on the first run. This will be resolved once the account is funded.  \n\n2. Head to the faucet at [**https://faucet.coti.io**](https://faucet.coti.io) to get devnet funds. \\\n   Send the following message to the BOT using your newly created account, visible in the fourth line of the response `Created new account  0x87c13D0f5903a68bE8288E52b23A220CeC6b1aB6 [...]`\\\n   \\\n   `devnet \u003caccount address\u003e`\\\n   \\\n   The bot will reply with the message:\\\n   \\\n   `\u003cusername\u003e faucet transferred 5 COTIv2 (devnet)` \\\n   \u0026#x20;\n3.  Run `erc20.ts` script once more\n\n    ```bash\n    yarn erc20\n    ```\n\n### Data On Chain\n\nThe following process will help you run the [**`dataOnChain.ts`**](https://github.com/coti-io/coti-sdk-typescript-examples/blob/main/src/examples/dataOnChain.ts) example from the [**COTI Typescript SDK Examples**](https://github.com/coti-io/coti-sdk-typescript-examples) project. The script includes functions for storing values on-chain that are encrypted using using either your user or the network key, and then reading these encrypted values and attempting to decrypt them using either your key or another users key.\n\n1.  Run `dataOnChain.ts` script\n\n    ```bash\n    yarn dataOnChain\n    ```\n\n\n#### Pending enhancements\n\n- Extending examples such as confidential ERC20 minting, confidential NFT (deployment and actions) and more.\n\n#### To report issues, please create a [github issue](https://github.com/coti-io/coti-sdk-typescript/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoti-io%2Fcoti-sdk-typescript-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoti-io%2Fcoti-sdk-typescript-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoti-io%2Fcoti-sdk-typescript-examples/lists"}