Skip to content

Commit

Permalink
chore: remove encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Dec 13, 2024
1 parent b29ea2a commit db9b2eb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
services:
a3p:
image: ghcr.io/agoric/agoric-3-proposals:latest
image: ghcr.io/agoric/agoric-3-proposals@sha256:644e09bf041e5588570ff9a49e6129cc468e9c8458417541027e8532cb91083b
ports:
- 26657:26657
postgres:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
retries: 5

subquery-node:
image: subquerynetwork/subql-node-cosmos:v3.12.0
image: subquerynetwork/subql-node-cosmos:v4.2.1
depends_on:
'postgres':
condition: service_healthy
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"devDependencies": {
"@cosmjs/stargate": "^0.28.9",
"@subql/cli": "^5.4.0",
"@subql/node-cosmos": "^4.2.1",
"@subql/node-cosmos": "4.2.1",
"@subql/testing": "latest",
"prettier": "^3.4.2",
"starknet": "6.11.0",
Expand Down
16 changes: 8 additions & 8 deletions src/mappings/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { b64encode } from './utils';
import {} from './utils';

export const EVENT_TYPES = {
ACTIVE_PROPOSAL: 'active_proposal',
Expand Down Expand Up @@ -43,11 +43,11 @@ export const PACKET_SRC_CHANNEL_KEY = 'packet_src_channel';
export const PACKET_DST_CHANNEL_KEY = 'packet_dst_channel';
export const PACKET_SRC_PORT_KEY = 'packet_src_port';
export const PACKET_DST_PORT_KEY = 'packet_dst_port';
export const ACTION_KEY = b64encode('action');
export const IBC_MESSAGE_TRANSFER_VALUE = b64encode('/ibc.applications.transfer.v1.MsgTransfer');
export const IBC_MESSAGE_RECEIVE_PACKET_VALUE = b64encode('/ibc.core.channel.v1.MsgRecvPacket');
export const RECEPIENT_KEY = b64encode('recipient');
export const SENDER_KEY = b64encode('sender');
export const RECEIVER_KEY = b64encode('receiver');
export const AMOUNT_KEY = b64encode('amount');
export const ACTION_KEY = 'action';
export const IBC_MESSAGE_TRANSFER_VALUE = '/ibc.applications.transfer.v1.MsgTransfer';
export const IBC_MESSAGE_RECEIVE_PACKET_VALUE = '/ibc.core.channel.v1.MsgRecvPacket';
export const RECEPIENT_KEY = 'recipient';
export const SENDER_KEY = 'sender';
export const RECEIVER_KEY = 'receiver';
export const AMOUNT_KEY = 'amount';
export const TRANSFER_PORT_VALUE = 'transfer';
1 change: 0 additions & 1 deletion src/mappings/events/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const vaultsEventKit = (block: any, data: any, module: string, path: stri
}

async function saveWallets(payload: any): Promise<Promise<any>[]> {
logger.info(`PAYLOAD: ${JSON.stringify(payload)}`);
const promises: Promise<void>[] = [];
const address = path.split('.')[2];
const wallet = new Wallet(path, BigInt(data.blockHeight), block.block.header.time as any, address);
Expand Down
11 changes: 2 additions & 9 deletions src/mappings/mappingHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ export async function handleBundleInstallMessage(message: CosmosMessage): Promis
export async function handleStateChangeEvent(cosmosEvent: CosmosEvent): Promise<void> {
const { event, block } = cosmosEvent as CosmosEvent & { event: tendermint37.Event };

logger.info(`EVENT ${JSON.stringify(event)}`);
logger.info(`EVENT TYPE:${event.type}`);

if (event.type != EVENT_TYPES.STATE_CHANGE) {
logger.warn('Not valid state_change event.');
return;
Expand All @@ -183,8 +180,7 @@ export async function handleStateChangeEvent(cosmosEvent: CosmosEvent): Promise<

let data = Object();
try {
const decodedValue =
valueAttr.key === UNPROVED_VALUE_KEY ? b64decode(b64decode(valueAttr.value)) : b64decode(valueAttr.value);
const decodedValue = valueAttr.key === UNPROVED_VALUE_KEY ? b64decode(valueAttr.value) : valueAttr.value;
data = JSON.parse(decodedValue);
} catch (e) {
return;
Expand All @@ -195,10 +191,7 @@ export async function handleStateChangeEvent(cosmosEvent: CosmosEvent): Promise<
return;
}

const decodedKey =
keyAttr.key === SUBKEY_KEY
? b64decode(b64decode(keyAttr.value)).replaceAll('\u0000', '\x00')
: b64decode(keyAttr.value);
const decodedKey = keyAttr.key === SUBKEY_KEY ? b64decode(keyAttr.value).replaceAll('\u0000', '\x00') : keyAttr.value;
const path = extractStoragePath(decodedKey);
const module = getStateChangeModule(path);

Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3305,7 +3305,7 @@ __metadata:
languageName: node
linkType: hard

"@subql/node-cosmos@npm:^4.2.1":
"@subql/node-cosmos@npm:4.2.1":
version: 4.2.1
resolution: "@subql/node-cosmos@npm:4.2.1"
dependencies:
Expand Down Expand Up @@ -4107,7 +4107,7 @@ __metadata:
dependencies:
"@cosmjs/stargate": "npm:^0.28.9"
"@subql/cli": "npm:^5.4.0"
"@subql/node-cosmos": "npm:^4.2.1"
"@subql/node-cosmos": "npm:4.2.1"
"@subql/testing": "npm:latest"
"@subql/types-cosmos": "npm:^4.0.0"
"@subql/utils": "npm:^2.17.0"
Expand Down

0 comments on commit db9b2eb

Please sign in to comment.