Skip to content

Commit

Permalink
feat(sdk): migrate to ethers-js6, cleanup deps (#BREAKING CHANGE ) (#316
Browse files Browse the repository at this point in the history
)
  • Loading branch information
zfy0701 authored Feb 1, 2023
1 parent 2084825 commit b57184f
Show file tree
Hide file tree
Showing 94 changed files with 1,357 additions and 989 deletions.
1 change: 1 addition & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ignore:
- .git
- .idea
- .github
- tsconfig.mjs.json
- docs
- node_modules
- packages/cli/node_modules
Expand Down
6 changes: 3 additions & 3 deletions examples/aptos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"cli": "ts-node --files src/cli.ts"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development",
"@sentio/sdk-aptos": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development",
"@sentio/sdk-aptos": "^2.0.0-development"
},
"devDependencies": {
"@sentio/cli": "^1.0.0-development"
"@sentio/cli": "^2.0.0-development"
}
}
2 changes: 1 addition & 1 deletion examples/aptos/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.mjs.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
Expand Down
6 changes: 3 additions & 3 deletions examples/aurory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"build_all": "yarn lerna run --scope=@sentio-example/aurory build --include-dependencies"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development",
"@sentio/sdk-solana": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development",
"@sentio/sdk-solana": "^2.0.0-development"
},
"devDependencies": {
"@sentio/cli": "^1.0.0-development"
"@sentio/cli": "^2.0.0-development"
}
}
4 changes: 2 additions & 2 deletions examples/sui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"build_all": "yarn lerna run --scope=@sentio-example/sui build --include-dependencies"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development"
},
"devDependencies": {
"@sentio/cli": "^1.0.0-development"
"@sentio/cli": "^2.0.0-development"
}
}
2 changes: 1 addition & 1 deletion examples/sui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.mjs.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
Expand Down
6 changes: 3 additions & 3 deletions examples/wormhole/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"build_all": "yarn lerna run --scope=@sentio-example/wormhole build --include-dependencies"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development",
"@sentio/sdk-solana": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development",
"@sentio/sdk-solana": "^2.0.0-development"
},
"devDependencies": {
"@sentio/cli": "^1.0.0-development"
"@sentio/cli": "^2.0.0-development"
}
}
10 changes: 5 additions & 5 deletions examples/wormhole/src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const transferFilters = [

WETH9Processor.bind({ address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', startBlock: 13217349 })
.onEventDeposit(async function (event, ctx) {
const amount = Number(event.args.wad.toBigInt()) / Math.pow(10, 18)
const amount = Number(event.args.wad) / Math.pow(10, 18)
ctx.meter.Counter('token_bridge_weth').add(amount)
}, depositFilter)
.onEventWithdrawal(async function (event, ctx) {
const amount = Number(event.args.wad.toBigInt()) / Math.pow(10, 18)
const amount = Number(event.args.wad) / Math.pow(10, 18)
ctx.meter.Counter('token_bridge_weth').sub(amount)
}, withdrawalFilter)
.onEventTransfer(async function (event, ctx) {
const amount = Number(event.args.wad.toBigInt()) / Math.pow(10, 18)
const amount = Number(event.args.wad) / Math.pow(10, 18)

if (event.args.src == TOKEN_BRIDGE_ADDRESS) {
ctx.meter.Counter('token_bridge_weth').sub(amount)
Expand All @@ -32,7 +32,7 @@ WETH9Processor.bind({ address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', sta

WETH9Processor.bind({ address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', startBlock: 13217349 }).onBlock(
async function (_, ctx: WETH9Context) {
const balance = (await ctx.contract.balanceOf(TOKEN_BRIDGE_ADDRESS)).toBigInt()
const balance = await ctx.contract.balanceOf(TOKEN_BRIDGE_ADDRESS)
ctx.meter.Gauge('balance').record(balance)
}
)
Expand All @@ -42,7 +42,7 @@ WETH9Processor.bind({
startBlock: 13217349,
endBlock: 14500000,
}).onBlock(async function (_, ctx: WETH9Context) {
const balance = (await ctx.contract.balanceOf(TOKEN_BRIDGE_ADDRESS)).toBigInt()
const balance = await ctx.contract.balanceOf(TOKEN_BRIDGE_ADDRESS)
ctx.meter.Gauge('balance_end').record(balance)
})

Expand Down
2 changes: 1 addition & 1 deletion examples/wormhole/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.mjs.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
Expand Down
4 changes: 2 additions & 2 deletions examples/x2y2-complex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"build_all": "yarn lerna run --scope=@sentio-example/x2y2-complex build --include-dependencies"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development"
},
"devDependencies": {
"@sentio/cli": "^1.0.0-development",
"@sentio/cli": "^2.0.0-development",
"ts-node": "^10.8.0"
}
}
2 changes: 1 addition & 1 deletion examples/x2y2-complex/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.mjs.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
Expand Down
4 changes: 2 additions & 2 deletions examples/x2y2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"build_all": "yarn lerna run --scope=@sentio-example/x2y2 build --include-dependencies"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development"
},
"devDependencies": {
"@sentio/cli": "^1.0.0-development",
"@sentio/cli": "^2.0.0-development",
"ts-node": "^10.8.0"
}
}
2 changes: 1 addition & 1 deletion examples/x2y2/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.mjs.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"typedoc": "^0.23.23",
"typescript": "^4.9.0"
},
"resolutions": {
"ethers": "npm:@sentio/[email protected]"
},
"scripts": {
"format": "prettier --write .",
"lint": "ls-lint && eslint .",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@sentio/cli",
"license": "Apache-2.0",
"private": true,
"version": "1.0.0-development",
"version": "2.0.0-development",
"scripts": {
"compile": "tsc -p . && cp src/webpack.config.js lib/",
"build": "yarn compile",
Expand Down Expand Up @@ -31,7 +31,7 @@
"@types/command-line-usage": "^5.0.2",
"@types/expect": "^24.3.0",
"@types/express": "^4.17.14",
"@types/fs-extra": "^9.0.13",
"@types/fs-extra": "^11.0.1",
"@types/js-yaml": "^4.0.5",
"@types/node": "^18.0.4",
"@types/node-fetch": "^2.6.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/aptos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"upload": "sentio upload"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development",
"@sentio/sdk-aptos": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development",
"@sentio/sdk-aptos": "^2.0.0-development"
},
"devDependencies": {
"@types/jest": "^29.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/aptos/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"module": "commonjs",
"moduleResolution": "node",
"module": "esnext",
"moduleResolution": "node16",
"strictNullChecks": true,
"stripInternal": true,
"noFallthroughCasesInSwitch": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/templates/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"upload": "sentio upload"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development"
},
"devDependencies": {
"@types/jest": "^29.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/templates/evm/src/processor.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { TestProcessorServer, firstCounterValue } from '@sentio/sdk/lib/testing'
import { mockTransferLog } from '@sentio/sdk/lib/builtin/erc20/test-utils'
import { BigNumber } from 'ethers'

describe('Test Processor', () => {
const service = new TestProcessorServer(() => require('./processor'))
Expand All @@ -19,7 +18,7 @@ describe('Test Processor', () => {
mockTransferLog('0x1e4ede388cbc9f4b5c79681b7f94d36a11abebc9', {
from: '0x0000000000000000000000000000000000000000',
to: '0xb329e39ebefd16f40d38f07643652ce17ca5bac1',
value: BigNumber.from(10n ** 18n * 10n),
value: 10n ** 18n * 10n,
})
)

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/evm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"module": "commonjs",
"moduleResolution": "node",
"module": "esnext",
"moduleResolution": "node16",
"strictNullChecks": true,
"stripInternal": true,
"noFallthroughCasesInSwitch": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/templates/raw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"upload": "sentio upload"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development"
},
"devDependencies": {
"@types/jest": "^29.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/raw/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"module": "commonjs",
"moduleResolution": "node",
"module": "esnext",
"moduleResolution": "node16",
"strictNullChecks": true,
"stripInternal": true,
"noFallthroughCasesInSwitch": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"upload": "sentio upload"
},
"dependencies": {
"@sentio/sdk": "^1.0.0-development",
"@sentio/sdk-solana": "^1.0.0-development"
"@sentio/sdk": "^2.0.0-development",
"@sentio/sdk-solana": "^2.0.0-development"
},
"devDependencies": {
"@types/jest": "^29.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/templates/solana/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"module": "commonjs",
"moduleResolution": "node",
"module": "esnext",
"moduleResolution": "node16",
"strictNullChecks": true,
"stripInternal": true,
"noFallthroughCasesInSwitch": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/protos/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sentio/protos",
"license": "Apache-2.0",
"version": "1.0.0-development",
"version": "2.0.0-development",
"scripts": {
"compile": "tsc -p .",
"clean": "tsc --build --clean",
Expand Down
38 changes: 0 additions & 38 deletions packages/runtime/chains-config.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
{
"1": {
"ChainID": "1",
"Https": [
"https://mainnet.infura.io/v3/6d3fecb13dea4c6086e1984b4a520fd0",
"https://mainnet.infura.io/v3/226c57463e9247bdaf7c402aa42fd259",
"https://mainnet.infura.io/v3/b27d64c4cb6343389f5a01a52dce19ab",
"https://mainnet.infura.io/v3/e55d25edf30f44e1ab6c09111d44bc49",
"https://mainnet.infura.io/v3/86922264d8de4635bbcc0c286cc18e76",
"https://mainnet.infura.io/v3/7b62d78dcf314d758318af8efc2046b1"
],
"WebSockets": [
"wss://mainnet.infura.io/ws/v3/6d3fecb13dea4c6086e1984b4a520fd0",
"wss://mainnet.infura.io/ws/v3/226c57463e9247bdaf7c402aa42fd259",
"wss://mainnet.infura.io/ws/v3/b27d64c4cb6343389f5a01a52dce19ab",
"wss://mainnet.infura.io/ws/v3/e55d25edf30f44e1ab6c09111d44bc49",
"wss://mainnet.infura.io/ws/v3/86922264d8de4635bbcc0c286cc18e76",
"wss://mainnet.infura.io/ws/v3/7b62d78dcf314d758318af8efc2046b1"
],
"ChainServer": "",
"BatchSize": 2000,
"ReorgThresholdBlocks": 30,
Expand All @@ -25,14 +9,6 @@
},
"3": {
"ChainID": "3",
"Https": [
"https://ropsten.infura.io/v3/1e2099a68b354e6db3649b9e75fe17b9",
"https://ropsten.infura.io/v3/ec4bc1d370134f06a05dc7ffc735d8f5"
],
"WebSockets": [
"wss://ropsten.infura.io/ws/v3/1e2099a68b354e6db3649b9e75fe17b9",
"wss://ropsten.infura.io/ws/v3/ec4bc1d370134f06a05dc7ffc735d8f5"
],
"ChainServer": "",
"BatchSize": 2000,
"ReorgThresholdBlocks": 300,
Expand All @@ -41,16 +17,6 @@
},
"56": {
"ChainID": "56",
"Https": [
"https://winter-withered-feather.bsc.discover.quiknode.pro/09cdc3b22506509b3fc49cb52448419d5e302ea1/",
"https://red-wandering-tree.bsc.discover.quiknode.pro/88d316a3d174489011af3c9cb3dd940fdff7880b/",
"https://morning-fragrant-silence.bsc.discover.quiknode.pro/7c6d4b06289c2dbaadce00f3b0a465d48c3f0753/"
],
"WebSockets": [
"wss://winter-withered-feather.bsc.discover.quiknode.pro/09cdc3b22506509b3fc49cb52448419d5e302ea1/",
"wss://red-wandering-tree.bsc.discover.quiknode.pro/88d316a3d174489011af3c9cb3dd940fdff7880b/",
"wss://morning-fragrant-silence.bsc.discover.quiknode.pro/7c6d4b06289c2dbaadce00f3b0a465d48c3f0753/"
],
"ChainServer": "",
"BatchSize": 2000,
"ReorgThresholdBlocks": 30,
Expand All @@ -59,10 +25,6 @@
},
"SOL_mainnet": {
"ChainID": "SOL_mainnet",
"Https": [
"https://solana-mainnet.g.alchemy.com/v2/AIM3Qp8rkxBoAjRCNeazPaNKdjYgLdzc",
"https://try-rpc.mainnet.solana.blockdaemon.tech"
],
"WebSockets": [],
"ChainServer": "",
"BatchSize": 10000,
Expand Down
8 changes: 3 additions & 5 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sentio/runtime",
"license": "Apache-2.0",
"version": "1.0.0-development",
"version": "2.0.0-development",
"scripts": {
"compile": "tsc -p .",
"build": "yarn compile",
Expand All @@ -11,11 +11,9 @@
"run-benchmark": "ts-node --files src/decode-benchmark.ts"
},
"dependencies": {
"@sentio/protos": "^1.0.0-development",
"@ethersproject/providers": "~5.7.0",
"@sentio/protos": "^2.0.0-development",
"command-line-args": "^5.2.1",
"command-line-usage": "^6.1.3",
"ethers": "~5.7.1",
"fs-extra": "^11.0.0",
"google-protobuf": "^3.15.8",
"nice-grpc": "^2.0.0",
Expand All @@ -29,7 +27,7 @@
"@types/command-line-args": "^5.2.0",
"@types/command-line-usage": "^5.0.2",
"@types/expect": "^24.3.0",
"@types/fs-extra": "^9.0.13",
"@types/fs-extra": "^11.0.1",
"@types/google-protobuf": "^3.15.6",
"@types/node": "^18.0.4"
},
Expand Down
Loading

0 comments on commit b57184f

Please sign in to comment.