Skip to content

Commit

Permalink
Replaces sdk with own version with more logging
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Blazhukova <[email protected]>
  • Loading branch information
konstantinabl committed Oct 23, 2024
1 parent 6058832 commit 913f577
Show file tree
Hide file tree
Showing 40 changed files with 455 additions and 86 deletions.
2 changes: 1 addition & 1 deletion dapp-example/src/hooks/useHederaSdk.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { ethers } from 'ethers';
import { PublicKey, Client, TransferTransaction, Hbar, AccountId, AccountInfoQuery } from '@hashgraph/sdk';
import { PublicKey, Client, TransferTransaction, Hbar, AccountId, AccountInfoQuery } from 'kosi-sdk';

const client = Client.forTestnet();

Expand Down
2 changes: 1 addition & 1 deletion dapp-example/tests/e2e/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const HederaSDK = require('@hashgraph/sdk');
const HederaSDK = require('kosi-sdk');
const ethers = require('ethers');
const fs = require('fs');
const path = require('path');
Expand Down
456 changes: 411 additions & 45 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"@types/co-body": "6.1.0",
"@types/find-config": "^1.0.4",
"@types/koa-cors": "^0.0.6",
"@types/sinon": "^10.0.20",
"@types/lodash": "^4.17.7",
"@types/sinon": "^10.0.20",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"ajv": "^8.16.0",
Expand Down Expand Up @@ -89,12 +89,14 @@
"keyv-file": "^0.3.3",
"koa-cors": "^0.0.16",
"koa-websocket": "^7.0.0",
"kosi-sdk": "1.0.1",
"lerna": "^8.1.8",
"pino": "^7.11.0",
"pino-pretty": "^7.6.1",
"prom-client": "^14.0.1",
"pnpm": "^8.7.1",
"redis": "^4.7.0"
"prom-client": "^14.0.1",
"redis": "^4.7.0",
"type": "^2.7.3"
},
"overrides": {
"protobufjs": "^7.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"dependencies": {
"@hashgraph/json-rpc-config-service": "file:../config-service",
"@ethersproject/asm": "^5.7.0",
"@hashgraph/sdk": "^2.50.0-beta.3",
"@keyvhq/core": "^1.6.9",
"axios": "^1.4.0",
"axios-retry": "^3.5.1",
Expand All @@ -60,6 +59,7 @@
"ethers": "^6.7.0",
"find-config": "^1.0.0",
"keccak": "^3.0.2",
"kosi-sdk": "1.0.1",
"keyv": "^4.2.2",
"keyv-file": "^0.3.0",
"lodash": "^4.17.21",
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/clients/sdkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
TransactionRecord,
TransactionRecordQuery,
TransactionResponse,
} from '@hashgraph/sdk';
} from 'kosi-sdk';
import { Logger } from 'pino';
import { Utils } from '../../utils';
import { EventEmitter } from 'events';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/errors/MirrorNodeClientError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

import { Status } from '@hashgraph/sdk';
import { Status } from 'kosi-sdk';

