瀏覽代碼

"token" import paths (#264)

* refactor: updated token program imports

* chore: changeset
Nick Frostbutter 2 月之前
父節點
當前提交
9c22897112

+ 6 - 0
.changeset/lazy-tools-smash.md

@@ -0,0 +1,6 @@
+---
+"@gillsdk/react": patch
+"gill": patch
+---
+
+updated token program imports from "gill/programs/token" to "gill/programs"

+ 5 - 5
README.md

@@ -583,7 +583,7 @@ Build a transaction that can create a token with metadata, either using the
 Related instruction builder: `getCreateTokenInstructions`
 
 ```typescript
-import { buildCreateTokenTransaction } from "gill/programs/token";
+import { buildCreateTokenTransaction } from "gill/programs";
 
 const createTokenTx = await buildCreateTokenTransaction({
   feePayer: signer,
@@ -618,7 +618,7 @@ Build a transaction that mints new tokens to the `destination` wallet address (r
 Related instruction builder: `getMintTokensInstructions`
 
 ```typescript
-import { buildMintTokensTransaction } from "gill/programs/token";
+import { buildMintTokensTransaction } from "gill/programs";
 
 const mintTokensTx = await buildMintTokensTransaction({
   feePayer: signer,
@@ -651,7 +651,7 @@ Build a transaction that transfers tokens to the `destination` wallet address fr
 Related instruction builder: `getTransferTokensInstructions`
 
 ```typescript
-import { buildTransferTokensTransaction } from "gill/programs/token";
+import { buildTransferTokensTransaction } from "gill/programs";
 
 const transferTokensTx = await buildTransferTokensTransaction({
   feePayer: signer,
@@ -755,11 +755,11 @@ To import any of these program clients:
 
 ```typescript
 import { ... } from "gill/programs";
-import { ... } from "gill/programs/token";
+import { ... } from "gill/programs";
 ```
 
 > Note: Some client re-exported client program clients have a naming collision. As a result, they may be re-exported
-> under a subpath of `gill/programs`. For example, `gill/programs/token`.
+> under a subpath of `gill/programs`. For example, `gill/programs`.
 
 The program clients included inside `gill` are:
 

+ 4 - 4
e2e/imports/src/imports.js

@@ -54,16 +54,16 @@ getMetadataCodec;
 /**
  * SPL Token 2022 program client
  */
-import { TOKEN_2022_PROGRAM_ADDRESS } from "gill/programs/token";
+import { TOKEN_2022_PROGRAM_ADDRESS } from "gill/programs";
 TOKEN_2022_PROGRAM_ADDRESS;
 
-import { getMintToInstruction } from "gill/programs/token";
+import { getMintToInstruction } from "gill/programs";
 getMintToInstruction;
 
 // !this is a custom symbol that gill provides
-import { getAssociatedTokenAccountAddress } from "gill/programs/token";
+import { getAssociatedTokenAccountAddress } from "gill/programs";
 getAssociatedTokenAccountAddress;
 
 // !this is a custom symbol that gill provides
-import { TOKEN_PROGRAM_ADDRESS } from "gill/programs/token";
+import { TOKEN_PROGRAM_ADDRESS } from "gill/programs";
 TOKEN_PROGRAM_ADDRESS;

+ 5 - 5
e2e/imports/src/imports.ts

@@ -70,21 +70,21 @@ getMetadataCodec;
 /**
  * SPL Token 2022 program client
  */
-import { TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS_token } from "gill/programs/token";
+import { TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS_token } from "gill/programs";
 TOKEN_2022_PROGRAM_ADDRESS_token;
 
-import { getMintToInstruction as getMintToInstruction_token } from "gill/programs/token";
+import { getMintToInstruction as getMintToInstruction_token } from "gill/programs";
 getMintToInstruction_token;
 
-import type { ParsedToken2022Instruction as ParsedToken2022Instruction_token } from "gill/programs/token";
+import type { ParsedToken2022Instruction as ParsedToken2022Instruction_token } from "gill/programs";
 null as unknown as ParsedToken2022Instruction_token;
 
 // !this is a custom symbol that gill provides
-import { getAssociatedTokenAccountAddress as getAssociatedTokenAccountAddress_token } from "gill/programs/token";
+import { getAssociatedTokenAccountAddress as getAssociatedTokenAccountAddress_token } from "gill/programs";
 getAssociatedTokenAccountAddress_token;
 
 // !this is a custom symbol that gill provides
-import { TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS_token } from "gill/programs/token";
+import { TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS_token } from "gill/programs";
 TOKEN_PROGRAM_ADDRESS_token;
 
 /**

+ 5 - 5
examples/get-started/src/tokens.ts

@@ -1,11 +1,11 @@
 import {
-  getExplorerLink,
+  address,
   createSolanaClient,
-  SolanaClusterMoniker,
+  generateKeyPairSigner,
+  getExplorerLink,
   getSignatureFromTransaction,
   signTransactionMessageWithSigners,
-  generateKeyPairSigner,
-  address,
+  SolanaClusterMoniker,
 } from "gill";
 import { loadKeypairSignerFromFile } from "gill/node";
 import {
@@ -14,7 +14,7 @@ import {
   buildTransferTokensTransaction,
   getAssociatedTokenAccountAddress,
   TOKEN_2022_PROGRAM_ADDRESS,
-} from "gill/programs/token";
+} from "gill/programs";
 
 /** Turn on debug mode */
 global.__GILL_DEBUG__ = true;

+ 2 - 5
examples/tokens/src/2.create-token-mint.ts

@@ -11,14 +11,11 @@ import { loadKeypairSignerFromFile } from "gill/node";
 import {
   getCreateAccountInstruction,
   getCreateMetadataAccountV3Instruction,
-  getTokenMetadataAddress,
-} from "gill/programs";
-import {
-  getCreateTokenInstructions,
   getInitializeMintInstruction,
   getMintSize,
+  getTokenMetadataAddress,
   TOKEN_PROGRAM_ADDRESS,
-} from "gill/programs/token";
+} from "gill/programs";
 
 const { rpc, sendAndConfirmTransaction } = createSolanaClient({
   urlOrMoniker: "devnet",

+ 1 - 1
examples/tokens/src/3.create-token-mint-builder.ts

@@ -6,7 +6,7 @@ import {
   signTransactionMessageWithSigners,
 } from "gill";
 import { loadKeypairSignerFromFile } from "gill/node";
-import { buildCreateTokenTransaction, TOKEN_2022_PROGRAM_ADDRESS } from "gill/programs/token";
+import { buildCreateTokenTransaction, TOKEN_2022_PROGRAM_ADDRESS } from "gill/programs";
 
 const { rpc, sendAndConfirmTransaction } = createSolanaClient({
   urlOrMoniker: "devnet",

+ 1 - 1
examples/tokens/src/4.mint-tokens.ts

@@ -12,7 +12,7 @@ import {
   getCreateAssociatedTokenIdempotentInstruction,
   getMintToInstruction,
   TOKEN_PROGRAM_ADDRESS,
-} from "gill/programs/token";
+} from "gill/programs";
 
 const { rpc, sendAndConfirmTransaction } = createSolanaClient({
   urlOrMoniker: "devnet",

+ 1 - 1
examples/tokens/src/5.mint-tokens-builder.ts

@@ -6,7 +6,7 @@ import {
   signTransactionMessageWithSigners,
 } from "gill";
 import { loadKeypairSignerFromFile } from "gill/node";
-import { buildMintTokensTransaction } from "gill/programs/token";
+import { buildMintTokensTransaction } from "gill/programs";
 
 const { rpc, sendAndConfirmTransaction } = createSolanaClient({
   urlOrMoniker: "devnet",

+ 1 - 1
examples/tokens/src/6.transfer-tokens.ts

@@ -12,7 +12,7 @@ import {
   getCreateAssociatedTokenIdempotentInstruction,
   getTransferInstruction,
   TOKEN_PROGRAM_ADDRESS,
-} from "gill/programs/token";
+} from "gill/programs";
 
 const signer = await loadKeypairSignerFromFile();
 

+ 1 - 1
examples/tokens/src/7.transfer-tokens-builder.ts

@@ -6,7 +6,7 @@ import {
   signTransactionMessageWithSigners,
 } from "gill";
 import { loadKeypairSignerFromFile } from "gill/node";
-import { buildTransferTokensTransaction, TOKEN_PROGRAM_ADDRESS } from "gill/programs/token";
+import { buildTransferTokensTransaction, TOKEN_PROGRAM_ADDRESS } from "gill/programs";
 
 const { rpc, sendAndConfirmTransaction } = createSolanaClient({
   urlOrMoniker: "devnet",

+ 5 - 5
packages/gill/README.md

@@ -583,7 +583,7 @@ Build a transaction that can create a token with metadata, either using the
 Related instruction builder: `getCreateTokenInstructions`
 
 ```typescript
-import { buildCreateTokenTransaction } from "gill/programs/token";
+import { buildCreateTokenTransaction } from "gill/programs";
 
 const createTokenTx = await buildCreateTokenTransaction({
   feePayer: signer,
@@ -618,7 +618,7 @@ Build a transaction that mints new tokens to the `destination` wallet address (r
 Related instruction builder: `getMintTokensInstructions`
 
 ```typescript
-import { buildMintTokensTransaction } from "gill/programs/token";
+import { buildMintTokensTransaction } from "gill/programs";
 
 const mintTokensTx = await buildMintTokensTransaction({
   feePayer: signer,
@@ -651,7 +651,7 @@ Build a transaction that transfers tokens to the `destination` wallet address fr
 Related instruction builder: `getTransferTokensInstructions`
 
 ```typescript
-import { buildTransferTokensTransaction } from "gill/programs/token";
+import { buildTransferTokensTransaction } from "gill/programs";
 
 const transferTokensTx = await buildTransferTokensTransaction({
   feePayer: signer,
@@ -755,11 +755,11 @@ To import any of these program clients:
 
 ```typescript
 import { ... } from "gill/programs";
-import { ... } from "gill/programs/token";
+import { ... } from "gill/programs";
 ```
 
 > Note: Some client re-exported client program clients have a naming collision. As a result, they may be re-exported
-> under a subpath of `gill/programs`. For example, `gill/programs/token`.
+> under a subpath of `gill/programs`. For example, `gill/programs`.
 
 The program clients included inside `gill` are:
 

+ 1 - 1
packages/react/src/__typeset__/token-account.ts

@@ -1,7 +1,7 @@
 import { Account, Address } from "gill";
 
+import { Token } from "gill/programs";
 import { useTokenAccount } from "../hooks/token-account";
-import { Token } from "gill/programs/token";
 
 // [DESCRIBE] useTokenAccount
 {

+ 1 - 1
packages/react/src/__typeset__/token-mint.ts

@@ -1,6 +1,6 @@
 import type { Account, Address } from "gill";
 
-import type { Mint } from "gill/programs/token";
+import type { Mint } from "gill/programs";
 import { useTokenMint } from "../hooks";
 
 // [DESCRIBE] useTokenMint

+ 1 - 1
packages/react/src/hooks/token-account.ts

@@ -13,7 +13,7 @@ import {
   fetchMint,
   getAssociatedTokenAccountAddress,
   type Token,
-} from "gill/programs/token";
+} from "gill/programs";
 
 type RpcConfig = Simplify<Omit<FetchAccountConfig, "abortSignal">>;
 

+ 1 - 1
packages/react/src/hooks/token-mint.ts

@@ -7,7 +7,7 @@ import type { GillUseRpcHook } from "./types";
 
 import type { Account, Address, FetchAccountConfig, Simplify } from "gill";
 import { assertAccountExists, fetchEncodedAccount } from "gill";
-import { decodeMint, type Mint } from "gill/programs/token";
+import { decodeMint, type Mint } from "gill/programs";
 
 type RpcConfig = Simplify<Omit<FetchAccountConfig, "abortSignal">>;