Skip to content

Commit

Permalink
Merge pull request #15 from MinaFoundation/update-signer-for-live
Browse files Browse the repository at this point in the history
Change Signer Profile to Mainnet
  • Loading branch information
kaozenn authored May 7, 2024
2 parents 5c9b28e + 15735d6 commit 674888b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 27 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
},
"dependencies": {
"commander": "^11.1.0",
"mina-signer": "^2.1.2"
"mina-signer": "latest"
}
}
}
15 changes: 10 additions & 5 deletions src/combined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export async function applyGenerator(
transactionAmount: string,
transactionFee: string,
transactionType: string,
networkProfile: 'mainnet' | 'testnet',
i: number) {
if (transactionType === 'regular') {
await processTransaction(
Expand All @@ -17,7 +18,8 @@ export async function applyGenerator(
receiver,
parseInt(transactionInterval),
parseFloat(transactionAmount),
parseFloat(transactionFee)
parseFloat(transactionFee),
networkProfile
);
}
else if (transactionType === 'zkApp') {
Expand All @@ -27,7 +29,8 @@ export async function applyGenerator(
receiver,
parseInt(transactionInterval),
parseFloat(transactionAmount),
parseFloat(transactionFee))
parseFloat(transactionFee),
networkProfile);
}
else {
if (i % 2 === 0) {
Expand All @@ -37,8 +40,9 @@ export async function applyGenerator(
receiver,
parseInt(transactionInterval),
parseFloat(transactionAmount),
parseFloat(transactionFee)
);
parseFloat(transactionFee),
networkProfile
)
}
else {
await processZKTransaction(
Expand All @@ -47,7 +51,8 @@ export async function applyGenerator(
receiver,
parseInt(transactionInterval),
parseFloat(transactionAmount),
parseFloat(transactionFee)
parseFloat(transactionFee),
networkProfile
);
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ program
.option('-t, --transaction-type <type>', 'transaction type (zkApp or regular)', 'regular')
.option('-a, --transaction-amount <amount>', 'amount of Mina to send', '2')
.option('-f, --transaction-fee <fee>', 'transaction fee', '0.1')
.option('-n, --network-profile <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;
Expand All @@ -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);
Expand Down Expand Up @@ -50,6 +52,14 @@ program
if (process.env.TRANSACTION_FEE) {
transactionFee = process.env.TRANSACTION_FEE
}
if (process.env.NETWORK_PROFILE) {
networkProfile = process.env.NETWORK_PROFILE
}
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)) {
Expand All @@ -63,6 +73,7 @@ program
transactionAmount,
transactionFee,
transactionType,
networkProfile,
incr);
incr++
}
Expand Down
5 changes: 3 additions & 2 deletions src/paymentGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'testnet' });
const client = new Client({ network: networkProfile });
let sender_public = client.derivePublicKey(deployerAccount)
console.log("receiver: ", receiver);
let amountToSend = amount * 1000000000;
Expand Down
10 changes: 6 additions & 4 deletions src/zkAppGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 674888b

Please sign in to comment.