Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
phn210 committed Apr 11, 2024
1 parent 58314d9 commit 0a2ee4c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auxo-dev/auxo-libs",
"version": "0.5.1",
"version": "0.5.3",
"description": "",
"author": "",
"license": "Apache-2.0",
Expand Down
6 changes: 4 additions & 2 deletions src/utils/network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ describe('Network', () => {
testZkApp = {
key: PrivateKey.randomKeypair(),
name: 'TestContract',
initArgs: {
num: Field(100),
},
};
testZkApp.contract = new TestContract(testZkApp.key.publicKey);
});
Expand Down Expand Up @@ -107,8 +110,7 @@ describe('Network', () => {
await proveAndSendTx(
TestContract.name,
'test',
async () =>
(testZkApp.contract as TestContract).test(Field(1), Field(1)),
(testZkApp.contract as TestContract).test(Field(1), Field(1)),
feePayer,
true,
profiler,
Expand Down
14 changes: 8 additions & 6 deletions src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async function sendTx(
async function proveAndSendTx(
contractName: string,
methodName: string,
functionCall: () => Promise<void>,
functionCall: Promise<void>,
feePayer: FeePayer,
waitForBlock = false,
profiler?: Profiler,
Expand All @@ -142,7 +142,7 @@ async function proveAndSendTx(
memo: feePayer.memo,
nonce: await fetchNonce(feePayer.sender.publicKey),
},
functionCall
() => functionCall
);
if (logger && logger.info)
console.log(
Expand All @@ -154,7 +154,8 @@ async function proveAndSendTx(
if (logger && logger.info) console.log('Generating proof done!');
return await sendTx(
await tx.sign([feePayer.sender.privateKey]),
waitForBlock
waitForBlock,
logger
);
}

Expand All @@ -174,7 +175,7 @@ async function deployZkApps(
if (logger && logger.info) {
console.log('Deploying:');
zkApps.map((e) => {
console.log(`- ${e.name} || 'Unknown'`);
console.log(`- ${e.name || 'Unknown'}`);
});
}

Expand All @@ -193,7 +194,7 @@ async function deployZkApps(
zkApps.map((e) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
e.contract!.deploy();
Object.entries(e.initArgs ?? []).map(([key, value]) =>
Object.entries(e.initArgs ?? {}).map(([key, value]) =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(e.contract as any)[key].set(value)
);
Expand All @@ -205,7 +206,8 @@ async function deployZkApps(
feePayer.sender.privateKey,
...zkApps.map((e) => e.key.privateKey),
]),
waitForBlock
waitForBlock,
logger
);
if (logger && logger.info) console.log('Successfully deployed!');
return result;
Expand Down

0 comments on commit 0a2ee4c

Please sign in to comment.