Ver Fonte

Add files via upload

n0xy há 1 ano atrás
pai
commit
22201d67a6
2 ficheiros alterados com 45 adições e 0 exclusões
  1. 1 0
      types/index.ts
  2. 44 0
      types/mint.ts

+ 1 - 0
types/index.ts

@@ -0,0 +1 @@
+export * from './mint';

+ 44 - 0
types/mint.ts

@@ -0,0 +1,44 @@
+import { struct, u32, u8 } from '@solana/buffer-layout';
+import { bool, publicKey, u64 } from '@solana/buffer-layout-utils';
+import { Commitment, Connection, PublicKey } from '@solana/web3.js';
+
+/** Information about a mint */
+export interface Mint {
+    /** Address of the mint */
+    address: PublicKey;
+    /**
+     * Optional authority used to mint new tokens. The mint authority may only be provided during mint creation.
+     * If no mint authority is present then the mint has a fixed supply and no further tokens may be minted.
+     */
+    mintAuthority: PublicKey | null;
+    /** Total supply of tokens */
+    supply: bigint;
+    /** Number of base 10 digits to the right of the decimal place */
+    decimals: number;
+    /** Is this mint initialized */
+    isInitialized: boolean;
+    /** Optional authority to freeze token accounts */
+    freezeAuthority: PublicKey | null;
+}
+
+/** Mint as stored by the program */
+export interface RawMint {
+    mintAuthorityOption: 1 | 0;
+    mintAuthority: PublicKey;
+    supply: bigint;
+    decimals: number;
+    isInitialized: boolean;
+    freezeAuthorityOption: 1 | 0;
+    freezeAuthority: PublicKey;
+}
+
+/** Buffer layout for de/serializing a mint */
+export const MintLayout = struct<RawMint>([
+    u32('mintAuthorityOption'),
+    publicKey('mintAuthority'),
+    u64('supply'),
+    u8('decimals'),
+    bool('isInitialized'),
+    u32('freezeAuthorityOption'),
+    publicKey('freezeAuthority'),
+]);