@sentio/sdk 2.3.6-rc.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/aptos/tests/aptos.test.js.map +1 -1
- package/lib/eth/account-processor.d.ts +2 -2
- package/lib/eth/account-processor.js +2 -2
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/builtin/eacaggregatorproxy.d.ts +2 -2
- package/lib/eth/builtin/eacaggregatorproxy.js +2 -2
- package/lib/eth/builtin/eacaggregatorproxy.js.map +1 -1
- package/lib/eth/builtin/erc1155.d.ts +2 -2
- package/lib/eth/builtin/erc1155.js +2 -2
- package/lib/eth/builtin/erc1155.js.map +1 -1
- package/lib/eth/builtin/erc20.d.ts +2 -2
- package/lib/eth/builtin/erc20.js +2 -2
- package/lib/eth/builtin/erc20.js.map +1 -1
- package/lib/eth/builtin/erc20bytes.d.ts +2 -2
- package/lib/eth/builtin/erc20bytes.js +2 -2
- package/lib/eth/builtin/erc20bytes.js.map +1 -1
- package/lib/eth/builtin/erc721.d.ts +2 -2
- package/lib/eth/builtin/erc721.js +2 -2
- package/lib/eth/builtin/erc721.js.map +1 -1
- package/lib/eth/builtin/internal/{eacaggregatorproxy_processor.d.ts → eacaggregatorproxy-processor.d.ts} +0 -0
- package/lib/eth/builtin/internal/{eacaggregatorproxy_processor.js → eacaggregatorproxy-processor.js} +1 -1
- package/lib/eth/builtin/internal/{eacaggregatorproxy_processor.js.map → eacaggregatorproxy-processor.js.map} +1 -1
- package/lib/eth/builtin/internal/{eacaggregatorproxy_test-utils.d.ts → eacaggregatorproxy-test-utils.d.ts} +0 -0
- package/lib/eth/builtin/internal/{eacaggregatorproxy_test-utils.js → eacaggregatorproxy-test-utils.js} +2 -2
- package/lib/eth/builtin/internal/{eacaggregatorproxy_test-utils.js.map → eacaggregatorproxy-test-utils.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc1155_processor.d.ts → erc1155-processor.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc1155_processor.js → erc1155-processor.js} +1 -1
- package/lib/eth/builtin/internal/{erc1155_processor.js.map → erc1155-processor.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc1155_test-utils.d.ts → erc1155-test-utils.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc1155_test-utils.js → erc1155-test-utils.js} +2 -2
- package/lib/eth/builtin/internal/{erc1155_test-utils.js.map → erc1155-test-utils.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc20_processor.d.ts → erc20-processor.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc20_processor.js → erc20-processor.js} +1 -1
- package/lib/eth/builtin/internal/{erc20_processor.js.map → erc20-processor.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc20_test-utils.d.ts → erc20-test-utils.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc20_test-utils.js → erc20-test-utils.js} +2 -2
- package/lib/eth/builtin/internal/{erc20_test-utils.js.map → erc20-test-utils.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc20bytes_processor.d.ts → erc20bytes-processor.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc20bytes_processor.js → erc20bytes-processor.js} +1 -1
- package/lib/eth/builtin/internal/{erc20bytes_processor.js.map → erc20bytes-processor.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc20bytes_test-utils.d.ts → erc20bytes-test-utils.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc20bytes_test-utils.js → erc20bytes-test-utils.js} +2 -2
- package/lib/eth/builtin/internal/{erc20bytes_test-utils.js.map → erc20bytes-test-utils.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc721_processor.d.ts → erc721-processor.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc721_processor.js → erc721-processor.js} +1 -1
- package/lib/eth/builtin/internal/{erc721_processor.js.map → erc721-processor.js.map} +1 -1
- package/lib/eth/builtin/internal/{erc721_test-utils.d.ts → erc721-test-utils.d.ts} +0 -0
- package/lib/eth/builtin/internal/{erc721_test-utils.js → erc721-test-utils.js} +2 -2
- package/lib/eth/builtin/internal/{erc721_test-utils.js.map → erc721-test-utils.js.map} +1 -1
- package/lib/eth/builtin/internal/{weth9_processor.d.ts → weth9-processor.d.ts} +0 -0
- package/lib/eth/builtin/internal/{weth9_processor.js → weth9-processor.js} +1 -1
- package/lib/eth/builtin/internal/{weth9_processor.js.map → weth9-processor.js.map} +1 -1
- package/lib/eth/builtin/internal/{weth9_test-utils.d.ts → weth9-test-utils.d.ts} +0 -0
- package/lib/eth/builtin/internal/{weth9_test-utils.js → weth9-test-utils.js} +2 -2
- package/lib/eth/builtin/internal/{weth9_test-utils.js.map → weth9-test-utils.js.map} +1 -1
- package/lib/eth/builtin/weth9.d.ts +2 -2
- package/lib/eth/builtin/weth9.js +2 -2
- package/lib/eth/builtin/weth9.js.map +1 -1
- package/lib/eth/codegen/ethers-sentio.js +2 -2
- package/lib/eth/codegen/ethers-sentio.js.map +1 -1
- package/lib/eth/codegen/file.js +3 -3
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/generic-processor.test.js.map +1 -1
- package/lib/eth/tests/account.test.d.ts +1 -0
- package/lib/eth/tests/account.test.js.map +1 -0
- package/lib/eth/tests/codegen.test.d.ts +1 -0
- package/lib/eth/tests/codegen.test.js.map +1 -0
- package/lib/eth/tests/erc20-template.test.d.ts +1 -0
- package/lib/eth/tests/erc20-template.test.js.map +1 -0
- package/lib/eth/tests/erc20.d.ts +1 -0
- package/lib/eth/tests/erc20.js +52 -0
- package/lib/eth/tests/erc20.js.map +1 -0
- package/lib/eth/tests/erc20.test.d.ts +1 -0
- package/lib/eth/tests/erc20.test.js.map +1 -0
- package/lib/eth/tests/error-capture.test.d.ts +1 -0
- package/lib/eth/tests/error-capture.test.js.map +1 -0
- package/lib/eth/tests/logger.test.d.ts +1 -0
- package/lib/eth/tests/logger.test.js.map +1 -0
- package/lib/eth/tests/types/anyswaprouter.d.ts +3 -0
- package/lib/eth/tests/types/anyswaprouter.js +7 -0
- package/lib/eth/tests/types/anyswaprouter.js.map +1 -0
- package/lib/eth/tests/types/commitmentpool.d.ts +3 -0
- package/lib/eth/tests/types/commitmentpool.js +7 -0
- package/lib/eth/tests/types/commitmentpool.js.map +1 -0
- package/lib/eth/tests/types/index.d.ts +12 -0
- package/lib/eth/tests/types/index.js +16 -0
- package/lib/eth/tests/types/index.js.map +1 -0
- package/lib/eth/tests/types/internal/AnyswapRouter.d.ts +122 -0
- package/lib/eth/tests/types/internal/AnyswapRouter.js +2 -0
- package/lib/eth/tests/types/internal/AnyswapRouter.js.map +1 -0
- package/lib/eth/tests/types/internal/CommitmentPool.d.ts +176 -0
- package/lib/eth/tests/types/internal/CommitmentPool.js +2 -0
- package/lib/eth/tests/types/internal/CommitmentPool.js.map +1 -0
- package/lib/eth/tests/types/internal/MembershipStakerV3.d.ts +81 -0
- package/lib/eth/tests/types/internal/MembershipStakerV3.js +2 -0
- package/lib/eth/tests/types/internal/MembershipStakerV3.js.map +1 -0
- package/lib/eth/tests/types/internal/Pyth.d.ts +204 -0
- package/lib/eth/tests/types/internal/Pyth.js +2 -0
- package/lib/eth/tests/types/internal/Pyth.js.map +1 -0
- package/lib/eth/tests/types/internal/Seaport.d.ts +350 -0
- package/lib/eth/tests/types/internal/Seaport.js +2 -0
- package/lib/eth/tests/types/internal/Seaport.js.map +1 -0
- package/lib/eth/tests/types/internal/TokenExchange.d.ts +128 -0
- package/lib/eth/tests/types/internal/TokenExchange.js +2 -0
- package/lib/eth/tests/types/internal/TokenExchange.js.map +1 -0
- package/lib/eth/tests/types/internal/anyswaprouter-processor.d.ts +463 -0
- package/lib/eth/tests/types/internal/anyswaprouter-processor.js +425 -0
- package/lib/eth/tests/types/internal/anyswaprouter-processor.js.map +1 -0
- package/lib/eth/tests/types/internal/anyswaprouter-test-utils.d.ts +9 -0
- package/lib/eth/tests/types/internal/anyswaprouter-test-utils.js +124 -0
- package/lib/eth/tests/types/internal/anyswaprouter-test-utils.js.map +1 -0
- package/lib/eth/tests/types/internal/commitmentpool-processor.d.ts +348 -0
- package/lib/eth/tests/types/internal/commitmentpool-processor.js +607 -0
- package/lib/eth/tests/types/internal/commitmentpool-processor.js.map +1 -0
- package/lib/eth/tests/types/internal/commitmentpool-test-utils.d.ts +9 -0
- package/lib/eth/tests/types/internal/commitmentpool-test-utils.js +87 -0
- package/lib/eth/tests/types/internal/commitmentpool-test-utils.js.map +1 -0
- package/lib/eth/tests/types/internal/common.d.ts +10 -0
- package/lib/eth/tests/types/internal/common.js +8 -0
- package/lib/eth/tests/types/internal/common.js.map +1 -0
- package/lib/eth/tests/types/internal/factories/AnyswapRouter__factory.d.ts +988 -0
- package/lib/eth/tests/types/internal/factories/AnyswapRouter__factory.js +1269 -0
- package/lib/eth/tests/types/internal/factories/AnyswapRouter__factory.js.map +1 -0
- package/lib/eth/tests/types/internal/factories/CommitmentPool__factory.d.ts +792 -0
- package/lib/eth/tests/types/internal/factories/CommitmentPool__factory.js +1040 -0
- package/lib/eth/tests/types/internal/factories/CommitmentPool__factory.js.map +1 -0
- package/lib/eth/tests/types/internal/factories/MembershipStakerV3__factory.d.ts +549 -0
- package/lib/eth/tests/types/internal/factories/MembershipStakerV3__factory.js +721 -0
- package/lib/eth/tests/types/internal/factories/MembershipStakerV3__factory.js.map +1 -0
- package/lib/eth/tests/types/internal/factories/Pyth__factory.d.ts +1130 -0
- package/lib/eth/tests/types/internal/factories/Pyth__factory.js +1486 -0
- package/lib/eth/tests/types/internal/factories/Pyth__factory.js.map +1 -0
- package/lib/eth/tests/types/internal/factories/Seaport__factory.d.ts +2018 -0
- package/lib/eth/tests/types/internal/factories/Seaport__factory.js +2610 -0
- package/lib/eth/tests/types/internal/factories/Seaport__factory.js.map +1 -0
- package/lib/eth/tests/types/internal/factories/TokenExchange__factory.d.ts +651 -0
- package/lib/eth/tests/types/internal/factories/TokenExchange__factory.js +853 -0
- package/lib/eth/tests/types/internal/factories/TokenExchange__factory.js.map +1 -0
- package/lib/eth/tests/types/internal/factories/index.d.ts +6 -0
- package/lib/eth/tests/types/internal/factories/index.js +10 -0
- package/lib/eth/tests/types/internal/factories/index.js.map +1 -0
- package/lib/eth/tests/types/internal/index.d.ts +13 -0
- package/lib/eth/tests/types/internal/index.js +8 -0
- package/lib/eth/tests/types/internal/index.js.map +1 -0
- package/lib/eth/tests/types/internal/membershipstakerv3-processor.d.ts +287 -0
- package/lib/eth/tests/types/internal/membershipstakerv3-processor.js +596 -0
- package/lib/eth/tests/types/internal/membershipstakerv3-processor.js.map +1 -0
- package/lib/eth/tests/types/internal/membershipstakerv3-test-utils.d.ts +11 -0
- package/lib/eth/tests/types/internal/membershipstakerv3-test-utils.js +109 -0
- package/lib/eth/tests/types/internal/membershipstakerv3-test-utils.js.map +1 -0
- package/lib/eth/tests/types/internal/pyth-processor.d.ts +422 -0
- package/lib/eth/tests/types/internal/pyth-processor.js +890 -0
- package/lib/eth/tests/types/internal/pyth-processor.js.map +1 -0
- package/lib/eth/tests/types/internal/pyth-test-utils.d.ts +13 -0
- package/lib/eth/tests/types/internal/pyth-test-utils.js +131 -0
- package/lib/eth/tests/types/internal/pyth-test-utils.js.map +1 -0
- package/lib/eth/tests/types/internal/seaport-processor.d.ts +211 -0
- package/lib/eth/tests/types/internal/seaport-processor.js +237 -0
- package/lib/eth/tests/types/internal/seaport-processor.js.map +1 -0
- package/lib/eth/tests/types/internal/seaport-test-utils.d.ts +6 -0
- package/lib/eth/tests/types/internal/seaport-test-utils.js +61 -0
- package/lib/eth/tests/types/internal/seaport-test-utils.js.map +1 -0
- package/lib/eth/tests/types/internal/tokenexchange-processor.d.ts +334 -0
- package/lib/eth/tests/types/internal/tokenexchange-processor.js +667 -0
- package/lib/eth/tests/types/internal/tokenexchange-processor.js.map +1 -0
- package/lib/eth/tests/types/internal/tokenexchange-test-utils.d.ts +13 -0
- package/lib/eth/tests/types/internal/tokenexchange-test-utils.js +149 -0
- package/lib/eth/tests/types/internal/tokenexchange-test-utils.js.map +1 -0
- package/lib/eth/tests/types/membershipstakerv3.d.ts +3 -0
- package/lib/eth/tests/types/membershipstakerv3.js +7 -0
- package/lib/eth/tests/types/membershipstakerv3.js.map +1 -0
- package/lib/eth/tests/types/pyth.d.ts +3 -0
- package/lib/eth/tests/types/pyth.js +7 -0
- package/lib/eth/tests/types/pyth.js.map +1 -0
- package/lib/eth/tests/types/seaport.d.ts +3 -0
- package/lib/eth/tests/types/seaport.js +7 -0
- package/lib/eth/tests/types/seaport.js.map +1 -0
- package/lib/eth/tests/types/tokenexchange.d.ts +3 -0
- package/lib/eth/tests/types/tokenexchange.js +7 -0
- package/lib/eth/tests/types/tokenexchange.js.map +1 -0
- package/lib/solana/builtin/types.d.ts +8 -8
- package/lib/solana/tests/solana.test.js.map +1 -1
- package/lib/sui/sui-processor.js +2 -8
- package/lib/sui/sui-processor.js.map +1 -1
- package/lib/sui/tests/sui.test.js.map +1 -1
- package/lib/sui/utils.d.ts +2 -0
- package/lib/sui/utils.js +11 -0
- package/lib/sui/utils.js.map +1 -0
- package/lib/testing/aptos-facet.d.ts +12 -0
- package/lib/testing/aptos-facet.js +91 -0
- package/lib/testing/aptos-facet.js.map +1 -0
- package/lib/testing/eth-facet.d.ts +27 -0
- package/lib/testing/eth-facet.js +211 -0
- package/lib/testing/eth-facet.js.map +1 -0
- package/lib/testing/solana-facet.d.ts +7 -0
- package/lib/testing/solana-facet.js +22 -0
- package/lib/testing/solana-facet.js.map +1 -0
- package/lib/testing/sui-facet.d.ts +12 -0
- package/lib/testing/sui-facet.js +103 -0
- package/lib/testing/sui-facet.js.map +1 -0
- package/lib/testing/test-processor-server.d.ts +9 -23
- package/lib/testing/test-processor-server.js +13 -227
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/dex-price.js +1 -1
- package/lib/utils/dex-price.js.map +1 -1
- package/lib/utils/token.js +1 -1
- package/lib/utils/token.js.map +1 -1
- package/package.json +5 -5
- package/src/eth/account-processor.ts +2 -5
- package/src/eth/builtin/eacaggregatorproxy.ts +2 -2
- package/src/eth/builtin/erc1155.ts +2 -2
- package/src/eth/builtin/erc20.ts +2 -2
- package/src/eth/builtin/erc20bytes.ts +2 -2
- package/src/eth/builtin/erc721.ts +2 -2
- package/src/eth/builtin/internal/{eacaggregatorproxy_processor.ts → eacaggregatorproxy-processor.ts} +0 -0
- package/src/eth/builtin/internal/{eacaggregatorproxy_test-utils.ts → eacaggregatorproxy-test-utils.ts} +1 -1
- package/src/eth/builtin/internal/{erc1155_processor.ts → erc1155-processor.ts} +0 -0
- package/src/eth/builtin/internal/{erc1155_test-utils.ts → erc1155-test-utils.ts} +1 -1
- package/src/eth/builtin/internal/{erc20_processor.ts → erc20-processor.ts} +0 -0
- package/src/eth/builtin/internal/{erc20_test-utils.ts → erc20-test-utils.ts} +1 -1
- package/src/eth/builtin/internal/{erc20bytes_processor.ts → erc20bytes-processor.ts} +0 -0
- package/src/eth/builtin/internal/{erc20bytes_test-utils.ts → erc20bytes-test-utils.ts} +1 -1
- package/src/eth/builtin/internal/{erc721_processor.ts → erc721-processor.ts} +0 -0
- package/src/eth/builtin/internal/{erc721_test-utils.ts → erc721-test-utils.ts} +1 -1
- package/src/eth/builtin/internal/{weth9_processor.ts → weth9-processor.ts} +0 -0
- package/src/eth/builtin/internal/{weth9_test-utils.ts → weth9-test-utils.ts} +1 -1
- package/src/eth/builtin/weth9.ts +2 -2
- package/src/eth/codegen/ethers-sentio.ts +2 -2
- package/src/eth/codegen/file.ts +3 -3
- package/src/eth/tests/abis/eth/CommitmentPool.json +1034 -0
- package/src/eth/tests/abis/eth/MembershipStakerV3.json +706 -0
- package/src/eth/tests/abis/eth/Pyth.json +1471 -0
- package/src/eth/tests/abis/eth/Seaport.json +2595 -0
- package/src/eth/tests/abis/eth/TokenExchange.json +838 -0
- package/src/eth/tests/abis/eth/anyswapRouter.json +490 -0
- package/src/eth/tests/erc20.ts +63 -0
- package/src/eth/tests/types/anyswaprouter.ts +7 -0
- package/src/eth/tests/types/commitmentpool.ts +7 -0
- package/src/eth/tests/types/index.ts +33 -0
- package/src/eth/tests/types/internal/AnyswapRouter.ts +122 -0
- package/src/eth/tests/types/internal/CommitmentPool.ts +208 -0
- package/src/eth/tests/types/internal/MembershipStakerV3.ts +108 -0
- package/src/eth/tests/types/internal/Pyth.ts +246 -0
- package/src/eth/tests/types/internal/Seaport.ts +389 -0
- package/src/eth/tests/types/internal/TokenExchange.ts +142 -0
- package/src/eth/tests/types/internal/anyswaprouter-processor.ts +1396 -0
- package/src/eth/tests/types/internal/anyswaprouter-test-utils.ts +187 -0
- package/src/eth/tests/types/internal/commitmentpool-processor.ts +1575 -0
- package/src/eth/tests/types/internal/commitmentpool-test-utils.ts +150 -0
- package/src/eth/tests/types/internal/common.ts +23 -0
- package/src/eth/tests/types/internal/factories/AnyswapRouter__factory.ts +1278 -0
- package/src/eth/tests/types/internal/factories/CommitmentPool__factory.ts +1049 -0
- package/src/eth/tests/types/internal/factories/MembershipStakerV3__factory.ts +730 -0
- package/src/eth/tests/types/internal/factories/Pyth__factory.ts +1492 -0
- package/src/eth/tests/types/internal/factories/Seaport__factory.ts +2616 -0
- package/src/eth/tests/types/internal/factories/TokenExchange__factory.ts +862 -0
- package/src/eth/tests/types/internal/factories/index.ts +9 -0
- package/src/eth/tests/types/internal/index.ts +16 -0
- package/src/eth/tests/types/internal/membershipstakerv3-processor.ts +1399 -0
- package/src/eth/tests/types/internal/membershipstakerv3-test-utils.ts +188 -0
- package/src/eth/tests/types/internal/pyth-processor.ts +2043 -0
- package/src/eth/tests/types/internal/pyth-test-utils.ts +226 -0
- package/src/eth/tests/types/internal/seaport-processor.ts +678 -0
- package/src/eth/tests/types/internal/seaport-test-utils.ts +100 -0
- package/src/eth/tests/types/internal/tokenexchange-processor.ts +1570 -0
- package/src/eth/tests/types/internal/tokenexchange-test-utils.ts +244 -0
- package/src/eth/tests/types/membershipstakerv3.ts +7 -0
- package/src/eth/tests/types/pyth.ts +7 -0
- package/src/eth/tests/types/seaport.ts +7 -0
- package/src/eth/tests/types/tokenexchange.ts +7 -0
- package/src/sui/sui-processor.ts +2 -7
- package/src/sui/utils.ts +11 -0
- package/src/testing/aptos-facet.ts +111 -0
- package/src/testing/eth-facet.ts +233 -0
- package/src/testing/solana-facet.ts +25 -0
- package/src/testing/sui-facet.ts +119 -0
- package/src/testing/test-processor-server.ts +15 -252
- package/src/utils/dex-price.ts +1 -1
- package/src/utils/token.ts +1 -3
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { DataBinding, HandlerType } from '@sentio/protos'
|
|
2
|
+
import { getChainId } from '../sui/network.js'
|
|
3
|
+
import { TestProcessorServer } from './test-processor-server.js'
|
|
4
|
+
import { parseMoveType } from '../aptos/types.js'
|
|
5
|
+
import { SuiNetwork } from '../sui/index.js'
|
|
6
|
+
import { MoveEvent, SuiTransactionResponse, MoveCall } from '@mysten/sui.js'
|
|
7
|
+
import { getMoveCalls } from '../sui/utils.js'
|
|
8
|
+
|
|
9
|
+
export class SuiFacet {
|
|
10
|
+
server: TestProcessorServer
|
|
11
|
+
constructor(server: TestProcessorServer) {
|
|
12
|
+
this.server = server
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
testEntryFunctionCall(transaction: SuiTransactionResponse, network: SuiNetwork = SuiNetwork.MAIN_NET) {
|
|
16
|
+
return this.testEntryFunctionCalls([transaction], network)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
testEntryFunctionCalls(transactions: SuiTransactionResponse[], network: SuiNetwork = SuiNetwork.MAIN_NET) {
|
|
20
|
+
const bindings = []
|
|
21
|
+
for (const trans of transactions) {
|
|
22
|
+
const binding = this.buildEntryFunctionCallBinding(trans, network)
|
|
23
|
+
if (!binding) {
|
|
24
|
+
throw Error('Invalid test transaction: ' + JSON.stringify(trans))
|
|
25
|
+
}
|
|
26
|
+
bindings.push(binding)
|
|
27
|
+
}
|
|
28
|
+
return this.server.processBindings({
|
|
29
|
+
bindings: bindings,
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private buildEntryFunctionCallBinding(
|
|
34
|
+
transaction: SuiTransactionResponse,
|
|
35
|
+
network: SuiNetwork = SuiNetwork.MAIN_NET
|
|
36
|
+
): DataBinding | undefined {
|
|
37
|
+
const calls: MoveCall[] = getMoveCalls(transaction)
|
|
38
|
+
if (calls.length !== 1) {
|
|
39
|
+
throw Error('Transaction has more than one calls')
|
|
40
|
+
}
|
|
41
|
+
const functionType = calls[0].package.objectId + calls[0].module + calls[0].function
|
|
42
|
+
|
|
43
|
+
for (const config of this.server.contractConfigs) {
|
|
44
|
+
if (config.contract?.chainId !== getChainId(network)) {
|
|
45
|
+
continue
|
|
46
|
+
}
|
|
47
|
+
for (const callConfig of config.moveCallConfigs) {
|
|
48
|
+
for (const callFilter of callConfig.filters) {
|
|
49
|
+
if (config.contract.address + '::' + callFilter.function === functionType) {
|
|
50
|
+
return {
|
|
51
|
+
data: {
|
|
52
|
+
suiCall: {
|
|
53
|
+
transaction,
|
|
54
|
+
timestamp: new Date(),
|
|
55
|
+
slot: 10000n,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
handlerIds: [callConfig.handlerId],
|
|
59
|
+
handlerType: HandlerType.SUI_CALL,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return undefined
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
testEvent(transaction: SuiTransactionResponse, event: number | MoveEvent, network: SuiNetwork = SuiNetwork.MAIN_NET) {
|
|
69
|
+
if (typeof event !== 'number') {
|
|
70
|
+
const transaction2: SuiTransactionResponse = {} as any
|
|
71
|
+
Object.assign(transaction2, transaction)
|
|
72
|
+
transaction = transaction2
|
|
73
|
+
transaction.effects.events = [event]
|
|
74
|
+
event = 0
|
|
75
|
+
}
|
|
76
|
+
const binding = this.buildEventBinding(transaction, event, network)
|
|
77
|
+
if (!binding) {
|
|
78
|
+
throw Error('Invalid test event: ' + JSON.stringify(transaction))
|
|
79
|
+
}
|
|
80
|
+
return this.server.processBinding(binding)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private buildEventBinding(
|
|
84
|
+
transaction: SuiTransactionResponse,
|
|
85
|
+
eventIdx: number,
|
|
86
|
+
network: SuiNetwork = SuiNetwork.MAIN_NET
|
|
87
|
+
): DataBinding | undefined {
|
|
88
|
+
// const allEvents = new Set(transaction.events.map(e => e.type))
|
|
89
|
+
const event = transaction.effects.events?.[eventIdx]
|
|
90
|
+
if (!event || !event.moveEvent) {
|
|
91
|
+
throw Error('Invaild test transaction, no event located')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
for (const config of this.server.contractConfigs) {
|
|
95
|
+
if (config.contract?.chainId !== getChainId(network)) {
|
|
96
|
+
continue
|
|
97
|
+
}
|
|
98
|
+
for (const eventConfig of config.moveEventConfigs) {
|
|
99
|
+
for (const eventFilter of eventConfig.filters) {
|
|
100
|
+
if (config.contract.address + '::' + eventFilter.type === parseMoveType(event.moveEvent.type).qname) {
|
|
101
|
+
transaction.effects.events = [event]
|
|
102
|
+
return {
|
|
103
|
+
data: {
|
|
104
|
+
suiEvent: {
|
|
105
|
+
transaction,
|
|
106
|
+
timestamp: new Date(transaction.timestamp_ms || 0),
|
|
107
|
+
slot: 10000n,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
handlerIds: [eventConfig.handlerId],
|
|
111
|
+
handlerType: HandlerType.SUI_EVENT,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return undefined
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -2,30 +2,27 @@ import {
|
|
|
2
2
|
AccountConfig,
|
|
3
3
|
ContractConfig,
|
|
4
4
|
DataBinding,
|
|
5
|
-
|
|
6
|
-
Data_SolInstruction,
|
|
5
|
+
Empty,
|
|
7
6
|
ProcessBindingResponse,
|
|
8
7
|
ProcessBindingsRequest,
|
|
9
8
|
ProcessConfigRequest,
|
|
10
9
|
ProcessConfigResponse,
|
|
11
10
|
ProcessorServiceImplementation,
|
|
12
11
|
StartRequest,
|
|
13
|
-
Empty,
|
|
14
12
|
} from '@sentio/protos'
|
|
15
13
|
import { CallContext } from 'nice-grpc-common'
|
|
16
|
-
import {
|
|
14
|
+
import { Endpoints, ProcessorServiceImpl, State } from '@sentio/runtime'
|
|
17
15
|
import { CHAIN_MAP } from '../core/chain.js'
|
|
18
16
|
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
import {
|
|
17
|
+
import { AptosFacet } from './aptos-facet.js'
|
|
18
|
+
import { SolanaFacet } from './solana-facet.js'
|
|
19
|
+
import { EthFacet } from './eth-facet.js'
|
|
20
|
+
import { SuiFacet } from './sui-facet.js'
|
|
23
21
|
|
|
24
22
|
export const TEST_CONTEXT: CallContext = <CallContext>{}
|
|
25
23
|
|
|
26
24
|
export function cleanTest() {
|
|
27
25
|
State.reset()
|
|
28
|
-
// Endpoints.reset()
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
@@ -33,10 +30,19 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
33
30
|
contractConfigs: ContractConfig[]
|
|
34
31
|
accountConfigs: AccountConfig[]
|
|
35
32
|
|
|
33
|
+
aptos: AptosFacet
|
|
34
|
+
eth: EthFacet
|
|
35
|
+
solana: SolanaFacet
|
|
36
|
+
sui: SuiFacet
|
|
37
|
+
|
|
36
38
|
constructor(loader: () => Promise<any>, httpEndpoints: Record<string, string> = {}) {
|
|
37
39
|
cleanTest()
|
|
38
40
|
|
|
39
41
|
this.service = new ProcessorServiceImpl(loader)
|
|
42
|
+
this.aptos = new AptosFacet(this)
|
|
43
|
+
this.solana = new SolanaFacet(this)
|
|
44
|
+
this.eth = new EthFacet(this)
|
|
45
|
+
this.sui = new SuiFacet(this)
|
|
40
46
|
|
|
41
47
|
for (const k in CHAIN_MAP) {
|
|
42
48
|
const http = httpEndpoints[k] || ''
|
|
@@ -60,249 +66,6 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
60
66
|
return this.service.getConfig(request, context)
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
// processLogs(request: ProcessBindingsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
64
|
-
// return this.service.processLogs(request, context)
|
|
65
|
-
// }
|
|
66
|
-
//
|
|
67
|
-
// processTraces(request: ProcessBindingsRequest, context: CallContext = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
68
|
-
// return this.service.processTraces(request, context)
|
|
69
|
-
// }
|
|
70
|
-
|
|
71
|
-
testTrace(trace: Trace, network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
72
|
-
return this.testTraces([trace], network)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
testTraces(traces: Trace[], network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
76
|
-
const bindings = []
|
|
77
|
-
for (const trace of traces) {
|
|
78
|
-
const binding = this.buildTraceBinding(trace, network)
|
|
79
|
-
if (!binding) {
|
|
80
|
-
throw Error('Invalid test trace: ' + JSON.stringify(trace))
|
|
81
|
-
}
|
|
82
|
-
bindings.push(binding)
|
|
83
|
-
}
|
|
84
|
-
return this.processBindings({
|
|
85
|
-
bindings: bindings,
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
buildTraceBinding(trace: Trace, network: Networkish = 1): DataBinding | undefined {
|
|
90
|
-
if (trace.type !== 'call' || !trace.action.input) {
|
|
91
|
-
throw Error('Invalid test trace: ' + JSON.stringify(trace))
|
|
92
|
-
}
|
|
93
|
-
const signature = trace.action.input.slice(0, 10)
|
|
94
|
-
|
|
95
|
-
for (const contract of this.contractConfigs) {
|
|
96
|
-
if (contract.contract?.chainId !== Network.from(network).chainId.toString()) {
|
|
97
|
-
continue
|
|
98
|
-
}
|
|
99
|
-
if (trace.action.to?.toLowerCase() !== contract.contract?.address.toLowerCase()) {
|
|
100
|
-
continue
|
|
101
|
-
}
|
|
102
|
-
for (const config of contract.traceConfigs) {
|
|
103
|
-
if (config.signature == signature) {
|
|
104
|
-
return {
|
|
105
|
-
data: {
|
|
106
|
-
ethTrace: {
|
|
107
|
-
trace,
|
|
108
|
-
timestamp: new Date(),
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
handlerIds: [config.handlerId],
|
|
112
|
-
handlerType: HandlerType.ETH_TRACE,
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return undefined
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
testLog(log: LogParams, network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
121
|
-
return this.testLogs([log], network)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
testLogs(logs: LogParams[], network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
125
|
-
const bindings = []
|
|
126
|
-
for (const log of logs) {
|
|
127
|
-
const binding = this.buildLogBinding(log, network)
|
|
128
|
-
if (!binding) {
|
|
129
|
-
throw Error('Invalid test log: ' + JSON.stringify(log))
|
|
130
|
-
}
|
|
131
|
-
bindings.push(binding)
|
|
132
|
-
}
|
|
133
|
-
return this.processBindings({
|
|
134
|
-
bindings: bindings,
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
buildLogBinding(log: LogParams, network: Networkish = 1): DataBinding | undefined {
|
|
139
|
-
for (const contract of this.contractConfigs) {
|
|
140
|
-
if (contract.contract?.chainId !== Network.from(network).chainId.toString()) {
|
|
141
|
-
continue
|
|
142
|
-
}
|
|
143
|
-
if (log.address.toLowerCase() !== contract.contract?.address.toLowerCase()) {
|
|
144
|
-
continue
|
|
145
|
-
}
|
|
146
|
-
for (const config of contract.logConfigs) {
|
|
147
|
-
for (const filter of config.filters) {
|
|
148
|
-
// if (filter.topics.length != log.topics.length) {
|
|
149
|
-
// continue
|
|
150
|
-
// }
|
|
151
|
-
|
|
152
|
-
let match = true
|
|
153
|
-
for (const topicIdx in filter.topics) {
|
|
154
|
-
const logTopic = log.topics[topicIdx]
|
|
155
|
-
const possibleTopic = filter.topics[topicIdx].hashes
|
|
156
|
-
if (possibleTopic.length === 0) {
|
|
157
|
-
// match all
|
|
158
|
-
continue
|
|
159
|
-
}
|
|
160
|
-
if (possibleTopic.find((e) => e.toLowerCase() === logTopic.toLowerCase())) {
|
|
161
|
-
// find one
|
|
162
|
-
continue
|
|
163
|
-
}
|
|
164
|
-
match = false
|
|
165
|
-
break
|
|
166
|
-
}
|
|
167
|
-
if (match) {
|
|
168
|
-
return {
|
|
169
|
-
data: {
|
|
170
|
-
ethLog: { log, timestamp: new Date() },
|
|
171
|
-
},
|
|
172
|
-
handlerIds: [config.handlerId],
|
|
173
|
-
handlerType: HandlerType.ETH_LOG,
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return undefined
|
|
180
|
-
}
|
|
181
|
-
testAccountLog(address: string, log: LogParams, network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
182
|
-
return this.testAccountLogs(address, [log], network)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
testAccountLogs(address: string, logs: LogParams[], network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
186
|
-
const bindings = []
|
|
187
|
-
for (const log of logs) {
|
|
188
|
-
const binding = this.buildAccountLogBinding(address, log, network)
|
|
189
|
-
if (!binding) {
|
|
190
|
-
throw Error('Invalid test log: ' + JSON.stringify(log))
|
|
191
|
-
}
|
|
192
|
-
bindings.push(binding)
|
|
193
|
-
}
|
|
194
|
-
return this.processBindings({
|
|
195
|
-
bindings: bindings,
|
|
196
|
-
})
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
buildAccountLogBinding(address: string, log: LogParams, network: Networkish = 1): DataBinding | undefined {
|
|
200
|
-
for (const account of this.accountConfigs) {
|
|
201
|
-
if (account.chainId !== Network.from(network).chainId.toString()) {
|
|
202
|
-
continue
|
|
203
|
-
}
|
|
204
|
-
if (address.toLowerCase() !== account.address.toLowerCase()) {
|
|
205
|
-
continue
|
|
206
|
-
}
|
|
207
|
-
for (const config of account.logConfigs) {
|
|
208
|
-
for (const filter of config.filters) {
|
|
209
|
-
// if (filter.topics.length != log.topics.length) {
|
|
210
|
-
// continue
|
|
211
|
-
// }
|
|
212
|
-
|
|
213
|
-
let match = true
|
|
214
|
-
for (const topicIdx in filter.topics) {
|
|
215
|
-
const logTopic = log.topics[topicIdx]
|
|
216
|
-
const possibleTopic = filter.topics[topicIdx].hashes
|
|
217
|
-
if (possibleTopic.length === 0) {
|
|
218
|
-
// match all
|
|
219
|
-
continue
|
|
220
|
-
}
|
|
221
|
-
if (possibleTopic.find((e) => e.toLowerCase() === logTopic.toLowerCase())) {
|
|
222
|
-
// find one
|
|
223
|
-
continue
|
|
224
|
-
}
|
|
225
|
-
match = false
|
|
226
|
-
break
|
|
227
|
-
}
|
|
228
|
-
if (match) {
|
|
229
|
-
return {
|
|
230
|
-
data: {
|
|
231
|
-
ethLog: { log, timestamp: new Date() },
|
|
232
|
-
},
|
|
233
|
-
handlerIds: [config.handlerId],
|
|
234
|
-
handlerType: HandlerType.ETH_LOG,
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return undefined
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
testBlock(
|
|
244
|
-
block: Partial<BlockParams> & { number: number },
|
|
245
|
-
network: Networkish = 1
|
|
246
|
-
): Promise<ProcessBindingResponse> {
|
|
247
|
-
return this.testBlocks([block], network)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
testBlocks(blocks: Partial<BlockParams> & { number: number }[], network: Networkish = 1) {
|
|
251
|
-
const bindings = []
|
|
252
|
-
for (const block of blocks) {
|
|
253
|
-
const binding = this.buildBlockBinding(block, network)
|
|
254
|
-
if (!binding) {
|
|
255
|
-
throw Error('Invalid test block: ' + JSON.stringify(block))
|
|
256
|
-
}
|
|
257
|
-
bindings.push(binding)
|
|
258
|
-
}
|
|
259
|
-
return this.processBindings({
|
|
260
|
-
bindings: bindings,
|
|
261
|
-
})
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1): DataBinding {
|
|
265
|
-
const binding: DataBinding = {
|
|
266
|
-
data: {
|
|
267
|
-
ethBlock: { block },
|
|
268
|
-
},
|
|
269
|
-
handlerType: HandlerType.ETH_BLOCK,
|
|
270
|
-
handlerIds: [],
|
|
271
|
-
}
|
|
272
|
-
for (const contract of this.contractConfigs) {
|
|
273
|
-
if (contract.contract?.chainId !== Network.from(network).chainId.toString()) {
|
|
274
|
-
continue
|
|
275
|
-
}
|
|
276
|
-
const longBlockNumber = block.number
|
|
277
|
-
if (longBlockNumber < contract.startBlock) {
|
|
278
|
-
continue
|
|
279
|
-
}
|
|
280
|
-
if (contract.endBlock !== 0n && longBlockNumber >= contract.endBlock) {
|
|
281
|
-
continue
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
for (const config of contract.intervalConfigs) {
|
|
285
|
-
binding.handlerIds.push(config.handlerId)
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return binding
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
testInstructions(instructions: Data_SolInstruction[]): Promise<ProcessBindingResponse> {
|
|
292
|
-
return this.processBindings({
|
|
293
|
-
bindings: instructions.map((instruction) => {
|
|
294
|
-
return {
|
|
295
|
-
data: {
|
|
296
|
-
raw: new Uint8Array(),
|
|
297
|
-
solInstruction: instruction,
|
|
298
|
-
},
|
|
299
|
-
handlerIds: [],
|
|
300
|
-
handlerType: HandlerType.SOL_INSTRUCTION,
|
|
301
|
-
}
|
|
302
|
-
}),
|
|
303
|
-
})
|
|
304
|
-
}
|
|
305
|
-
|
|
306
69
|
processBindings(
|
|
307
70
|
request: ProcessBindingsRequest,
|
|
308
71
|
context: CallContext = TEST_CONTEXT
|
package/src/utils/dex-price.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getEACAggregatorProxyContract } from '../eth/builtin/
|
|
1
|
+
import { getEACAggregatorProxyContract } from '../eth/builtin/eacaggregatorproxy.js'
|
|
2
2
|
import fs from 'fs'
|
|
3
3
|
import { parse } from 'csv-parse/sync'
|
|
4
4
|
import { BlockTag } from 'ethers/providers'
|
package/src/utils/token.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { getERC20Contract } from '../eth/builtin/erc20.js'
|
|
2
|
-
import { getERC20BytesContract } from '../eth/builtin/
|
|
2
|
+
import { getERC20BytesContract } from '../eth/builtin/erc20bytes.js'
|
|
3
3
|
import { BigDecimal, scaleDown } from '../core/big-decimal.js'
|
|
4
|
-
// import { toBigDecimal } from './conversion'
|
|
5
|
-
// import { utils } from 'ethers'
|
|
6
4
|
import { PromiseOrValue } from '../eth/builtin/internal/common.js'
|
|
7
5
|
import { decodeBytes32String } from 'ethers'
|
|
8
6
|
|