diff --git a/scripts/airdrop/helper.ts b/scripts/airdrop/helper.ts index 811f76d7..f0952d0f 100644 --- a/scripts/airdrop/helper.ts +++ b/scripts/airdrop/helper.ts @@ -1,15 +1,12 @@ import { TransactionArgument, TransactionBlock } from "@mysten/sui.js/transactions"; import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519'; -import * as blake2 from 'blake2'; +import { blake2b } from '@noble/hashes/blake2b'; import fs from "fs"; import { AirdropConfig, addressConfig, mainnetConfig } from "../config/day_one"; import { Network, mainPackage } from "../config/constants"; -import { execSync } from 'child_process'; -import { RawSigner } from "@mysten/sui.js/src/signers/raw-signer"; import { isValidSuiAddress, normalizeSuiAddress, toB64 } from "@mysten/sui.js/utils"; import { ExecutionStatus, GasCostSummary, SuiClient, SuiTransactionBlockResponse } from "@mysten/sui.js/client"; import { bcs } from "@mysten/sui.js/bcs"; -import { SignerWithProvider } from "@mysten/sui.js/src/signers/signer-with-provider"; import dotenv from "dotenv"; dotenv.config(); @@ -114,11 +111,9 @@ export const serializeBatchToBytes = (batch: string[]) => { export const batchToHash = (batch: string[]) => { const bytes = Buffer.from(serializeBatchToBytes(batch)); + const digest = blake2b(bytes, { dkLen: 32}); - return blake2 - .createHash('blake2b', { digestLength: 32 }) - .update(bytes) - .digest('hex') + return Buffer.from(digest).toString('hex'); } export const prepareSigner = (): Ed25519Keypair => { diff --git a/scripts/package.json b/scripts/package.json index 5e62884f..5b0eebfe 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -7,7 +7,7 @@ "test": "echo \"Error: no test specified\" && exit 1", "transactions::main_package::upgrade": "ts-node transactions/main_package_upgrade.ts", "transfer::names": "ts-node reserved-names/transfer-names.ts", - "withdraw:auction:profits":"ts-node transactions/withdraw_funds_20290927.ts", + "withdraw:auction:profits": "ts-node transactions/withdraw_funds_20290927.ts", "authorize-utils": "ts-node transactions/authorize_utils.ts", "authorize-discounts": "ts-node transactions/quest_3_setup.ts", "disable-free-claims": "ts-node transactions/quest3/disable_free_claims.ts", @@ -23,13 +23,13 @@ "@mysten/bcs": "0.11.1", "@mysten/kiosk": "0.8.4", "@mysten/sui.js": "0.51.0", + "@noble/hashes": "^1.4.0", "@pythnetwork/pyth-sui-js": "2.0.0", - "@types/blake2": "^4.0.1", "dotenv": "^16.3.1", - "ts-node": "^10.9.1", "typescript": "^5.1.6" }, "devDependencies": { + "ts-node": "^10.9.1", "@types/node": "^20.11.30" } } diff --git a/scripts/pnpm-lock.yaml b/scripts/pnpm-lock.yaml index d2ddacf2..f2442ffd 100644 --- a/scripts/pnpm-lock.yaml +++ b/scripts/pnpm-lock.yaml @@ -14,18 +14,15 @@ dependencies: '@mysten/sui.js': specifier: 0.51.0 version: 0.51.0 + '@noble/hashes': + specifier: ^1.4.0 + version: 1.4.0 '@pythnetwork/pyth-sui-js': specifier: 2.0.0 version: 2.0.0 - '@types/blake2': - specifier: ^4.0.1 - version: 4.0.4 dotenv: specifier: ^16.3.1 version: 16.3.1 - ts-node: - specifier: ^10.9.1 - version: 10.9.1(@types/node@20.11.30)(typescript@5.1.6) typescript: specifier: ^5.1.6 version: 5.1.6 @@ -34,6 +31,9 @@ devDependencies: '@types/node': specifier: ^20.11.30 version: 20.11.30 + ts-node: + specifier: ^10.9.1 + version: 10.9.1(@types/node@20.11.30)(typescript@5.1.6) packages: @@ -60,7 +60,7 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/trace-mapping': 0.3.9 - dev: false + dev: true /@gql.tada/cli-utils@0.3.0: resolution: {integrity: sha512-kDebLVuM5r3/bI1MmlhHr9VKHxXeq8Gxy1wHVTPva4R5ObfbhzxnHsTCvR6MUp8ziy9Pg9MESb8S1YZW8ohM3A==} @@ -87,18 +87,18 @@ packages: /@jridgewell/resolve-uri@3.1.1: resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} engines: {node: '>=6.0.0'} - dev: false + dev: true /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - dev: false + dev: true /@jridgewell/trace-mapping@0.3.9: resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} dependencies: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 - dev: false + dev: true /@mysten/bcs@0.10.1: resolution: {integrity: sha512-cQDb7Rhz2J82ZqgVQiHykuwKUlgiLWS2bjoajPPW0uvXlb75qrgKuaxh1UzsaRhHy3egk/APc0xjiZoqdbzB4w==} @@ -224,25 +224,19 @@ packages: /@tsconfig/node10@1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} - dev: false + dev: true /@tsconfig/node12@1.0.11: resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - dev: false + dev: true /@tsconfig/node14@1.0.3: resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - dev: false + dev: true /@tsconfig/node16@1.0.4: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - dev: false - - /@types/blake2@4.0.4: - resolution: {integrity: sha512-r84TojGHMbBoH91XQjqoc1N89xy/LmcGb15k9OSdB2APb+xQfNcfbcFGMa9RbMmFsnIKCRDMpuKHBM04AwdgxQ==} - dependencies: - '@types/node': 20.11.30 - dev: false + dev: true /@types/node@20.11.30: resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==} @@ -258,17 +252,17 @@ packages: /acorn-walk@8.2.0: resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} engines: {node: '>=0.4.0'} - dev: false + dev: true /acorn@8.9.0: resolution: {integrity: sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==} engines: {node: '>=0.4.0'} hasBin: true - dev: false + dev: true /arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: false + dev: true /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} @@ -325,7 +319,7 @@ packages: /create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - dev: false + dev: true /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} @@ -335,7 +329,7 @@ packages: /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} - dev: false + dev: true /dotenv@16.3.1: resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} @@ -396,7 +390,7 @@ packages: /make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - dev: false + dev: true /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} @@ -456,7 +450,7 @@ packages: typescript: 5.1.6 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - dev: false + dev: true /tweetnacl@1.0.3: resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==} @@ -466,7 +460,6 @@ packages: resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} engines: {node: '>=14.17'} hasBin: true - dev: false /typescript@5.4.3: resolution: {integrity: sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==} @@ -479,7 +472,7 @@ packages: /v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - dev: false + dev: true /ws@8.16.0: resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==} @@ -497,4 +490,4 @@ packages: /yn@3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} - dev: false + dev: true