Skip to content

Commit

Permalink
Update verbose logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Aug 10, 2023
1 parent 7b32cf1 commit bf691fb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ const tatum = await TatumSDK.init<Ethereum>({ network: Network.ETHEREUM })
tatum.destroy()
```

For more details, check out the [Get started documentation](https://docs.tatum.io/sdk/javascript-typescript-sdk).

### RPC Calls

To make RPC calls, use the available methods to interact with Ethereum blockchain. For example, to fetch the balance of a specific Ethereum address:
Expand Down
4 changes: 2 additions & 2 deletions src/connector/tatum.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class TatumConnector {
// Structure your log entry here
Utils.log({
id: this.id,
message: `Request & Response`,
message: `[${request.method}] ${url} -> ${res.status} (${end}ms)`,
data: {
request: {
method: request.method,
Expand Down Expand Up @@ -87,7 +87,7 @@ export class TatumConnector {
const end = Date.now() - start
Utils.log({
id: this.id,
message: `Error in Request & Response`,
message: `[${request.method}] ${url} -> (${end}ms)`,
data: {
request: {
method: request.method,
Expand Down
20 changes: 19 additions & 1 deletion src/e2e/rpc/tatum.rpc.ethereum.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Network } from '../../service'
import { BaseEvmClass, Network, RpcNodeType, TatumSDK } from '../../service'
import { EvmE2eUtils } from './evm.e2e.utils'

describe('Ethereum', () => {
Expand All @@ -9,4 +9,22 @@ describe('Ethereum', () => {
describe('sepolia', () => {
EvmE2eUtils.e2e({ network: Network.ETHEREUM_SEPOLIA, chainId: 11155111 })
})

it('custom rpc provider', async () => {
const tatum = await TatumSDK.init<BaseEvmClass>({
network: Network.ETHEREUM,
verbose: true,
rpc: {
nodes: [
{
url: 'https://mainnet.infura.io/v3/ab6162e91013410aa46123ef71b67da3',
type: RpcNodeType.NORMAL,
},
],
},
})
const { result } = await tatum.rpc.chainId()
expect(result?.toNumber()).toBe(1)
tatum.destroy()
})
})

0 comments on commit bf691fb

Please sign in to comment.