From 16647ab3e9eb23b8ccca7f212c63dab4c224a8b3 Mon Sep 17 00:00:00 2001 From: Mike MacCana Date: Thu, 5 Sep 2024 16:00:02 -0400 Subject: [PATCH 1/4] npm audit fix --- package-lock.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 741a155..191da7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1397,12 +1397,13 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { From bd43b69df421149f74ff62c41cebbe3e08aac9dd Mon Sep 17 00:00:00 2001 From: Mike MacCana Date: Thu, 5 Sep 2024 16:00:54 -0400 Subject: [PATCH 2/4] Bump version --- CHANGELOG.md | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb9e3e..5d538f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 2.5 - Add `makeTokenMint()` +- 2.5.3 includes a few fixes to build system and TS types that were missing in earlier 2.5.x releases ## 2.4 diff --git a/package-lock.json b/package-lock.json index 191da7c..0093c67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@solana-developers/helpers", - "version": "2.5.2", + "version": "2.5.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@solana-developers/helpers", - "version": "2.5.2", + "version": "2.5.3", "license": "MIT", "dependencies": { "@solana/spl-token": "^0.4.8", diff --git a/package.json b/package.json index 8f09d6a..158ecd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solana-developers/helpers", - "version": "2.5.2", + "version": "2.5.3", "description": "Solana helper functions", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.js", From 0c0029ecf6605f4ad925b2dfcf12f7eb50db66bd Mon Sep 17 00:00:00 2001 From: Mike MacCana Date: Thu, 5 Sep 2024 16:07:30 -0400 Subject: [PATCH 3/4] Someone forgot to build again (hands head in shame) --- CHANGELOG.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d538f8..fb338f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## 2.5 - Add `makeTokenMint()` -- 2.5.3 includes a few fixes to build system and TS types that were missing in earlier 2.5.x releases +- 2.5.4 includes a few fixes to build system and TS types that were missing in earlier 2.5.x releases ## 2.4 diff --git a/package-lock.json b/package-lock.json index 0093c67..3437846 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@solana-developers/helpers", - "version": "2.5.3", + "version": "2.5.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@solana-developers/helpers", - "version": "2.5.3", + "version": "2.5.4", "license": "MIT", "dependencies": { "@solana/spl-token": "^0.4.8", diff --git a/package.json b/package.json index 158ecd5..e6f6691 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solana-developers/helpers", - "version": "2.5.3", + "version": "2.5.4", "description": "Solana helper functions", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.js", From 0a6145af0a771c82d95255f653065ae08a532c3a Mon Sep 17 00:00:00 2001 From: Mike MacCana Date: Thu, 5 Sep 2024 16:35:44 -0400 Subject: [PATCH 4/4] Simplify naming. This is just doing a before/after test. --- src/index.test.ts | 20 ++++++++------------ src/lib/airdrop.ts | 3 +++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index 6ba118d..d16705f 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -205,13 +205,11 @@ describe("initializeKeypair", () => { envVariableName: keypairVariableName, }; - const signerFirstLoad = await initializeKeypair(connection, options); + const userBefore = await initializeKeypair(connection, options); // Check balance - const firstBalanceLoad = await connection.getBalance( - signerFirstLoad.publicKey, - ); - assert.ok(firstBalanceLoad > 0); + const balanceBefore = await connection.getBalance(userBefore.publicKey); + assert.ok(balanceBefore > 0); // Check that the environment variable was created dotenv.config({ path: envFileName }); @@ -221,19 +219,17 @@ describe("initializeKeypair", () => { } // Now reload the environment and check it matches our test keypair - const signerSecondLoad = await initializeKeypair(connection, options); + const userAfter = await initializeKeypair(connection, options); // Check the keypair is the same - assert.ok(signerFirstLoad.publicKey.equals(signerSecondLoad.publicKey)); + assert.ok(userBefore.publicKey.equals(userAfter.publicKey)); // Check balance has not changed - const secondBalanceLoad = await connection.getBalance( - signerSecondLoad.publicKey, - ); - assert.equal(firstBalanceLoad, secondBalanceLoad); + const balanceAfter = await connection.getBalance(userAfter.publicKey); + assert.equal(balanceBefore, balanceAfter); // Check there is a secret key - assert.ok(signerSecondLoad.secretKey); + assert.ok(userAfter.secretKey); await deleteFile(envFileName); }); diff --git a/src/lib/airdrop.ts b/src/lib/airdrop.ts index 232cd77..9dea5c7 100644 --- a/src/lib/airdrop.ts +++ b/src/lib/airdrop.ts @@ -6,6 +6,9 @@ const DEFAULT_AIRDROP_AMOUNT = 1 * LAMPORTS_PER_SOL; const DEFAULT_MINIMUM_BALANCE = 0.5 * LAMPORTS_PER_SOL; const DEFAULT_ENV_KEYPAIR_VARIABLE_NAME = "PRIVATE_KEY"; +// TODO: honestly initializeKeypair is a bit vague +// we can probably give this a better name, +// just not sure what yet export const initializeKeypair = async ( connection: Connection, options?: InitializeKeypairOptions,