Skip to content

Commit

Permalink
update sdk, add example
Browse files Browse the repository at this point in the history
  • Loading branch information
zfy0701 committed Jul 9, 2023
1 parent f59bc80 commit 30f17be
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"type": "module",
"dependencies": {
"@sentio/sdk": "^2.22.0-rc.1",
"@sentio/sdk": "^2.22.0-rc.3",
"node-fetch": "^3.3.1"
},
"resolutions": {
Expand Down
23 changes: 16 additions & 7 deletions projects/global_test/src/processor.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestProcessorServer } from '@sentio/sdk/testing'
import { decodeMultiSig } from "@mysten/sui.js";
import { decodeMultiSig, builder, fromB64 } from "@mysten/sui.js";
import { TextDecoder, TextEncoder } from "util"

describe('Test Processor', () => {
Expand All @@ -19,13 +19,22 @@ describe('Test Processor', () => {

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

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

const tx2 = "AwIAguYciARZ7HUhAflUs4pgcvZ2TQm/rY92qx/fcP04q17Em9AI5gIIAYwLyJKl9uDx92nObXbTIhF06p5M7pxKBQCwVRJPbEzS7G+V5EERUq4o7MrOAkN+geXC/rce7IimJOqNXAVjJVSerjRiJcbZ3L2z2OEBt8Msscpx279T/WcLAwADAIrUbf0vQpkiMowwt2dootVDQmk62g3fFUX0jOX3RzaLAQAIC1rxNtEqxop8RmN1HN4HxE0fZbEWlohSwhUYSWZBHAEAbWF2ZW4AAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAgA="
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)
// const key = keys[0].pubKey.toBytes()
// // const new TextDecoder().decode(key)
// const buf = Buffer.from(key).toString("hex")
// console.log(buf)

const multisigs = builder.de('MultiSig', fromB64(tx2).slice(1));
const pkKeys = multisigs.multisig_pk.pk_map
const pbK = Buffer.from((pkKeys[pkKeys.length - 1].pubKey as any).ED25519).toString("hex")
console.log(pbK)





})
})
10 changes: 6 additions & 4 deletions projects/global_test/src/processor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as liquidswap from "./types/aptos/liquidswap.js";
import { AptosBaseProcessor, AptosModulesProcessor } from "@sentio/sdk/aptos";
import { AptosBaseProcessor, AptosModulesProcessor, AptosResourceProcessorTemplate } from "@sentio/sdk/aptos";
import { SuiAddressProcessorTemplate, SuiContext, SuiGlobalProcessor, SuiNetwork } from "@sentio/sdk/sui";
import { decodeMultiSig } from "@mysten/sui.js"
// import { SuiModulesProcessor } from "@sentio/sdk/sui";
Expand Down Expand Up @@ -52,6 +52,8 @@ const addrTemplate = new SuiAddressProcessorTemplate().onTimeInterval(async (_,
owned: false
})

function handlerEvent(address: string,ctx: SuiContext) {
addrTemplate.bind({ address}, ctx)
}
const resourceTemplate = new AptosResourceProcessorTemplate().onVersionInterval(
(resources, ctx) => {
//
}
)
2 changes: 1 addition & 1 deletion projects/multisig/src/processor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SuiGlobalProcessor, SuiNetwork } from '@sentio/sdk/sui';
import { Exporter } from '@sentio/sdk';

const MAVEN_PREFIX = '0x6d6176656e';
const MAVEN_PREFIX = '6d6176656e';
const ExecuteTransaction = Exporter.register('ExecuteTransaction', 'ExecuteTransaction');

