From 67bdcee9990c6e2369bcb2811735e37bbe0c7f2e Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Mon, 22 Apr 2024 08:45:23 +0100 Subject: [PATCH 1/5] Changed signature type --- src/paymentGenerator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/paymentGenerator.ts b/src/paymentGenerator.ts index c1f26a3..ddab637 100644 --- a/src/paymentGenerator.ts +++ b/src/paymentGenerator.ts @@ -8,7 +8,7 @@ export async function processTransaction( amount: number, fee: number ) { - const client = new Client({ network: 'testnet' }); + const client = new Client({ network: 'mainnet' }); let sender_public = client.derivePublicKey(deployerAccount) console.log("receiver: ", receiver); let amountToSend = amount * 1000000000; From 591abade72233acf40a2f4326e5f2589d8a7e97f Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Wed, 24 Apr 2024 12:36:50 +0100 Subject: [PATCH 2/5] Add network profile as argu --- src/combined.ts | 11 +++++++---- src/entry.ts | 11 +++++++++++ src/paymentGenerator.ts | 5 +++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/combined.ts b/src/combined.ts index 1b5f406..0c5fd48 100644 --- a/src/combined.ts +++ b/src/combined.ts @@ -9,6 +9,7 @@ export async function applyGenerator( transactionAmount: string, transactionFee: string, transactionType: string, + networkProfile: 'mainnet' | 'testnet', i: number) { if (transactionType === 'regular') { await processTransaction( @@ -17,7 +18,8 @@ export async function applyGenerator( receiver, parseInt(transactionInterval), parseFloat(transactionAmount), - parseFloat(transactionFee) + parseFloat(transactionFee), + networkProfile ); } else if (transactionType === 'zkApp') { @@ -27,7 +29,7 @@ export async function applyGenerator( receiver, parseInt(transactionInterval), parseFloat(transactionAmount), - parseFloat(transactionFee)) + parseFloat(transactionFee)); } else { if (i % 2 === 0) { @@ -37,8 +39,9 @@ export async function applyGenerator( receiver, parseInt(transactionInterval), parseFloat(transactionAmount), - parseFloat(transactionFee) - ); + parseFloat(transactionFee), + networkProfile + ) } else { await processZKTransaction( diff --git a/src/entry.ts b/src/entry.ts index 476e774..dc62ba0 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -14,6 +14,7 @@ program .option('-t, --transaction-type ', 'transaction type (zkApp or regular)', 'regular') .option('-a, --transaction-amount ', 'amount of Mina to send', '2') .option('-f, --transaction-fee ', 'transaction fee', '0.1') + .option('-n, --network-profile', 'use network profile', 'testnet') .action(async (options) => { const url = options.url || process.env.MINA_GRAPHQL_URL; const senderPrivateKey = options.senderPrivateKey || process.env.SENDER_PRIVATE_KEY; @@ -23,6 +24,7 @@ program let transactionType = options.transactionType; let transactionAmount = options.transactionAmount; let transactionFee = options.transactionFee; + let networkProfile = options.networkProfile; if (!url) { console.error("url is not specified or MINA_GRAPHQL_URL is not set."); process.exit(1); @@ -50,6 +52,14 @@ program if (process.env.TRANSACTION_FEE) { transactionFee = process.env.TRANSACTION_FEE } + if (process.env.NETWORK_PROFILE) { + transactionInterval = process.env.TRANSACTION_INTERVAL + } + let networkProfileTypes = ['testnet', 'mainnet']; + if (!networkProfileTypes.includes(networkProfile)) { + console.log('Invalid network profile'); + return; + } let receivers = fs.readFileSync(walletList).toString().split("\n"); let transactionTypes = ['regular', 'zkApp', 'mixed'] if (transactionTypes.includes(transactionType)) { @@ -63,6 +73,7 @@ program transactionAmount, transactionFee, transactionType, + networkProfile, incr); incr++ } diff --git a/src/paymentGenerator.ts b/src/paymentGenerator.ts index ddab637..a2488ae 100644 --- a/src/paymentGenerator.ts +++ b/src/paymentGenerator.ts @@ -6,9 +6,10 @@ export async function processTransaction( receiver: string, timeDelayMS: number, amount: number, - fee: number + fee: number, + networkProfile: 'mainnet' | 'testnet' ) { - const client = new Client({ network: 'mainnet' }); + const client = new Client({ network: networkProfile }); let sender_public = client.derivePublicKey(deployerAccount) console.log("receiver: ", receiver); let amountToSend = amount * 1000000000; From bcfd40da010d05f99dbe80f7a1586dcdfc6ea824 Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Tue, 7 May 2024 08:04:28 +0100 Subject: [PATCH 3/5] Update libraries --- package-lock.json | 28 ++++++++++++++-------------- package.json | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6290123..996ccbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "commander": "^11.1.0", - "mina-signer": "^2.1.2" + "mina-signer": "latest" }, "devDependencies": { "@babel/preset-env": "^7.16.4", @@ -6821,9 +6821,9 @@ } }, "node_modules/mina-signer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/mina-signer/-/mina-signer-2.1.2.tgz", - "integrity": "sha512-fvi1L8vjEFHyZp66eUsCXp80A5WXEHKvGunwLikDWMilVC7bS36AvVZOc1s+8F48xNsKXuxcwkMrPWPzNgechA==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/mina-signer/-/mina-signer-3.0.7.tgz", + "integrity": "sha512-7eYp/6WWj2VzJjvfC8dNeGMud/brdBrzkUsCdysFFXnfV2/FVpVhAGCMfaS6hs0HJtS4+eplmiD2hXfshQS8CQ==", "dependencies": { "blakejs": "^1.2.1", "js-sha256": "^0.9.0" @@ -6928,9 +6928,9 @@ "license": "MIT" }, "node_modules/o1js": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-0.18.0.tgz", - "integrity": "sha512-A4XFfRLUHxB8ZUzctpxmYA4kBi3ZRwSgeK/KKuWxf2kDmaxjWOxbCzH/1wHelom4QKIgSIaJpXkAtR0jJv7tqw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.1.0.tgz", + "integrity": "sha512-rq+ndUFZBzC+Gk3VbXGNu97uFZJTLDmqglP1J8gGWP3Bdchjj+huCtPVvezfiw6+RyjPePaBVSbPWO11HMZiaQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", @@ -6944,7 +6944,7 @@ "snarky-run": "src/build/run.js" }, "engines": { - "node": ">=16.4.0" + "node": ">=18.14.0" } }, "node_modules/once": { @@ -12635,9 +12635,9 @@ "dev": true }, "mina-signer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/mina-signer/-/mina-signer-2.1.2.tgz", - "integrity": "sha512-fvi1L8vjEFHyZp66eUsCXp80A5WXEHKvGunwLikDWMilVC7bS36AvVZOc1s+8F48xNsKXuxcwkMrPWPzNgechA==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/mina-signer/-/mina-signer-3.0.7.tgz", + "integrity": "sha512-7eYp/6WWj2VzJjvfC8dNeGMud/brdBrzkUsCdysFFXnfV2/FVpVhAGCMfaS6hs0HJtS4+eplmiD2hXfshQS8CQ==", "requires": { "blakejs": "^1.2.1", "js-sha256": "^0.9.0" @@ -12711,9 +12711,9 @@ "dev": true }, "o1js": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-0.18.0.tgz", - "integrity": "sha512-A4XFfRLUHxB8ZUzctpxmYA4kBi3ZRwSgeK/KKuWxf2kDmaxjWOxbCzH/1wHelom4QKIgSIaJpXkAtR0jJv7tqw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.1.0.tgz", + "integrity": "sha512-rq+ndUFZBzC+Gk3VbXGNu97uFZJTLDmqglP1J8gGWP3Bdchjj+huCtPVvezfiw6+RyjPePaBVSbPWO11HMZiaQ==", "peer": true, "requires": { "blakejs": "1.2.1", diff --git a/package.json b/package.json index b54cbaf..27301ab 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,6 @@ }, "dependencies": { "commander": "^11.1.0", - "mina-signer": "^2.1.2" + "mina-signer": "latest" } -} +} \ No newline at end of file From 201e4f10ab2b1c31275c612a5cd56834f6b2ea61 Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Tue, 7 May 2024 08:22:25 +0100 Subject: [PATCH 4/5] Fix typo --- src/entry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entry.ts b/src/entry.ts index dc62ba0..b8a74c1 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -53,7 +53,7 @@ program transactionFee = process.env.TRANSACTION_FEE } if (process.env.NETWORK_PROFILE) { - transactionInterval = process.env.TRANSACTION_INTERVAL + networkProfile = process.env.NETWORK_PROFILE } let networkProfileTypes = ['testnet', 'mainnet']; if (!networkProfileTypes.includes(networkProfile)) { From 15735d6e5a7a9d8c79b0753914d00f0f0ea26963 Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Tue, 7 May 2024 09:07:25 +0100 Subject: [PATCH 5/5] Update profile --- src/combined.ts | 6 ++++-- src/entry.ts | 2 +- src/zkAppGenerator.ts | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/combined.ts b/src/combined.ts index 0c5fd48..5826a94 100644 --- a/src/combined.ts +++ b/src/combined.ts @@ -29,7 +29,8 @@ export async function applyGenerator( receiver, parseInt(transactionInterval), parseFloat(transactionAmount), - parseFloat(transactionFee)); + parseFloat(transactionFee), + networkProfile); } else { if (i % 2 === 0) { @@ -50,7 +51,8 @@ export async function applyGenerator( receiver, parseInt(transactionInterval), parseFloat(transactionAmount), - parseFloat(transactionFee) + parseFloat(transactionFee), + networkProfile ); } } diff --git a/src/entry.ts b/src/entry.ts index b8a74c1..30aa5c7 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -14,7 +14,7 @@ program .option('-t, --transaction-type ', 'transaction type (zkApp or regular)', 'regular') .option('-a, --transaction-amount ', 'amount of Mina to send', '2') .option('-f, --transaction-fee ', 'transaction fee', '0.1') - .option('-n, --network-profile', 'use network profile', 'testnet') + .option('-n, --network-profile ', 'use network profile', 'testnet') .action(async (options) => { const url = options.url || process.env.MINA_GRAPHQL_URL; const senderPrivateKey = options.senderPrivateKey || process.env.SENDER_PRIVATE_KEY; diff --git a/src/zkAppGenerator.ts b/src/zkAppGenerator.ts index feb5e0a..ccc6431 100644 --- a/src/zkAppGenerator.ts +++ b/src/zkAppGenerator.ts @@ -12,11 +12,13 @@ export async function processZKTransaction( receiver: string, timeDelayMS: number, amount: number, - fee: number + fee: number, + networkProfile: 'mainnet' | 'testnet' ) { - const devNet = Mina.Network( - network - ); + const devNet = Mina.Network({ + mina: network, + networkId: networkProfile + }); Mina.setActiveInstance(devNet); let amountToSend = amount * 1000000000;