Skip to content

Commit

Permalink
update sdk, add test sui global processor
Browse files Browse the repository at this point in the history
  • Loading branch information
zfy0701 committed Jun 17, 2023
1 parent 2b535ac commit f41677a
Show file tree
Hide file tree
Showing 71 changed files with 971 additions and 1,046 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
],
"type": "module",
"dependencies": {
"@sentio/sdk": "^2.18.3",
"@sentio/sdk": "^2.19.0-rc.4",
"node-fetch": "^3.3.1"
},
"resolutions": {
"ethers": "npm:@sentio/ethers@6.3.0-patch.4"
"ethers": "npm:@sentio/ethers@6.6.0"
},
"devDependencies": {
"@sentio/cli": "^2.9.0",
Expand All @@ -20,4 +20,4 @@
"scripts": {
"new": "yarn sentio create -p -d projects"
}
}
}
5 changes: 2 additions & 3 deletions projects/1inch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
5 changes: 2 additions & 3 deletions projects/aave/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
2 changes: 1 addition & 1 deletion projects/algebra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
6 changes: 1 addition & 5 deletions projects/aptos-overview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
"test": "jest",
"build": "sentio build"
},
"devDependencies": {
},
"type": "module",
"dependencies": {
}
"type": "module"
}
5 changes: 2 additions & 3 deletions projects/aptos-webhook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
2 changes: 1 addition & 1 deletion projects/argo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"devDependencies": {
"typescript": "^5.0.3"
}
}
}
5 changes: 2 additions & 3 deletions projects/arthswap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
5 changes: 2 additions & 3 deletions projects/astar-webhook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
6 changes: 1 addition & 5 deletions projects/aux-exchange/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
"test": "jest",
"build": "sentio build"
},
"devDependencies": {
},
"type": "module",
"dependencies": {
}
"type": "module"
}
5 changes: 2 additions & 3 deletions projects/balancer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
5 changes: 2 additions & 3 deletions projects/bancor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
5 changes: 2 additions & 3 deletions projects/baseNFT/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
5 changes: 2 additions & 3 deletions projects/bend-dao/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
9 changes: 1 addition & 8 deletions projects/bluemove-dex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {
"@sentio/sdk": "^2.15.5"
},
"devDependencies": {
"@sentio/cli": "^2.8.1",
"typescript": "^5.0.3"
}
}
}
2 changes: 1 addition & 1 deletion projects/bluemove-nft-sui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
2 changes: 1 addition & 1 deletion projects/blur/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
2 changes: 1 addition & 1 deletion projects/cetus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"devDependencies": {
"typescript": "^5.0.3"
}
}
}
2 changes: 1 addition & 1 deletion projects/clutchy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
5 changes: 2 additions & 3 deletions projects/compound/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
5 changes: 2 additions & 3 deletions projects/convex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
2 changes: 1 addition & 1 deletion projects/curve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
2 changes: 1 addition & 1 deletion projects/deri/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
5 changes: 2 additions & 3 deletions projects/ebisusbay-cronos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
6 changes: 1 addition & 5 deletions projects/econia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
"test": "jest",
"build": "sentio build"
},
"devDependencies": {
},
"type": "module",
"dependencies": {
}
"type": "module"
}
2 changes: 1 addition & 1 deletion projects/espresso/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"postinstall": "sentio gen"
},
"type": "module"
}
}
2 changes: 1 addition & 1 deletion projects/eth-mev-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
2 changes: 1 addition & 1 deletion projects/ferro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
5 changes: 2 additions & 3 deletions projects/frax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
2 changes: 1 addition & 1 deletion projects/fulcrom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
2 changes: 1 addition & 1 deletion projects/global_test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"upload": "sentio upload",
"postinstall": "sentio gen"
}
}
}
17 changes: 17 additions & 0 deletions projects/global_test/src/processor.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { TestProcessorServer } from '@sentio/sdk/testing'
import { decodeMultiSig } from "@mysten/sui.js";
import { TextDecoder, TextEncoder } from "util"