SuiGlobalProcessor.bind({ network: SuiNetwork.TEST_NET, startCheckpoint: 4928686n }).onTransactionBlock(
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1278,24 +1278,24 @@
truffle-privatekey-provider "^1.5.0"
web3 "^1.3.0"

"@sentio/protos@2.22.0-rc.1":
version "2.22.0-rc.1"
resolved "https://registry.yarnpkg.com/@sentio/protos/-/protos-2.22.0-rc.1.tgz#b1ba813d74b82eb38ff73a673056cc43ca715804"
integrity sha512-2TA4/sLOXJSSyj/TGxZQsvXKDhM2lkx6w/2ci5O8we1gijWw5t/WGoiDCPbyu6cvRakGzYNoJnPmkmnmBrfMtw==
"@sentio/protos@2.22.0-rc.3":
version "2.22.0-rc.3"
resolved "https://registry.yarnpkg.com/@sentio/protos/-/protos-2.22.0-rc.3.tgz#0378814895bdcaca03c8e3f7d6e906dc4ebb241e"
integrity sha512-X62aC8chgcaGVF6kqAWZ4UT0PmzlXV2d9J/YZMSzOFEbLX/RocsixUcPA7VJNtIbChOZrUlL70+ecexG1RE+jg==
dependencies:
google-protobuf "^3.21.2"
long "^5.2.3"
nice-grpc "^2.1.0"
nice-grpc-common "^2.0.2"
protobufjs "^7.2.3"

"@sentio/runtime@^2.22.0-rc.1":
version "2.22.0-rc.1"
resolved "https://registry.yarnpkg.com/@sentio/runtime/-/runtime-2.22.0-rc.1.tgz#8bd2c682fe0f01e7a2097faeaf514cee30a07e3a"
integrity sha512-Fy1ud9yFPDeRUiPRkQPM5/eL9Eoge0F18ugsEwzan/iUMmazZflODGXDX/UrKQdb9pvU5w4nf/otzNhwsTkhKQ==
"@sentio/runtime@^2.22.0-rc.3":
version "2.22.0-rc.3"
resolved "https://registry.yarnpkg.com/@sentio/runtime/-/runtime-2.22.0-rc.3.tgz#44d8ed53c5200ae6574175ed2a48bda0ff0abf4c"
integrity sha512-XrANZagGbC+yKCt6bRNoMG1H5+1+05I5R5NgoQDS+Gh1uNFMOvp5xBh2rTbnyNk5srYRpmpF0K6ZBgehN4Mkcw==
dependencies:
"@grpc/grpc-js" "^1.8.14"
"@sentio/protos" "2.22.0-rc.1"
"@sentio/protos" "2.22.0-rc.3"
command-line-args "^5.2.1"
command-line-usage "^7.0.1"
fs-extra "^11.0.0"
Expand All @@ -1311,19 +1311,19 @@
utility-types "^3.10.0"
winston "^3.8.2"

"@sentio/sdk@^2.22.0-rc.1":
version "2.22.0-rc.1"
resolved "https://registry.yarnpkg.com/@sentio/sdk/-/sdk-2.22.0-rc.1.tgz#f125346360a41cf630143b926047c648fa9d7863"
integrity sha512-PA7JcVuok3G4ZYdK9+SoMwp9SEYuVL99pnbmn0/QNxqjHH0C/bIFI31Rgd1Y/tYO8oTr/51aalqnyxKEawieFg==
"@sentio/sdk@^2.22.0-rc.3":
version "2.22.0-rc.3"
resolved "https://registry.yarnpkg.com/@sentio/sdk/-/sdk-2.22.0-rc.3.tgz#c0a3f95ed66ebfe631b067e2a11b82ae12598173"
integrity sha512-xWGdm3KkqknoMYWMEIv7gYwyUfy7wJEAU+ODrgvFS4HKOBqm3o2DS952b3RqEJx+vuliebFL87hkOtyPES63PQ==
dependencies:
"@coral-xyz/borsh" "^0.28.0"
"@mysten/sui.js" "^0.36.0"
"@project-serum/anchor" "^0.26.0"
"@sentio/bigdecimal" "^9.1.1-patch.3"
"@sentio/chain" "^1.0.0"
"@sentio/ethers-v6" "^1.0.28"
"@sentio/protos" "2.22.0-rc.1"
"@sentio/runtime" "^2.22.0-rc.1"
"@sentio/protos" "2.22.0-rc.3"
"@sentio/runtime" "^2.22.0-rc.3"
"@solana/web3.js" "^1.74.0"
"@types/prettier" "^2.7.2"
aptos-sdk "npm:aptos@^1.10.0"
Expand Down

0 comments on commit 30f17be

Please sign in to comment.