Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 5229a21

Browse files
authored
token-js: Update instruction enum for UiAmountToAmount / AmountToUiAmount (#2949)
* token-js: Unflake create native test * Add UiAmountToAmount and AmountToUiAmount to enum
1 parent 7f3cad3 commit 5229a21

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

token/js/src/instructions/types.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ export enum TokenInstruction {
2323
InitializeMint2 = 20,
2424
GetAccountDataSize = 21,
2525
InitializeImmutableOwner = 22,
26-
InitializeMintCloseAuthority = 23,
27-
TransferFeeExtension = 24,
28-
ConfidentialTransferExtension = 25,
29-
DefaultAccountStateExtension = 26,
30-
Reallocate = 27,
31-
MemoTransferExtension = 28,
32-
CreateNativeMint = 29,
26+
AmountToUiAmount = 23,
27+
UiAmountToAmount = 24,
28+
InitializeMintCloseAuthority = 25,
29+
TransferFeeExtension = 26,
30+
ConfidentialTransferExtension = 27,
31+
DefaultAccountStateExtension = 28,
32+
Reallocate = 29,
33+
MemoTransferExtension = 30,
34+
CreateNativeMint = 31,
3335
}

token/js/test/e2e/common.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PublicKey, Keypair, Connection, Signer } from '@solana/web3.js';
2-
import { TOKEN_PROGRAM_ID, NATIVE_MINT, NATIVE_MINT_2022 } from '../../src';
2+
import { TOKEN_PROGRAM_ID } from '../../src';
33

44
export async function newAccountWithLamports(connection: Connection, lamports = 1000000): Promise<Signer> {
55
const account = Keypair.generate();
@@ -18,5 +18,3 @@ export async function getConnection(): Promise<Connection> {
1818
export const TEST_PROGRAM_ID = process.env.TEST_PROGRAM_ID
1919
? new PublicKey(process.env.TEST_PROGRAM_ID)
2020
: TOKEN_PROGRAM_ID;
21-
22-
export const TEST_NATIVE_MINT = TEST_PROGRAM_ID === TOKEN_PROGRAM_ID ? NATIVE_MINT : NATIVE_MINT_2022;

token/js/test/e2e/native.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,32 @@ import {
1313
} from '@solana/web3.js';
1414
import {
1515
NATIVE_MINT,
16+
NATIVE_MINT_2022,
17+
TOKEN_PROGRAM_ID,
1618
closeAccount,
1719
getAccount,
1820
createNativeMint,
1921
createWrappedNativeAccount,
2022
syncNative,
2123
} from '../../src';
22-
import { TEST_PROGRAM_ID, TEST_NATIVE_MINT, newAccountWithLamports, getConnection } from './common';
24+
import { TEST_PROGRAM_ID, newAccountWithLamports, getConnection } from './common';
2325

2426
describe('native', () => {
2527
let connection: Connection;
2628
let payer: Signer;
2729
let owner: Keypair;
2830
let account: PublicKey;
2931
let amount: number;
32+
let nativeMint: PublicKey;
3033
before(async () => {
3134
amount = 1_000_000_000;
3235
connection = await getConnection();
3336
payer = await newAccountWithLamports(connection, 100_000_000_000);
34-
if (TEST_NATIVE_MINT !== NATIVE_MINT) {
35-
await createNativeMint(connection, payer, undefined, TEST_PROGRAM_ID, TEST_NATIVE_MINT);
37+
if (TEST_PROGRAM_ID == TOKEN_PROGRAM_ID) {
38+
nativeMint = NATIVE_MINT;
39+
} else {
40+
nativeMint = NATIVE_MINT_2022;
41+
await createNativeMint(connection, payer, undefined, TEST_PROGRAM_ID, nativeMint);
3642
}
3743
});
3844
beforeEach(async () => {
@@ -45,7 +51,7 @@ describe('native', () => {
4551
undefined,
4652
undefined,
4753
TEST_PROGRAM_ID,
48-
TEST_NATIVE_MINT
54+
nativeMint
4955
);
5056
});
5157
it('works', async () => {

0 commit comments

Comments
 (0)