describe('Test Processor', () => {
const service = new TestProcessorServer(() => import('./processor.js'))

// const txSig = 'AwUAG3RvCWmw0F7VmCsDgVMYUCcggRmh8D5lyJo2BKU+LFJgfbHi4eIY+PmjmX1yaOZTemUJ8ENrCcqbZ0moqgSGDQCp1dK8FW7pSn7ZW8l0F8O8QCI3xbIrD3PNu6XHNd2GXjfO60ndCCOAillFoDJGRzA7QLD4CfQhJfRuMbbUwq0DACRG8vZPGMIQqRDaKv2uCyLNGamGUh3/5pLarLHrVeHdrx21Fq4Y/GQsPTJ0mAhu1E3IeFzWXG9nKWSzU8YU6QwACQD4umqxoOjBVNDEF9CVjYqMGItKkxvavtn3fcTLCPZ79fUHB3IpRAp3HD7PcORyDbQzFOXAr3KZO79hNT0fAwAuE+CvzKiCVZhxWOBucKUI6EEF6FM2NWAC17Ob8iWGMjDoaytdmX06aBdjoaLnUKvT8sPdH7zUQvckNepBoOwBGjowAAABAAAAAAAEABAAAAAAAAEAAgADAAQABSxBRVN4Y3pxKzlKbFBodnZVVVB4NTk4R2tubGtQSDYxSW41cGJQeklwU29RTgEsQU1CdEg0QTdyd0pwejUwRVZXSk1MbENpNk5nRUNBNDdwS0k5amUzN0ZmcWgBLEFFUDhWU0JWeUloR01Pa0tWUUIyUnpGczgxUTdOeWQ3ZXdtZTZsTzBJSFppASxBRWJrNS9XY2tEeno2ZTJoZHF2Wll4YjUxVXk5K3VvNStKSmZ2WTgwaVNLMgEsQUhLTEZhMnphKzFDQUgyNXdhbTBGNkNIaHdwQnhyNFcwWWZwQVBvdldWTEoBAwA='


beforeAll(async () => {
await service.start()
})
Expand All @@ -11,4 +16,16 @@ describe('Test Processor', () => {
const config = await service.getConfig({})
expect(config.contractConfigs.length > 0)
})

const txSig = 'AwUAG3RvCWmw0F7VmCsDgVMYUCcggRmh8D5lyJo2BKU+LFJgfbHi4eIY+PmjmX1yaOZTemUJ8ENrCcqbZ0moqgSGDQCp1dK8FW7pSn7ZW8l0F8O8QCI3xbIrD3PNu6XHNd2GXjfO60ndCCOAillFoDJGRzA7QLD4CfQhJfRuMbbUwq0DACRG8vZPGMIQqRDaKv2uCyLNGamGUh3/5pLarLHrVeHdrx21Fq4Y/GQsPTJ0mAhu1E3IeFzWXG9nKWSzU8YU6QwACQD4umqxoOjBVNDEF9CVjYqMGItKkxvavtn3fcTLCPZ79fUHB3IpRAp3HD7PcORyDbQzFOXAr3KZO79hNT0fAwAuE+CvzKiCVZhxWOBucKUI6EEF6FM2NWAC17Ob8iWGMjDoaytdmX06aBdjoaLnUKvT8sPdH7zUQvckNepBoOwBGjowAAABAAAAAAAEABAAAAAAAAEAAgADAAQABSxBRVN4Y3pxKzlKbFBodnZVVVB4NTk4R2tubGtQSDYxSW41cGJQeklwU29RTgEsQU1CdEg0QTdyd0pwejUwRVZXSk1MbENpNk5nRUNBNDdwS0k5amUzN0ZmcWgBLEFFUDhWU0JWeUloR01Pa0tWUUIyUnpGczgxUTdOeWQ3ZXdtZTZsTzBJSFppASxBRWJrNS9XY2tEeno2ZTJoZHF2Wll4YjUxVXk5K3VvNStKSmZ2WTgwaVNLMgEsQUhLTEZhMnphKzFDQUgyNXdhbTBGNkNIaHdwQnhyNFcwWWZwQVBvdldWTEoBAwA='

const tx2 = 'AwIAvlJnUP0iJFZL+QTxkKC9FHZGwCa5I4TITHS/QDQ12q1sYW6SMt2Yp3PSNzsAay0Fp2MPVohqyyA02UtdQ2RNAQGH0eLk4ifl9h1I8Uc+4QlRYfJC21dUbP8aFaaRqiM/f32TKKg/4PSsGf9lFTGwKsHJYIMkDoqKwI8Xqr+3apQzAwADAFriILSy9l6XfBLt5hV5/1FwtsIsAGFow3tefGGvAYCDAQECHRUjB8a3Kw7QQYsOcM2A5/UpW42G9XItP1IT+9I5TzYCADtqJ7zOtqQtYqOo0CpvDXNlMhV3HeJDpjrASKGLWdopAwMA'

test('test multisign', async () => {
const keys = decodeMultiSig(tx2)
const key = keys[0].pubKey.toBytes()
// const new TextDecoder().decode(key)
const buf = Buffer.from(key).toString("hex")
console.log(buf)
})
})
25 changes: 25 additions & 0 deletions projects/global_test/src/processor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import * as liquidswap from "./types/aptos/liquidswap.js";
import { AptosBaseProcessor, AptosModulesProcessor } from "@sentio/sdk/aptos";
import { SuiGlobalProcessor, SuiNetwork } from "@sentio/sdk/sui";
import { decodeMultiSig } from "@mysten/sui.js"
// import { SuiModulesProcessor } from "@sentio/sdk/sui";

