Skip to content

chore: bump to 0.30.0 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 59 additions & 139 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,15 @@
},
"homepage": "https://github.com/Lightprotocol/example-nodejs-client#readme",
"dependencies": {
"@lightprotocol/compressed-token": "0.20.9",
"@lightprotocol/stateless.js": "0.20.9",
"@lightprotocol/compressed-token": "file:../light-protocol/js/compressed-token",
"@lightprotocol/stateless.js": "file:../light-protocol/js/stateless.js",
"@solana/spl-token": "0.3.9",
"@solana/spl-token-metadata": "^0.1.6",
"@solana/web3.js": "^1.98.0",
"@types/node": "^20.12.7",
"bn.js": "^5.2.1",
"bs58": "^6.0.0",
"dotenv": "^16.4.5",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
},
"devDependencies": {
"@types/bn.js": "^5.1.6"
}
}
20 changes: 9 additions & 11 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@ export const RPC_ENDPOINT = process.env.RPC_ENDPOINT;
export const PAYER_KEYPAIR = Keypair.fromSecretKey(
bs58.decode(process.env.PAYER_KEYPAIR!)
);

export const MINT_ADDRESS = new PublicKey(process.env.MINT_ADDRESS!);

export const AUTHORITY_KEYPAIR = process.env.LUT_AUTHORITY_KEYPAIR
? Keypair.fromSecretKey(
Uint8Array.from(JSON.parse(process.env.LUT_AUTHORITY_KEYPAIR))
)
: undefined;

export const BOB_KEYPAIR = process.env.BOB_KEYPAIR
? Keypair.fromSecretKey(Uint8Array.from(JSON.parse(process.env.BOB_KEYPAIR)))
: undefined;
export const AUTHORITY_KEYPAIR = Keypair.fromSecretKey(
Uint8Array.from(JSON.parse(process.env.LUT_AUTHORITY_KEYPAIR!))
);
export const BOB_KEYPAIR = Keypair.fromSecretKey(
Uint8Array.from(JSON.parse(process.env.BOB_KEYPAIR!))
);

export const LUT_MAINNET_AUTHORITY_KEYPAIR = process.env.LUT_AUTHORITY_KEYPAIR
? Keypair.fromSecretKey(
Expand All @@ -34,5 +29,8 @@ if (!RPC_ENDPOINT) throw new Error("Please set RPC_ENDPOINT in .env");
if (!PAYER_KEYPAIR)
throw new Error("Please set PAYER_KEYPAIR as bs58 string in .env");
if (!MINT_ADDRESS) throw new Error("Please set MINT_ADDRESS in .env");
if (!AUTHORITY_KEYPAIR)
throw new Error("Please set LUT_AUTHORITY_KEYPAIR in .env");
if (!BOB_KEYPAIR) throw new Error("Please set BOB_KEYPAIR in .env");

console.log("PAYER PUBLIC KEY:", PAYER_KEYPAIR.publicKey.toString());
10 changes: 6 additions & 4 deletions src/internal/create-account-pulse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
createRpc,
LightSystemProgram,
Rpc,
selectStateTreeInfo,
} from "@lightprotocol/stateless.js";
import { PAYER_KEYPAIR, RPC_ENDPOINT } from "../constants";
import { randomBytes } from "crypto";
import { PublicKey } from "@solana/web3.js";

const fromKeypair = PAYER_KEYPAIR;

Expand All @@ -23,10 +23,13 @@ const trees = [
"smt9ReAYRF5eFjTd5gBJMn5aKwNRcmp3ub2CQr2vW7j",
"smtAvYA5UbTRyKAkAj5kHs1CmrA42t6WkVLi4c6mA1f",
];

(async () => {
try {
while (true) {
const pseudoRandomTree = trees[Math.floor(Math.random() * trees.length)];
const infos = await connection.getCachedActiveStateTreeInfos();
const info = selectStateTreeInfo(infos);

// Create account with random address
const randomSeed = new Uint8Array(randomBytes(32));
const txId = await createAccount(
Expand All @@ -35,8 +38,7 @@ const trees = [
[randomSeed],
LightSystemProgram.programId,
undefined,
undefined,
new PublicKey(pseudoRandomTree)
info
);
console.log(
`Compressed Account Creation Success. Transaction Signature:`,
Expand Down
Loading