random string

This commit is contained in:
aniketfuryrocks 2023-03-26 15:59:15 +05:30
parent abd4e26992
commit 231e33f314
No known key found for this signature in database
GPG Key ID: FA6BFCFAA7D4B764
3 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.0",
"@types/jest": "^29.2.5",
"crypto": "^1.0.1",
"jest": "^29.3.1",
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"

View File

@ -1,6 +1,7 @@
import { Connection, Keypair, sendAndConfirmTransaction, Transaction, PublicKey, TransactionInstruction, BlockheightBasedTransactionConfirmationStrategy } from "@solana/web3.js";
import * as fs from "fs";
import * as os from "os";
import * as crypto from "crypto";
jest.setTimeout(60000);
@ -16,7 +17,7 @@ function createTransaction(): Transaction {
new TransactionInstruction({
programId: MEMO_PROGRAM_ID,
keys: [],
data: Buffer.from("Hello")
data: Buffer.from(crypto.randomBytes(20).toString('hex'))
})
);

View File

@ -1114,6 +1114,11 @@ cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"
crypto@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/crypto/-/crypto-1.0.1.tgz#2af1b7cad8175d24c8a1b0778255794a21803037"
integrity sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==
debug@^4.1.0, debug@^4.1.1:
version "4.3.4"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz"