Skip to content

Commit

Permalink
Update polkadot/api to 9.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
en committed Feb 16, 2023
1 parent 9227ea9 commit 001bb82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"@polkadot/api": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/api": "9.6.2",
"@polkadot/types": "9.6.2",
"chalk": "^4.1.1",
"db-migrate": "^0.11.13",
"db-migrate-sqlite3": "^0.4.0",
Expand Down
6 changes: 3 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const BLOCK_LOG_SIZE = 100;
async function start() {
await initDb();
const account = await initNearRpc();
const wsProvider = new WsProvider2(appchainSetting.wsRpcEndpoint);
const wsProvider = new WsProvider2(appchainSetting.wsRpcEndpoint, 300 * 1000, undefined, 180 * 1000);

const exitTimer = setTimeout(() => {
console.error("init polkadotjs expired: always pending");
Expand Down Expand Up @@ -298,8 +298,8 @@ async function handleSignedCommitment(

console.log("blockNumber======", blockNumber.toNumber())
logJSON("currBlockHash", currBlockHash);
const rawMmrProofWrapper = await appchain.rpc.mmr.generateProof(
Number(decodedSignedCommitment.commitment.blockNumber) - 1,
const rawMmrProofWrapper = await appchain.rpc.mmr.generateBatchProof(
[Number(decodedSignedCommitment.commitment.blockNumber) - 1],
currBlockHash
);
logJSON("rawMmrProofWrapper", rawMmrProofWrapper.toJSON());
Expand Down
7 changes: 4 additions & 3 deletions src/commitments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ async function handleCommitment(commitment: Commitment, appchain: ApiPromise) {
appchain,
commitment.commitment
);
console.log("encoded_messages: ", encoded_messages);
const decoded_messages: any = decodeMessages(encoded_messages);
console.log("decoded_messages", util.inspect(decoded_messages.toJSON(), { showHidden: false, depth: null, colors: true }));
console.log("decoded_messages: ", util.inspect(decoded_messages.toString(), { showHidden: false, depth: null, colors: true }));

let rawProof: MmrLeafProof | undefined = undefined;
let messageProofWithState: MessageProofWithLightClientState | undefined = undefined;
Expand Down Expand Up @@ -116,8 +117,8 @@ async function handleCommitment(commitment: Commitment, appchain: ApiPromise) {
const mmrRootBlockHash = await appchain.rpc.chain.getBlockHash(
decodedSignedCommitment.commitment.blockNumber
);
rawProof = await appchain.rpc.mmr.generateProof(
commitment.height,
rawProof = await appchain.rpc.mmr.generateBatchProof(
[commitment.height],
mmrRootBlockHash
);
logJSON("rawProof", rawProof);
Expand Down

0 comments on commit 001bb82

Please sign in to comment.