export class MirrorNodeClientError extends Error {
public statusCode: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/errors/SDKClientError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

import { Status } from '@hashgraph/sdk';
import { Status } from 'kosi-sdk';

export class SDKClientError extends Error {
public status: Status = Status.Unknown;
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Transaction as EthersTransaction } from 'ethers';
import HAPIService from './services/hapiService/hapiService';
import { JsonRpcError, predefined } from './errors/JsonRpcError';
import { Block, Log, Transaction, Transaction1559 } from './model';
import { FileId, Hbar, PrecheckStatusError } from '@hashgraph/sdk';
import { FileId, Hbar, PrecheckStatusError } from 'kosi-sdk';
import { CacheService } from './services/cacheService/cacheService';
import { CommonService, FilterService } from './services/ethService';
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

// Used for fake implementation of block history
import { Status, TransactionRecord } from '@hashgraph/sdk';
import { Status, TransactionRecord } from 'kosi-sdk';

export class Block {
public readonly timestamp: string = '0x' + new Date().valueOf().toString(16);
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import { Net } from '../index';
import constants from './constants';
import { Client } from '@hashgraph/sdk';
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
import { Client } from 'kosi-sdk';

export class NetImpl implements Net {
private client: Client;
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Poller } from './poller';
import { Web3Impl } from './web3';
import EventEmitter from 'events';
import constants from './constants';
import { Client, Hbar } from '@hashgraph/sdk';
import { Client, Hbar } from 'kosi-sdk';
import { RequestDetails } from './types';
import { prepend0x } from '../formatters';
import { MirrorNodeClient } from './clients';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/services/hapiService/hapiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { SDKClient } from '../../clients/sdkClient';
import { HbarLimitService } from '../hbarLimitService';
import { CacheService } from '../cacheService/cacheService';
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
import { AccountId, Client, LogLevel, PrivateKey, Logger as SDKLogger } from '@hashgraph/sdk';
import { AccountId, Client, LogLevel, PrivateKey, Logger as SDKLogger } from 'kosi-sdk';
import fs from 'fs';

export default class HAPIService {
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/services/hbarLimitService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { EthAddressHbarSpendingPlanRepository } from '../../db/repositories/hbar
import { IPAddressHbarSpendingPlanRepository } from '../../db/repositories/hbarLimiter/ipAddressHbarSpendingPlanRepository';
import { RequestDetails } from '../../types';
import constants from '../../constants';
import { Hbar } from '@hashgraph/sdk';
import { Hbar } from 'kosi-sdk';

export class HbarLimitService implements IHbarLimitService {
static readonly TIER_LIMITS: Record<SubscriptionTier, Hbar> = {
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/lib/web3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/

import { Web3 } from '../index';
import { Client } from '@hashgraph/sdk';
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
import { Client } from 'kosi-sdk';

export class Web3Impl implements Web3 {
private client: Client;
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

import { PrivateKey } from '@hashgraph/sdk';
import { PrivateKey } from 'kosi-sdk';
import constants from './lib/constants';
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
import crypto from 'crypto';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { expect } from 'chai';
import { ethers } from 'ethers';
import { v4 as uuid } from 'uuid';
import constants from '../src/lib/constants';
import { Hbar, HbarUnit } from '@hashgraph/sdk';
import { Hbar, HbarUnit } from 'kosi-sdk';
import { formatRequestIdMessage, numberTo0x, toHash32 } from '../src/formatters';
import { RedisInMemoryServer } from './redisInMemoryServer';
import { Logger } from 'pino';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/errors/SDKClientError.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

import { expect } from 'chai';
import { Status } from '@hashgraph/sdk';
import { Status } from 'kosi-sdk';
import { SDKClientError } from '../../../src/lib/errors/SDKClientError'; // Update the path to point to the SDKClientError file

describe('SDKClientError', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/eth/eth-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { EthAddressHbarSpendingPlanRepository } from '../../../src/lib/db/reposi
import { HbarSpendingPlanRepository } from '../../../src/lib/db/repositories/hbarLimiter/hbarSpendingPlanRepository';
import { IPAddressHbarSpendingPlanRepository } from '../../../src/lib/db/repositories/hbarLimiter/ipAddressHbarSpendingPlanRepository';
import { HbarLimitService } from '../../../src/lib/services/hbarLimitService';
import { Hbar } from '@hashgraph/sdk';
import { Hbar } from 'kosi-sdk';
import { CacheService } from '../../../src/lib/services/cacheService/cacheService';

export function contractResultsByNumberByIndexURL(number: number, index: number): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/eth/eth_call.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
} from '../../helpers';
import { generateEthTestEnv } from './eth-helpers';
import { IContractCallRequest, IContractCallResponse, RequestDetails } from '../../../src/lib/types';
import { ContractFunctionResult } from '@hashgraph/sdk';
import { ContractFunctionResult } from 'kosi-sdk';

use(chaiAsPromised);

Expand Down
3 changes: 2 additions & 1 deletion packages/relay/tests/lib/eth/eth_sendRawTransaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services'
import { expect, use } from 'chai';
import sinon from 'sinon';
import chaiAsPromised from 'chai-as-promised';
import { Hbar, HbarUnit, TransactionId, TransactionResponse } from '@hashgraph/sdk';
import { Hbar, HbarUnit, TransactionId, TransactionResponse } from 'kosi-sdk';

import { SDKClient } from '../../../src/lib/clients';
import { ACCOUNT_ADDRESS_1, DEFAULT_NETWORK_FEES, MAX_GAS_LIMIT_HEX, NO_TRANSACTIONS } from './eth-config';
import { JsonRpcError, predefined } from '../../../src';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/ethGetBlockBy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { EthImpl } from '../../src/lib/eth';
import { MirrorNodeClient } from '../../src/lib/clients/mirrorNodeClient';
import pino from 'pino';
import { EventEmitter } from 'events';
import { Hbar } from '@hashgraph/sdk';
import { Hbar } from 'kosi-sdk';
import constants from '../../src/lib/constants';
import { Log, Transaction } from '../../src/lib/model';
import HAPIService from '../../src/lib/services/hapiService/hapiService';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/hapiService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services'
import pino from 'pino';
import { expect } from 'chai';
import EventEmitter from 'events';
import { Client, Hbar } from '@hashgraph/sdk';
import { Client, Hbar } from 'kosi-sdk';
import constants from '../../src/lib/constants';
import { register, Registry } from 'prom-client';
import { SDKClient } from '../../src/lib/clients';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/openrpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import axios from 'axios';
import sinon from 'sinon';
import { expect } from 'chai';
import EventEmitter from 'events';
import { AccountInfo, Hbar } from '@hashgraph/sdk';
import MockAdapter from 'axios-mock-adapter';
import { AccountInfo, Hbar } from 'kosi-sdk';
import { BigNumber } from 'bignumber.js';
import { EthImpl } from '../../src/lib/eth';
import constants from '../../src/lib/constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/precheck.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
import { expect } from 'chai';
import { Registry } from 'prom-client';
import { Hbar, HbarUnit } from '@hashgraph/sdk';
import { Hbar, HbarUnit } from 'kosi-sdk';
import pino from 'pino';
import { Precheck } from '../../src/lib/precheck';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/tests/lib/sdkClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {
TransactionId,
TransactionRecordQuery,
TransactionResponse,
} from '@hashgraph/sdk';
} from 'kosi-sdk';
import { Context } from 'mocha';

const registry = new Registry();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
IPAddressHbarSpendingPlanNotFoundError,
} from '../../../../src/lib/db/types/hbarLimiter/errors';
import { RequestDetails } from '../../../../src/lib/types';
import { Hbar } from '@hashgraph/sdk';
import { Hbar } from 'kosi-sdk';
import { Long } from 'long';

chai.use(chaiAsPromised);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { MirrorNodeClient, SDKClient } from '../../../../src/lib/clients';
import { HbarLimitService } from '../../../../src/lib/services/hbarLimitService';
import MetricService from '../../../../src/lib/services/metricService/metricService';
import { CacheService } from '../../../../src/lib/services/cacheService/cacheService';
import { AccountId, Client, Hbar, Long, Status, TransactionRecord, TransactionRecordQuery } from '@hashgraph/sdk';
import { AccountId, Client, Hbar, Long, Status, TransactionRecord, TransactionRecordQuery } from 'kosi-sdk';
import { IExecuteQueryEventPayload, IExecuteTransactionEventPayload, RequestDetails } from '../../../../src/lib/types';
import { HbarSpendingPlanRepository } from '../../../../src/lib/db/repositories/hbarLimiter/hbarSpendingPlanRepository';
import { IPAddressHbarSpendingPlanRepository } from '../../../../src/lib/db/repositories/hbarLimiter/ipAddressHbarSpendingPlanRepository';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"koa-cors": "^0.0.16",
"koa-logger": "^3.2.1",
"koa-router": "^13.0.1",
"kosi-sdk": "1.0.1",
"pino": "^7.11.0",
"pino-pretty": "^7.6.1",
"uuid": "^3.3.2"
},
"devDependencies": {
"@hashgraph/sdk": "^2.50.0-beta.3",
"@koa/cors": "^5.0.0",
"@types/chai": "^4.3.0",
"@types/cors": "^2.8.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/acceptance/equivalence.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import { assert, expect } from 'chai';
import { Utils } from '../helpers/utils';
import ServicesClient from '../clients/servicesClient';
import { ContractFunctionParameters } from '@hashgraph/sdk';
import { ContractFunctionParameters } from 'kosi-sdk';
import EstimatePrecompileContractJson from '../contracts/EstimatePrecompileContract.json';
import Constants from '../helpers/constants';
import EquivalenceContractJson from '../contracts/EquivalenceContract.json';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// external resources
import { solidity } from 'ethereum-waffle';
import chai, { expect } from 'chai';
import { ContractId } from '@hashgraph/sdk';
import { ContractId } from 'kosi-sdk';
//Constants are imported with different definitions for better readability in the code.
import Constants from '../../helpers/constants';
import RelayCall from '../../helpers/constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/acceptance/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import app from '../../dist/server';
import { app as wsApp } from '@hashgraph/json-rpc-ws-server/dist/webSocketServer';

// Hashgraph SDK
import { AccountId, Hbar } from '@hashgraph/sdk';
import { AccountId, Hbar } from 'kosi-sdk';

// Constants
import constants from '@hashgraph/json-rpc-relay/dist/lib/constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/acceptance/rpc_batch1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { expect } from 'chai';
import { ethers } from 'ethers';
import { AliasAccount } from '../types/AliasAccount';
import { Utils } from '../helpers/utils';
import { FileInfo, FileInfoQuery, Hbar, TransferTransaction } from '@hashgraph/sdk';
import { FileInfo, FileInfoQuery, Hbar, TransferTransaction } from 'kosi-sdk';

// Assertions from local resources
import Assertions from '../helpers/assertions';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/acceptance/rpc_batch2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { Utils } from '../helpers/utils';
import { predefined } from '@hashgraph/json-rpc-relay/dist';
import { EthImpl } from '@hashgraph/json-rpc-relay/dist/lib/eth';
import { numberTo0x } from '@hashgraph/json-rpc-relay/dist/formatters';
import { ContractId, Hbar, HbarUnit } from '@hashgraph/sdk';
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
import { ContractId, Hbar, HbarUnit } from 'kosi-sdk';

// Assertions from local resources
import Assertions from '../helpers/assertions';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/acceptance/rpc_batch3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Axios from 'axios';
import chai, { expect } from 'chai';
import chaiExclude from 'chai-exclude';
import Constants from '@hashgraph/json-rpc-relay/dist/lib/constants';
import { ContractId } from '@hashgraph/sdk';
import { ContractId } from 'kosi-sdk';

// Assertions and constants from local resources
import Assertions from '../helpers/assertions';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/clients/servicesClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import {
TransactionId,
TransactionResponse,
TransferTransaction,
} from '@hashgraph/sdk';
} from 'kosi-sdk';
import { Logger } from 'pino';
import { ethers, JsonRpcProvider } from 'ethers';
import { Utils } from '../helpers/utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import crypto from 'crypto';
import RelayClient from '../clients/relayClient';
import { numberTo0x } from '@hashgraph/json-rpc-relay/dist/formatters';
import RelayCall from '../../tests/helpers/constants';
import { AccountId, KeyList, PrivateKey } from '@hashgraph/sdk';
import { AccountId, KeyList, PrivateKey } from 'kosi-sdk';
import { AliasAccount } from '../types/AliasAccount';
import ServicesClient from '../clients/servicesClient';
import http from 'http';
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tests/types/AliasAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

import { AccountId, KeyList, PrivateKey } from '@hashgraph/sdk';
import { AccountId, KeyList, PrivateKey } from 'kosi-sdk';
import ServicesClient from '../clients/servicesClient';
import { ethers } from 'ethers';

Expand Down
2 changes: 1 addition & 1 deletion packages/ws-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"pino-pretty": "^7.6.1"
},
"devDependencies": {
"@hashgraph/sdk": "^2.50.0-beta.3",
"@koa/cors": "^5.0.0",
"@types/chai": "^4.3.0",
"@types/cors": "^2.8.12",
Expand All @@ -34,6 +33,7 @@
"axios-retry": "^3.5.1",
"chai": "^4.3.6",
"ethers": "^6.7.0",
"kosi-sdk": "1.0.1",
"mocha": "^10.1.0",
"shelljs": "^0.8.5",
"ts-mocha": "^9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/ws-server/tests/acceptance/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import pino from 'pino';
import dotenv from 'dotenv';
import chaiAsPromised from 'chai-as-promised';
import fs from 'fs';
import { AccountId, Hbar } from '@hashgraph/sdk';
import { AccountId, Hbar } from 'kosi-sdk';
import app from '@hashgraph/json-rpc-server/dist/server';
import constants from '@hashgraph/json-rpc-relay/dist/lib/constants';
import RelayClient from '@hashgraph/json-rpc-server/tests/clients/relayClient';
Expand Down

0 comments on commit 913f577

Please sign in to comment.