{"id":30702969,"url":"https://github.com/gillsdk/gill","last_synced_at":"2025-09-02T16:03:33.133Z","repository":{"id":263640321,"uuid":"891042787","full_name":"gillsdk/gill","owner":"gillsdk","description":"Solana JavaScript/TypeScript SDK - client library for interacting with the Solana blockchain","archived":false,"fork":false,"pushed_at":"2025-08-29T15:39:58.000Z","size":1234,"stargazers_count":315,"open_issues_count":38,"forks_count":54,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-29T16:18:29.907Z","etag":null,"topics":["blockchain","codama","gill","gillsdk","nft","solana","solana-helper","solana-program","solana-program-library","spl","tokens","web3","web3js"],"latest_commit_sha":null,"homepage":"https://gillsdk.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gillsdk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2024-11-19T16:17:14.000Z","updated_at":"2025-08-29T15:16:16.000Z","dependencies_parsed_at":"2024-12-09T18:19:30.621Z","dependency_job_id":"8d766108-9e4b-45b1-879d-75c56ea7fd68","html_url":"https://github.com/gillsdk/gill","commit_stats":null,"previous_names":["nickfrosty/gill","solana-foundation/gill","decallabs/gill"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gillsdk/gill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillsdk%2Fgill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillsdk%2Fgill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillsdk%2Fgill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillsdk%2Fgill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gillsdk","download_url":"https://codeload.github.com/gillsdk/gill/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillsdk%2Fgill/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273309572,"owners_count":25082545,"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","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["blockchain","codama","gill","gillsdk","nft","solana","solana-helper","solana-program","solana-program-library","spl","tokens","web3","web3js"],"created_at":"2025-09-02T16:02:07.774Z","updated_at":"2025-09-02T16:03:33.113Z","avatar_url":"https://github.com/gillsdk.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003e\n  gill\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  javascript/typescript client library for interacting with the Solana blockchain\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/gillsdk/gill/actions/workflows/publish-packages.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/gillsdk/gill/publish-packages.yml?logo=GitHub\u0026label=tests\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/gill\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/gill?logo=npm\u0026color=377CC0\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/gill\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/gill?color=377CC0\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"600\" alt=\"gill\" src=\"https://raw.githubusercontent.com/gillsdk/gill/refs/heads/master/docs/public/cover.png\" /\u003e\n\u003c/p\u003e\n\n## Overview\n\nWelcome to `gill`, a JavaScript/TypeScript client library for interacting with the [Solana](http://solana.com/)\nblockchain. You can use it to build Solana apps in Node, web, React Native, or just about any other JavaScript\nenvironment.\n\nGill is built on top of the modern javascript libraries for Solana built by Anza called\n[@solana/kit](https://github.com/anza-xyz/kit) (formerly known as \"web3.js v2\"). By utilizing the same types and\nfunctions under the hood, `gill` is compatible with `kit`. See [Replacing Kit with gill](#replace-kit-with-gill).\n\n\u003e For a comparison of using gill vs `@solana/kit`, take a look at the\n\u003e [gill vs @solana/kit comparison docs](https://gillsdk.com/docs/compare/kit) and the\n\u003e [comparison examples](https://github.com/gillsdk/gill/tree/master/examples/get-started#comparison-of-gill-vs-solanakit-aka-web3js-v2).\n\n## Documentation\n\nYou can find the gill library docs here:\n\n- [gill docs site](https://gillsdk.com)\n- [gill setup guide](https://gillsdk.com/docs#quick-start)\n- [gill API references](https://gillsdk.com/api)\n\n## Installation\n\nInstall `gill` with your package manager of choice:\n\n```shell\nnpm install gill\n```\n\n```shell\npnpm add gill\n```\n\n```shell\nyarn add gill\n```\n\n### Replace Kit with gill\n\nAll imports from the `@solana/kit` library can be directly replaces with `gill` to achieve the exact same functionality.\nPlus unlock the additional functionality only included in Gill, like `createSolanaTransaction`.\n\nSimply [install gill](#installation) and replace your imports\n\n## Quick start\n\n\u003e Find a collection of example code snippets using `gill` inside the\n\u003e [`/examples` directory](https://github.com/gillsdk/gill/tree/master/examples), including\n\u003e [basic operations](https://github.com/gillsdk/gill/tree/master/examples/get-started) and common\n\u003e [token operations](https://github.com/gillsdk/gill/tree/master/examples/tokens).\n\n- [Create a Solana RPC connection](#create-a-solana-rpc-connection)\n- [Making Solana RPC calls](#making-solana-rpc-calls)\n- [Create a transaction](#create-a-transaction)\n- [Signing transactions](#signing-transactions)\n- [Simulating transactions](#simulating-transactions)\n- [Sending and confirming transaction](#sending-and-confirming-transactions)\n- [Get a transaction signature](#get-the-signature-from-a-signed-transaction)\n- [Get a Solana Explorer link](#get-a-solana-explorer-link-for-transactions-accounts-or-blocks)\n- [Calculate minimum rent balance for an account](#calculate-minimum-rent-for-an-account)\n- [Generating keypairs and signers](#generating-keypairs-and-signers)\n- [Generating extractable keypairs and signers](#generating-extractable-keypairs-and-signers)\n\nYou can also find some [NodeJS specific helpers](#node-specific-imports) like:\n\n- [Loading a keypair from a file](#loading-a-keypair-from-a-file)\n- [Saving a keypair to a file](#saving-a-keypair-to-a-file)\n- [Loading a keypair from an environment variable](#loading-a-keypair-from-an-environment-variable)\n- [Saving a keypair to an environment variable file](#saving-a-keypair-to-an-environment-file)\n- [Loading a base58 keypair from an environment variable](#loading-a-base58-keypair-from-an-environment-variable)\n\nYou can find [transaction builders](#transaction-builders) for common tasks, including:\n\n- [Creating a token with metadata](#create-a-token-with-metadata)\n- [Minting tokens to a destination wallet](#mint-tokens-to-a-destination-wallet)\n- [Transfer tokens to a destination wallet](#transfer-tokens-to-a-destination-wallet)\n\nFor troubleshooting and debugging your Solana transactions, see [Debug mode](#debug-mode) below and the gill docs for\n[Debug Mode](https://gillsdk.com/docs/debug-mode).\n\n\u003e You can also consult the documentation for Anza's [JavaScript client](https://github.com/anza-xyz/solana-web3.js)\n\u003e library for more information and helpful resources.\n\n### Generating keypairs and signers\n\nSee also: the docs on\n[Generating a keypair signer](https://gillsdk.com/docs/getting-started/signers#generating-a-keypair-signer).\n\nFor most \"signing\" operations, you will need a `KeyPairSigner` instance, which can be used to sign transactions and\nmessages.\n\nTo generate a random `KeyPairSigner`:\n\n```typescript\nimport { generateKeyPairSigner } from \"gill\";\n\nconst signer: KeyPairSigner = await generateKeyPairSigner();\n```\n\n\u003e Note: These Signers are non-extractable, meaning there is no way to get the secret key material out of the instance.\n\u003e This is a more secure practice and highly recommended to be used over extractable keypairs, unless you REALLY need to\n\u003e be able to save the keypair for some reason.\n\n### Generating extractable keypairs and signers\n\nSee also: the docs on\n[Generating extractable keypairs and signers](https://gillsdk.com/docs/getting-started/signers#generating-extractable-keypairs-and-signers).\n\nExtractable keypairs are less secure and should not be used unless you REALLY need to save the key for some reason.\nSince there are a few useful cases for saving these keypairs, gill contains a separate explicit function to generate\nthese extractable keypairs.\n\nTo generate a random, **extractable** `KeyPairSigner`:\n\n```typescript\nimport { generateExtractableKeyPairSigner } from \"gill\";\n\nconst signer: KeyPairSigner = await generateExtractableKeyPairSigner();\n```\n\n\u003e WARNING: Using **extractable** keypairs are inherently less-secure, since they allow the secret key material to be\n\u003e extracted. Obviously. As such, they should only be used sparingly and ONLY when you have an explicit reason you need\n\u003e extract the key material (like if you are going to save the key to a file).\n\n### Create a Solana RPC connection\n\nSee also: the docs on [how to create a Solana client](https://gillsdk.com/docs/getting-started/client)\n\nCreate a Solana `rpc` and `rpcSubscriptions` client for any RPC URL or standard Solana network moniker (i.e. `devnet`,\n`localnet`, `mainnet` etc).\n\n```typescript\nimport { createSolanaClient } from \"gill\";\n\nconst { rpc, rpcSubscriptions, sendAndConfirmTransaction } = createSolanaClient({\n  urlOrMoniker: \"mainnet\",\n});\n```\n\n\u003e Using the Solana moniker will connect to the public RPC endpoints. These are subject to rate limits and should not be\n\u003e used in production applications. Applications should find their own RPC provider and the URL provided from them.\n\nTo create an RPC client for your local test validator:\n\n```typescript\nimport { createSolanaClient } from \"gill\";\n\nconst { rpc, rpcSubscriptions, sendAndConfirmTransaction } = createSolanaClient({\n  urlOrMoniker: \"localnet\",\n});\n```\n\nTo create an RPC client for an custom RPC provider or service:\n\n```typescript\nimport { createSolanaClient } from \"gill\";\n\nconst { rpc, rpcSubscriptions, sendAndConfirmTransaction } = createSolanaClient({\n  urlOrMoniker: \"https://private-solana-rpc-provider.com\",\n});\n```\n\n### Making Solana RPC calls\n\nAfter you have a Solana `rpc` connection, you can make all the [JSON RPC method](https://solana.com/docs/rpc) calls\ndirectly off of it.\n\n```typescript\nimport { createSolanaClient } from \"gill\";\n\nconst { rpc } = createSolanaClient({ urlOrMoniker: \"devnet\" });\n\n// get slot\nconst slot = await rpc.getSlot().send();\n\n// get the latest blockhash\nconst { value: latestBlockhash } = await rpc.getLatestBlockhash().send();\n```\n\n\u003e The `rpc` client requires you to call `.send()` on the RPC method in order to actually send the request to your RPC\n\u003e provider and get a response.\n\nYou can also include custom configuration settings on your RPC calls, like using a JavaScript\n[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController), by passing it into `send()`:\n\n```typescript\nimport { createSolanaClient } from \"gill\";\n\nconst { rpc } = createSolanaClient({ urlOrMoniker: \"devnet\" });\n\n// Create a new AbortController.\nconst abortController = new AbortController();\n\n// Abort the request when the user navigates away from the current page.\nfunction onUserNavigateAway() {\n  abortController.abort();\n}\n\n// The request will be aborted if and only if the user navigates away from the page.\nconst slot = await rpc.getSlot().send({ abortSignal: abortController.signal });\n```\n\n### Create a transaction\n\nQuickly create a Solana transaction:\n\n\u003e Note: The `feePayer` can be either an `Address` or `TransactionSigner`.\n\n```typescript\nimport { createTransaction } from \"gill\";\n\nconst transaction = createTransaction({\n  version,\n  feePayer,\n  instructions,\n  // the compute budget values are HIGHLY recommend to be set in order to maximize your transaction landing rate\n  // computeUnitLimit: number,\n  // computeUnitPrice: number,\n});\n```\n\nTo create a transaction while setting the latest blockhash:\n\n```typescript\nimport { createTransaction } from \"gill\";\n\nconst { value: latestBlockhash } = await rpc.getLatestBlockhash().send();\n\nconst transaction = createTransaction({\n  version,\n  feePayer,\n  instructions,\n  latestBlockhash,\n  // the compute budget values are HIGHLY recommend to be set in order to maximize your transaction landing rate\n  // computeUnitLimit: number,\n  // computeUnitPrice: number,\n});\n```\n\n### Signing transactions\n\nIf your transaction already has the latest blockhash lifetime set via `createTransaction`:\n\n```typescript\nimport { createTransaction, signTransactionMessageWithSigners } from \"gill\";\n\nconst transaction = createTransaction(...);\n\nconst signedTransaction = await signTransactionMessageWithSigners(transaction);\n```\n\nIf your transaction does NOT have the latest blockhash lifetime set via `createTransaction`, you must set the latest\nblockhash lifetime before (or during) the signing operation:\n\n```typescript\nimport {\n  createTransaction,\n  createSolanaClient,\n  signTransactionMessageWithSigners,\n  setTransactionMessageLifetimeUsingBlockhash,\n} from \"gill\";\n\nconst { rpc } = createSolanaClient(...);\nconst transaction = createTransaction(...);\n\nconst { value: latestBlockhash } = await rpc.getLatestBlockhash().send();\n\nconst signedTransaction = await signTransactionMessageWithSigners(\n  setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, transaction),\n);\n```\n\n### Simulating transactions\n\nTo simulate a transaction on the blockchain, you can use the `simulateTransaction()` function initialized from\n`createSolanaClient()`.\n\n```typescript\nimport { ... } from \"gill\";\n\nconst { simulateTransaction } = createSolanaClient({\n  urlOrMoniker: \"mainnet\",\n});\n\nconst transaction = createTransaction(...);\n\nconst simulation = await simulateTransaction(transaction)\n```\n\nThe transaction provided to `simulateTransaction()` can either be signed or not.\n\n### Sending and confirming transactions\n\nTo send and confirm a transaction to the blockchain, you can use the `sendAndConfirmTransaction` function initialized\nfrom `createSolanaClient()`.\n\n```typescript\nimport { ... } from \"gill\";\n\nconst { sendAndConfirmTransaction } = createSolanaClient({\n  urlOrMoniker: \"mainnet\",\n});\n\nconst transaction = createTransaction(...);\n\nconst signedTransaction = await signTransactionMessageWithSigners(transaction);\nconst signature: string = getSignatureFromTransaction(signedTransaction);\n\nconsole.log(getExplorerLink({ transaction: signature }));\n\n// default commitment level of `confirmed`\nawait sendAndConfirmTransaction(signedTransaction)\n```\n\nIf you would like more fine grain control over the configuration of the `sendAndConfirmTransaction` functionality, you\ncan include configuration settings:\n\n```typescript\nawait sendAndConfirmTransaction(signedTransaction, {\n  commitment: \"confirmed\",\n  skipPreflight: true,\n  maxRetries: 10n,\n  ...\n});\n```\n\n### Get the signature from a signed transaction\n\nAfter you have a transaction signed by the `feePayer` (either a partially or fully signed transaction), you can get the\ntransaction signature as follows:\n\n```typescript\nimport { getSignatureFromTransaction } from \"gill\";\n\nconst signature: string = getSignatureFromTransaction(signedTransaction);\nconsole.log(signature);\n// Example output: 4nzNU7YxPtPsVzeg16oaZvLz4jMPtbAzavDfEFmemHNv93iYXKKYAaqBJzFCwEVxiULqTYYrbjPwQnA1d9ZCTELg\n```\n\n\u003e Note: After a transaction has been signed by the fee payer, it will have a transaction signature (aka transaction id).\n\u003e This is due to Solana transaction ids are the first item in the transaction's `signatures` array. Therefore, client\n\u003e applications can potentially know the signature before it is even sent to the network for confirmation.\n\n### Get a Solana Explorer link for transactions, accounts, or blocks\n\nCraft a Solana Explorer link for transactions, accounts, or blocks on any cluster.\n\n\u003e When no `cluster` is provided in the `getExplorerLink` function, it defaults to `mainnet`.\n\n#### Get a Solana Explorer link for a transaction\n\nTo get an explorer link for a transaction's signature (aka transaction id):\n\n```typescript\nimport { getExplorerLink } from \"gill\";\n\nconst link: string = getExplorerLink({\n  transaction: \"4nzNU7YxPtPsVzeg16oaZvLz4jMPtbAzavDfEFmemHNv93iYXKKYAaqBJzFCwEVxiULqTYYrbjPwQnA1d9ZCTELg\",\n});\n```\n\nIf you have a partially or fully signed transaction, you can get the Explorer link before even sending the transaction\nto the network:\n\n```typescript\nimport {\n  getExplorerLink,\n  getSignatureFromTransaction\n  signTransactionMessageWithSigners,\n} from \"gill\";\n\nconst signedTransaction = await signTransactionMessageWithSigners(...);\nconst link: string = getExplorerLink({\n  transaction: getSignatureFromTransaction(signedTransaction),\n});\n```\n\n#### Get a Solana Explorer link for an account\n\nTo get an explorer link for an account on Solana's devnet:\n\n```typescript\nimport { getExplorerLink } from \"gill\";\n\nconst link: string = getExplorerLink({\n  cluster: \"devnet\",\n  account: \"nick6zJc6HpW3kfBm4xS2dmbuVRyb5F3AnUvj5ymzR5\",\n});\n```\n\nTo get an explorer link for an account on your local test validator:\n\n```typescript\nimport { getExplorerLink } from \"gill\";\n\nconst link: string = getExplorerLink({\n  cluster: \"localnet\",\n  account: \"11111111111111111111111111111111\",\n});\n```\n\n#### Get a Solana Explorer link for a block\n\nTo get an explorer link for a block:\n\n```typescript\nimport { getExplorerLink } from \"gill\";\n\nconst link: string = getExplorerLink({\n  cluster: \"mainnet\",\n  block: \"242233124\",\n});\n```\n\n### Calculate minimum rent for an account\n\nTo calculate the minimum rent balance for an account (aka data storage deposit fee):\n\n```typescript\nimport { getMinimumBalanceForRentExemption } from \"gill\";\n\n// when not `space` argument is provided: defaults to `0`\nconst rent: bigint = getMinimumBalanceForRentExemption();\n// Expected value: 890_880n\n\n// same as\n// getMinimumBalanceForRentExemption(0);\n\n// same as, but this requires a network call\n// const rent = await rpc.getMinimumBalanceForRentExemption(0n).send();\n```\n\n```typescript\nimport { getMinimumBalanceForRentExemption } from \"gill\";\n\nconst rent: bigint = getMinimumBalanceForRentExemption(50 /* 50 bytes */);\n// Expected value: 1_238_880n\n\n// same as, but this requires a network call\n// const rent = await rpc.getMinimumBalanceForRentExemption(50n).send();\n```\n\n\u003e Note: At this time, the minimum rent amount for an account is calculated based on static values in the Solana runtime.\n\u003e While you can use the `getMinimumBalanceForRentExemption` RPC call on your\n\u003e [connection](#create-a-solana-rpc-connection) to fetch this value, it will result in a network call and subject to\n\u003e latency.\n\n## Node specific imports\n\nThe `gill` package has specific imports for use in NodeJS server backends and/or serverless environments which have\naccess to Node specific APIs (like the file system via `node:fs`).\n\n```typescript\nimport { ... } from \"gill/node\"\n```\n\n### Loading a keypair from a file\n\n```typescript\nimport { loadKeypairSignerFromFile } from \"gill/node\";\n\n// default file path: ~/.config/solana/id.json\nconst signer = await loadKeypairSignerFromFile();\nconsole.log(\"address:\", signer.address);\n```\n\nLoad a `KeyPairSigner` from a filesystem wallet json file, like those output from the\n[Solana CLI](https://solana.com/docs/intro/installation#install-the-solana-cli) (i.e. a JSON array of numbers).\n\nBy default, the keypair file loaded is the Solana CLI's default keypair: `~/.config/solana/id.json`\n\nTo load a Signer from a specific filepath:\n\n```typescript\nimport { loadKeypairSignerFromFile } from \"gill/node\";\n\nconst signer = await loadKeypairSignerFromFile(\"/path/to/your/keypair.json\");\nconsole.log(\"address:\", signer.address);\n```\n\n### Saving a keypair to a file\n\n\u003e See [`saveKeypairSignerToEnvFile`](#saving-a-keypair-to-an-environment-file) for saving to an env file.\n\nSave an **extractable** `KeyPairSigner` to a local json file (e.g. `keypair.json`).\n\n```typescript\nimport { ... } from \"gill/node\";\nconst extractableSigner = generateExtractableKeyPairSigner();\nawait saveKeypairSignerToFile(extractableSigner, filePath);\n```\n\nSee [`loadKeypairSignerFromFile`](#loading-a-keypair-from-a-file) for how to load keypairs from the local filesystem.\n\n### Loading a keypair from an environment variable\n\nLoad a `KeyPairSigner` from the bytes stored in the environment process (e.g. `process.env[variableName]`)\n\n```typescript\nimport { loadKeypairSignerFromEnvironment } from \"gill/node\";\n\n// loads signer from bytes stored at `process.env[variableName]`\nconst signer = await loadKeypairSignerFromEnvironment(variableName);\nconsole.log(\"address:\", signer.address);\n```\n\n### Saving a keypair to an environment file\n\nSave an **extractable** `KeyPairSigner` to a local environment variable file (e.g. `.env`).\n\n```typescript\nimport { ... } from \"gill/node\";\nconst extractableSigner = generateExtractableKeyPairSigner();\n// default: envPath = `.env` (in your current working directory)\nawait saveKeypairSignerToEnvFile(extractableSigner, variableName, envPath);\n```\n\nSee [`loadKeypairSignerFromEnvironment`](#loading-a-keypair-from-an-environment-variable) for how to load keypairs from\nenvironment variables.\n\n### Loading a base58 keypair from an environment variable\n\nLoad a `KeyPairSigner` from the bytes stored in the environment process (e.g. `process.env[variableName]`)\n\n```typescript\nimport { loadKeypairSignerFromEnvironmentBase58 } from \"gill/node\";\n\n// loads signer from base58 keypair stored at `process.env[variableName]`\nconst signer = await loadKeypairSignerFromEnvironmentBase58(variableName);\nconsole.log(\"address:\", signer.address);\n```\n\n## Transaction builders\n\nTo simplify the creation of common transactions, gill includes various \"transaction builders\" to help easily assemble\nready-to-sign transactions for these tasks, which often interact with multiple programs at once.\n\nSince each transaction builder is scoped to a single task, they can easily abstract away various pieces of boilerplate\nwhile also helping to create an optimized transaction, including:\n\n- sets/recommends a default compute unit limit (easily overridable of course) to optimize the transaction and improve\n  landing rates\n- auto derive required address where needed\n- generally recommend safe defaults and fallback settings\n\nAll of the auto-filled information can also be manually overriden to ensure you always have escape hatches to achieve\nyour desired functionality.\n\nAs these transaction builders may not be for everyone, gill exposes a related \"instruction builder\" function for each\nwhich is used under the hood to craft the respective transactions. Developers can also completely forgo these builder\nabstractions and manually craft the same functionality.\n\n### Create a token with metadata\n\nBuild a transaction that can create a token with metadata, either using the\n[original token](https://github.com/solana-program/token) or\n[token extensions (token22)](https://github.com/solana-program/token-2022) program.\n\n- Tokens created with the original token program (`TOKEN_PROGRAM_ADDRESS`, default) will use Metaplex's Token Metadata\n  program for onchain metadata\n- Tokens created with the token extensions program (`TOKEN_2022_PROGRAM_ADDRESS`) will use the metadata pointer\n  extensions\n\nRelated instruction builder: `getCreateTokenInstructions`\n\n```typescript\nimport { buildCreateTokenTransaction } from \"gill/programs/token\";\n\nconst createTokenTx = await buildCreateTokenTransaction({\n  feePayer: signer,\n  latestBlockhash,\n  mint,\n  // mintAuthority, // default=same as the `feePayer`\n  metadata: {\n    isMutable: true, // if the `updateAuthority` can change this metadata in the future\n    name: \"Only Possible On Solana\",\n    symbol: \"OPOS\",\n    uri: \"https://raw.githubusercontent.com/solana-developers/opos-asset/main/assets/Climate/metadata.json\",\n  },\n  // updateAuthority, // default=same as the `feePayer`\n  decimals: 2, // default=9,\n  tokenProgram, // default=TOKEN_PROGRAM_ADDRESS, token22 also supported\n  // default cu limit set to be optimized, but can be overriden here\n  // computeUnitLimit?: number,\n  // obtain from your favorite priority fee api\n  // computeUnitPrice?: number, // no default set\n});\n```\n\n### Mint tokens to a destination wallet\n\nBuild a transaction that mints new tokens to the `destination` wallet address (raising the token's overall supply).\n\n- ensure you set the correct `tokenProgram` used by the `mint` itself\n- if the `destination` owner does not have an associated token account (ata) created for the `mint`, one will be\n  auto-created for them\n- ensure you take into account the `decimals` for the `mint` when setting the `amount` in this transaction\n\nRelated instruction builder: `getMintTokensInstructions`\n\n```typescript\nimport { buildMintTokensTransaction } from \"gill/programs/token\";\n\nconst mintTokensTx = await buildMintTokensTransaction({\n  feePayer: signer,\n  latestBlockhash,\n  mint,\n  mintAuthority: signer,\n  amount: 1000, // note: be sure to consider the mint's `decimals` value\n  // if decimals=2 =\u003e this will mint 10.00 tokens\n  // if decimals=4 =\u003e this will mint 0.100 tokens\n  destination,\n  // use the correct token program for the `mint`\n  tokenProgram, // default=TOKEN_PROGRAM_ADDRESS\n  // default cu limit set to be optimized, but can be overriden here\n  // computeUnitLimit?: number,\n  // obtain from your favorite priority fee api\n  // computeUnitPrice?: number, // no default set\n});\n```\n\n### Transfer tokens to a destination wallet\n\nBuild a transaction that transfers tokens to the `destination` wallet address from the `source` (aka from `sourceAta` to\n`destinationAta`).\n\n- ensure you set the correct `tokenProgram` used by the `mint` itself\n- if the `destination` owner does not have an associated token account (ata) created for the `mint`, one will be\n  auto-created for them\n- ensure you take into account the `decimals` for the `mint` when setting the `amount` in this transaction\n\nRelated instruction builder: `getTransferTokensInstructions`\n\n```typescript\nimport { buildTransferTokensTransaction } from \"gill/programs/token\";\n\nconst transferTokensTx = await buildTransferTokensTransaction({\n  feePayer: signer,\n  latestBlockhash,\n  mint,\n  authority: signer,\n  // sourceAta, // default=derived from the `authority`.\n  /**\n   * if the `sourceAta` is not derived from the `authority` (like for multi-sig wallets),\n   * manually derive with `getAssociatedTokenAccountAddress()`\n  */\n  amount: 900, // note: be sure to consider the mint's `decimals` value\n  // if decimals=2 =\u003e this will transfer 9.00 tokens\n  // if decimals=4 =\u003e this will transfer 0.090 tokens\n  destination: address(...),\n  // use the correct token program for the `mint`\n  tokenProgram, // default=TOKEN_PROGRAM_ADDRESS\n  // default cu limit set to be optimized, but can be overriden here\n  // computeUnitLimit?: number,\n  // obtain from your favorite priority fee api\n  // computeUnitPrice?: number, // no default set\n});\n```\n\n## Debug mode\n\nSee also: the docs for [Debug Mode](https://gillsdk.com/docs/debug-mode)\n\nWithin `gill`, you can enable \"debug mode\" to automatically log additional information that will be helpful in\ntroubleshooting your transactions.\n\nDebug mode is disabled by default to minimize additional logs for your application. But with its flexible debug\ncontroller, you can enable it from the most common places your code will be run. Including your code itself, NodeJS\nbackends, serverless functions, and even the in web browser console itself.\n\nSome examples of the existing debug logs that `gill` has sprinkled in:\n\n- log the Solana Explorer link for transactions as you are sending them\n- log the base64 transaction string to troubleshoot via\n  [`mucho inspect`](https://github.com/solana-developers/mucho?tab=readme-ov-file#inspect) or Solana Explorer's\n  [Transaction Inspector](https://explorer.solana.com/tx/inspector)\n\n### How to enable debug mode\n\nTo enable debug mode, set any of the following to `true` or `1`:\n\n- `process.env.GILL_DEBUG`\n- `global.__GILL_DEBUG__`\n- `window.__GILL_DEBUG__` (i.e. in your web browser's console)\n- or manually set any debug log level (see below)\n\nTo set a desired level of logs to be output in your application, set the value of one of the following (default:\n`info`):\n\n- `process.env.GILL_DEBUG_LEVEL`\n- `global.__GILL_DEBUG_LEVEL__`\n- `window.__GILL_DEBUG_LEVEL__` (i.e. in your web browser's console)\n\nThe log levels supported (in order of priority):\n\n- `debug` (lowest)\n- `info` (default)\n- `warn`\n- `error`\n\n### Custom debug logs\n\nGill also exports the same debug functions it uses internally, allowing you to implement your own debug logic related to\nyour Solana transactions and use the same controller for it as `gill` does.\n\n- `isDebugEnabled()` - check if debug mode is enabled or not\n- `debug()` - print debug message if the set log level is reached\n\n```typescript\nimport { debug, isDebugEnabled } from \"gill\";\n\nif (isDebugEnabled()) {\n  // your custom logic\n}\n\n// log this message if the \"info\" or above log level is enabled\ndebug(\"custom message\");\n\n// log this message if the \"debug\" or above log level is enabled\ndebug(\"custom message\", \"debug\");\n\n// log this message if the \"warn\" or above log level is enabled\ndebug(\"custom message\", \"warn\");\n\n// log this message if the \"warn\" or above log level is enabled\ndebug(\"custom message\", \"warn\");\n```\n\n## Program clients\n\nWith `gill` you can also import some of the most commonly used clients for popular programs. These are also fully\ntree-shakable, so if you do not import them inside your project they will be removed by your JavaScript bundler at build\ntime (i.e. Webpack).\n\nTo import any of these program clients:\n\n```typescript\nimport { ... } from \"gill/programs\";\nimport { ... } from \"gill/programs/token\";\n```\n\n\u003e Note: Some client re-exported client program clients have a naming collision. As a result, they may be re-exported\n\u003e under a subpath of `gill/programs`. For example, `gill/programs/token`.\n\nThe program clients included inside `gill` are:\n\n- System program - re-exported from [`@solana-program/system`](https://github.com/solana-program/system)\n- Compute Budget program- re-exported from\n  [`@solana-program/compute-budget`](https://github.com/solana-program/compute-budget)\n- Memo program - re-exported from [`@solana-program/memo`](https://github.com/solana-program/memo)\n- Token Program and Token Extensions program (aka Token22) - re-exported from\n  [`@solana-program/token-2022`](https://github.com/solana-program/token-2022), which is a fully backwards compatible\n  client with the original Token Program\n- Address Lookup Table program - re-exported from\n  [`@solana-program/address-lookup-table`](https://github.com/solana-program/address-lookup-table)\n- Token Metadata program from Metaplex (only the v3 functionality) - generated via Codama their IDL\n  ([source](https://github.com/metaplex-foundation/mpl-token-metadata))\n\nIf one of the existing clients are not being exported from `gill/programs` or a subpath therein, you can of course\nmanually add their compatible client to your repo.\n\n\u003e Note: Since the Token Extensions program client is fully compatible with the original Token Program client, `gill`\n\u003e only ships the `@solana-program/token-2022` client and the `TOKEN_PROGRAM_ADDRESS` in order to remove all that\n\u003e redundant code from the library.\n\u003e\n\u003e To use the original Token Program, simply pass the `TOKEN_PROGRAM_ADDRESS` as the the program address for any\n\u003e instructions\n\n### Other compatible program clients\n\nFrom the [solana-program](https://github.com/solana-program/token) GitHub organization, formerly known as the Solana\nProgram Library (SPL), you can find various other client libraries for specific programs. Install their respective\npackage to use in conjunction with gill:\n\n- [Stake program](https://github.com/solana-program/stake) - `@solana-program/stake`\n- [Vote program](https://github.com/solana-program/vote) - `@solana-program/vote`\n\n### Generate a program client from an IDL\n\nSee also: this official gill docs and guide on\n[how to generate a program client with codama](https://gillsdk.com/docs/guides/codama)\n\nIf you want to easily interact with any custom program with this library, you can use\n[Codama](https://github.com/codama-idl/codama) to generate a compatible JavaScript/TypeScript client using its IDL. You\ncan either store the generated client inside your repo or publish it as a NPM package for others to easily consume.\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgillsdk%2Fgill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgillsdk%2Fgill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgillsdk%2Fgill/lists"}