for (const s of [liquidswap.scripts_v3, liquidswap.scripts_v2, liquidswap.scripts,
liquidswap.liquidity_pool, liquidswap.dao_storage, liquidswap.global_config, liquidswap.lp_account]) {
Expand All @@ -18,3 +21,25 @@ new AptosBaseProcessor("", { address })
// TODO make this work, the number should be larger than "manual" for a bit
AptosModulesProcessor.bind({address})
.onTransaction((tx, ctx) => { ctx.meter.Counter("auto_2").add(1) })

// SuiModulesProcessor.bind({ address: '0x1be2df58d54d20d336886ef2c34d11c1d3ba194d53beb955318b8f6350acdb86', startCheckpoint: 1603788n })
// .onTransactionBlock((tx, ctx) => {
// ctx.eventLogger("transaction", {})
// })

SuiGlobalProcessor.bind({ network: SuiNetwork.MAIN_NET, startCheckpoint: 1603788n })
.onTransactionBlock((tx, ctx) => {
const txSig = tx.transaction?.txSignatures[0]
if (txSig) {
const sigs = decodeMultiSig(txSig)
ctx.eventLogger.emit("multisig", {
message: txSig
})

} else {
console.log("No sig found")
}
},
{
publicKeyPrefix: "0x5ae220b4b2f65e977c12ede61579ff5170b6c22c006168c37b5e7c61af018083"
})
5 changes: 2 additions & 3 deletions projects/gmx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
2 changes: 1 addition & 1 deletion projects/gro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"postinstall": "sentio gen"
},
"type": "module"
}
}
6 changes: 1 addition & 5 deletions projects/hippo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
"test": "jest",
"build": "sentio build"
},
"devDependencies": {
},
"type": "module",
"dependencies": {
}
"type": "module"
}
5 changes: 2 additions & 3 deletions projects/kana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"build": "sentio build",
"upload": "sentio upload",
"postinstall": "sentio gen"
},
"dependencies": {}
}
}
}
Loading

0 comments on commit f41677a

Please sign in to comment.