@sentio/sdk 2.57.12-rc.j → 2.57.13-rc.1
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/core/template.d.ts +1 -5
- package/lib/core/template.d.ts.map +1 -1
- package/lib/core/template.js +1 -4
- package/lib/core/template.js.map +1 -1
- package/lib/store/store.d.ts +2 -2
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js.map +1 -1
- package/package.json +3 -3
- package/src/core/template.ts +1 -6
- package/src/store/store.ts +2 -3
- package/lib/chunk-2F2KNF4Z.js +0 -71905
- package/lib/chunk-2F2KNF4Z.js.map +0 -1
- package/lib/chunk-43HP4DQZ.js +0 -47
- package/lib/chunk-43HP4DQZ.js.map +0 -1
- package/lib/chunk-4HPFNKDX.js +0 -6763
- package/lib/chunk-4HPFNKDX.js.map +0 -1
- package/lib/chunk-4OCWUYSJ.js +0 -898
- package/lib/chunk-4OCWUYSJ.js.map +0 -1
- package/lib/chunk-6UVWNOIX.js +0 -4207
- package/lib/chunk-6UVWNOIX.js.map +0 -1
- package/lib/chunk-73SHERGU.js +0 -23970
- package/lib/chunk-73SHERGU.js.map +0 -1
- package/lib/chunk-742S42NO.js +0 -1323
- package/lib/chunk-742S42NO.js.map +0 -1
- package/lib/chunk-7ECRTQD7.js +0 -26757
- package/lib/chunk-7ECRTQD7.js.map +0 -1
- package/lib/chunk-7IDGS56O.js +0 -5058
- package/lib/chunk-7IDGS56O.js.map +0 -1
- package/lib/chunk-7S6WQ4RL.js +0 -1069
- package/lib/chunk-7S6WQ4RL.js.map +0 -1
- package/lib/chunk-AZFMPZRN.js +0 -3613
- package/lib/chunk-AZFMPZRN.js.map +0 -1
- package/lib/chunk-BZCXYTDE.js +0 -1333
- package/lib/chunk-BZCXYTDE.js.map +0 -1
- package/lib/chunk-E2DS6WZF.js +0 -1690
- package/lib/chunk-E2DS6WZF.js.map +0 -1
- package/lib/chunk-GE6BRIGS.js +0 -1721
- package/lib/chunk-GE6BRIGS.js.map +0 -1
- package/lib/chunk-J3I3VNTV.js +0 -767
- package/lib/chunk-J3I3VNTV.js.map +0 -1
- package/lib/chunk-J3QOJ2RV.js +0 -661
- package/lib/chunk-J3QOJ2RV.js.map +0 -1
- package/lib/chunk-J5UEW4B7.js +0 -1351
- package/lib/chunk-J5UEW4B7.js.map +0 -1
- package/lib/chunk-LPSNAS2G.js +0 -460
- package/lib/chunk-LPSNAS2G.js.map +0 -1
- package/lib/chunk-LR232ZJV.js +0 -2593
- package/lib/chunk-LR232ZJV.js.map +0 -1
- package/lib/chunk-N36N7RXJ.js +0 -653
- package/lib/chunk-N36N7RXJ.js.map +0 -1
- package/lib/chunk-OJG2VJ5T.js +0 -7063
- package/lib/chunk-OJG2VJ5T.js.map +0 -1
- package/lib/chunk-ONBEMKI5.js +0 -323
- package/lib/chunk-ONBEMKI5.js.map +0 -1
- package/lib/chunk-PVX2LIM5.js +0 -205
- package/lib/chunk-PVX2LIM5.js.map +0 -1
- package/lib/chunk-R7PMHHKJ.js +0 -52
- package/lib/chunk-R7PMHHKJ.js.map +0 -1
- package/lib/chunk-RMT2JEWA.js +0 -7740
- package/lib/chunk-RMT2JEWA.js.map +0 -1
- package/lib/chunk-S6MJ3KIL.js +0 -27798
- package/lib/chunk-S6MJ3KIL.js.map +0 -1
- package/lib/chunk-UEFVZL4I.js +0 -199
- package/lib/chunk-UEFVZL4I.js.map +0 -1
- package/lib/chunk-UIBPOKNT.js +0 -945
- package/lib/chunk-UIBPOKNT.js.map +0 -1
- package/lib/chunk-ZR7UHHH2.js +0 -5
- package/lib/chunk-ZR7UHHH2.js.map +0 -1
- package/lib/multipart-parser-SQIYSR67.js +0 -368
- package/lib/multipart-parser-SQIYSR67.js.map +0 -1
- package/src/aptos/builtin/0x1.d.ts +0 -6451
- package/src/aptos/builtin/0x1.d.ts.map +0 -1
- package/src/aptos/builtin/0x1.js +0 -7138
- package/src/aptos/builtin/0x1.js.map +0 -1
- package/src/aptos/builtin/0x3.d.ts +0 -1122
- package/src/aptos/builtin/0x3.d.ts.map +0 -1
- package/src/aptos/builtin/0x3.js +0 -937
- package/src/aptos/builtin/0x3.js.map +0 -1
- package/src/aptos/builtin/0x4.d.ts +0 -551
- package/src/aptos/builtin/0x4.d.ts.map +0 -1
- package/src/aptos/builtin/0x4.js +0 -529
- package/src/aptos/builtin/0x4.js.map +0 -1
- package/src/aptos/builtin/index.d.ts +0 -4
- package/src/aptos/builtin/index.d.ts.map +0 -1
- package/src/aptos/builtin/index.js +0 -7
- package/src/aptos/builtin/index.js.map +0 -1
- package/src/eth/builtin/eacaggregatorproxy.d.ts +0 -5
- package/src/eth/builtin/eacaggregatorproxy.d.ts.map +0 -1
- package/src/eth/builtin/eacaggregatorproxy.js +0 -8
- package/src/eth/builtin/eacaggregatorproxy.js.map +0 -1
- package/src/eth/builtin/erc1155.d.ts +0 -5
- package/src/eth/builtin/erc1155.d.ts.map +0 -1
- package/src/eth/builtin/erc1155.js +0 -8
- package/src/eth/builtin/erc1155.js.map +0 -1
- package/src/eth/builtin/erc20.d.ts +0 -5
- package/src/eth/builtin/erc20.d.ts.map +0 -1
- package/src/eth/builtin/erc20.js +0 -8
- package/src/eth/builtin/erc20.js.map +0 -1
- package/src/eth/builtin/erc20bytes.d.ts +0 -5
- package/src/eth/builtin/erc20bytes.d.ts.map +0 -1
- package/src/eth/builtin/erc20bytes.js +0 -8
- package/src/eth/builtin/erc20bytes.js.map +0 -1
- package/src/eth/builtin/erc721.d.ts +0 -5
- package/src/eth/builtin/erc721.d.ts.map +0 -1
- package/src/eth/builtin/erc721.js +0 -8
- package/src/eth/builtin/erc721.js.map +0 -1
- package/src/eth/builtin/index.d.ts +0 -13
- package/src/eth/builtin/index.d.ts.map +0 -1
- package/src/eth/builtin/index.js +0 -16
- package/src/eth/builtin/index.js.map +0 -1
- package/src/eth/builtin/internal/EACAggregatorProxy.d.ts +0 -50
- package/src/eth/builtin/internal/EACAggregatorProxy.d.ts.map +0 -1
- package/src/eth/builtin/internal/EACAggregatorProxy.js +0 -2
- package/src/eth/builtin/internal/EACAggregatorProxy.js.map +0 -1
- package/src/eth/builtin/internal/ERC1155.d.ts +0 -57
- package/src/eth/builtin/internal/ERC1155.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC1155.js +0 -2
- package/src/eth/builtin/internal/ERC1155.js.map +0 -1
- package/src/eth/builtin/internal/ERC20.d.ts +0 -41
- package/src/eth/builtin/internal/ERC20.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC20.js +0 -2
- package/src/eth/builtin/internal/ERC20.js.map +0 -1
- package/src/eth/builtin/internal/ERC20Bytes.d.ts +0 -32
- package/src/eth/builtin/internal/ERC20Bytes.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC20Bytes.js +0 -2
- package/src/eth/builtin/internal/ERC20Bytes.js.map +0 -1
- package/src/eth/builtin/internal/ERC721.d.ts +0 -43
- package/src/eth/builtin/internal/ERC721.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC721.js +0 -2
- package/src/eth/builtin/internal/ERC721.js.map +0 -1
- package/src/eth/builtin/internal/WETH9.d.ts +0 -47
- package/src/eth/builtin/internal/WETH9.d.ts.map +0 -1
- package/src/eth/builtin/internal/WETH9.js +0 -2
- package/src/eth/builtin/internal/WETH9.js.map +0 -1
- package/src/eth/builtin/internal/common.d.ts +0 -3
- package/src/eth/builtin/internal/common.d.ts.map +0 -1
- package/src/eth/builtin/internal/common.js +0 -8
- package/src/eth/builtin/internal/common.js.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +0 -373
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.js +0 -1355
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.js.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts +0 -7
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js +0 -55
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc1155-processor.d.ts +0 -173
- package/src/eth/builtin/internal/erc1155-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc1155-processor.js +0 -596
- package/src/eth/builtin/internal/erc1155-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc1155-test-utils.d.ts +0 -7
- package/src/eth/builtin/internal/erc1155-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc1155-test-utils.js +0 -55
- package/src/eth/builtin/internal/erc1155-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc20-processor.d.ts +0 -244
- package/src/eth/builtin/internal/erc20-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20-processor.js +0 -1109
- package/src/eth/builtin/internal/erc20-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc20-test-utils.d.ts +0 -6
- package/src/eth/builtin/internal/erc20-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20-test-utils.js +0 -44
- package/src/eth/builtin/internal/erc20-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-processor.d.ts +0 -144
- package/src/eth/builtin/internal/erc20bytes-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-processor.js +0 -594
- package/src/eth/builtin/internal/erc20bytes-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts +0 -5
- package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-test-utils.js +0 -33
- package/src/eth/builtin/internal/erc20bytes-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc721-processor.d.ts +0 -215
- package/src/eth/builtin/internal/erc721-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc721-processor.js +0 -895
- package/src/eth/builtin/internal/erc721-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc721-test-utils.d.ts +0 -6
- package/src/eth/builtin/internal/erc721-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc721-test-utils.js +0 -44
- package/src/eth/builtin/internal/erc721-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts +0 -400
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js +0 -524
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts +0 -251
- package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC1155__factory.js +0 -329
- package/src/eth/builtin/internal/factories/ERC1155__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -185
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js +0 -251
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20__factory.d.ts +0 -303
- package/src/eth/builtin/internal/factories/ERC20__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20__factory.js +0 -401
- package/src/eth/builtin/internal/factories/ERC20__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC721__factory.d.ts +0 -273
- package/src/eth/builtin/internal/factories/ERC721__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC721__factory.js +0 -361
- package/src/eth/builtin/internal/factories/ERC721__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/WETH9__factory.d.ts +0 -220
- package/src/eth/builtin/internal/factories/WETH9__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/WETH9__factory.js +0 -294
- package/src/eth/builtin/internal/factories/WETH9__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/index.d.ts +0 -7
- package/src/eth/builtin/internal/factories/index.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/index.js +0 -10
- package/src/eth/builtin/internal/factories/index.js.map +0 -1
- package/src/eth/builtin/internal/index.d.ts +0 -14
- package/src/eth/builtin/internal/index.d.ts.map +0 -1
- package/src/eth/builtin/internal/index.js +0 -8
- package/src/eth/builtin/internal/index.js.map +0 -1
- package/src/eth/builtin/internal/weth9-processor.d.ts +0 -172
- package/src/eth/builtin/internal/weth9-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/weth9-processor.js +0 -729
- package/src/eth/builtin/internal/weth9-processor.js.map +0 -1
- package/src/eth/builtin/internal/weth9-test-utils.d.ts +0 -7
- package/src/eth/builtin/internal/weth9-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/weth9-test-utils.js +0 -55
- package/src/eth/builtin/internal/weth9-test-utils.js.map +0 -1
- package/src/eth/builtin/weth9.d.ts +0 -5
- package/src/eth/builtin/weth9.d.ts.map +0 -1
- package/src/eth/builtin/weth9.js +0 -8
- package/src/eth/builtin/weth9.js.map +0 -1
- package/src/solana/builtin/index.d.ts +0 -2
- package/src/solana/builtin/index.d.ts.map +0 -1
- package/src/solana/builtin/index.js +0 -2
- package/src/solana/builtin/index.js.map +0 -1
- package/src/solana/builtin/spl-token-processor.d.ts +0 -40
- package/src/solana/builtin/spl-token-processor.d.ts.map +0 -1
- package/src/solana/builtin/spl-token-processor.js +0 -254
- package/src/solana/builtin/spl-token-processor.js.map +0 -1
- package/src/solana/builtin/types.d.ts +0 -428
- package/src/solana/builtin/types.d.ts.map +0 -1
- package/src/solana/builtin/types.js +0 -201
- package/src/solana/builtin/types.js.map +0 -1
- package/src/sui/builtin/0x1.d.ts +0 -114
- package/src/sui/builtin/0x1.d.ts.map +0 -1
- package/src/sui/builtin/0x1.js +0 -159
- package/src/sui/builtin/0x1.js.map +0 -1
- package/src/sui/builtin/0x2.d.ts +0 -1250
- package/src/sui/builtin/0x2.d.ts.map +0 -1
- package/src/sui/builtin/0x2.js +0 -1511
- package/src/sui/builtin/0x2.js.map +0 -1
- package/src/sui/builtin/0x3.d.ts +0 -774
- package/src/sui/builtin/0x3.d.ts.map +0 -1
- package/src/sui/builtin/0x3.js +0 -720
- package/src/sui/builtin/0x3.js.map +0 -1
- package/src/sui/builtin/index.d.ts +0 -4
- package/src/sui/builtin/index.d.ts.map +0 -1
- package/src/sui/builtin/index.js +0 -7
- package/src/sui/builtin/index.js.map +0 -1
package/lib/chunk-E2DS6WZF.js
DELETED
@@ -1,1690 +0,0 @@
|
|
1
|
-
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
2
|
-
import {
|
3
|
-
SuiClient,
|
4
|
-
SuiNetwork,
|
5
|
-
getClient,
|
6
|
-
initCoinList,
|
7
|
-
normalizeSuiAddress,
|
8
|
-
normalizeSuiObjectId,
|
9
|
-
suiBcs
|
10
|
-
} from "./chunk-4HPFNKDX.js";
|
11
|
-
import {
|
12
|
-
getHandlerName,
|
13
|
-
proxyProcessor
|
14
|
-
} from "./chunk-43HP4DQZ.js";
|
15
|
-
import {
|
16
|
-
ANY_TYPE,
|
17
|
-
AbstractMoveCoder,
|
18
|
-
ChainAdapter,
|
19
|
-
InternalMoveFunctionVisibility,
|
20
|
-
MoveAccountContext,
|
21
|
-
MoveContext,
|
22
|
-
SPLITTER,
|
23
|
-
TypeDescriptor,
|
24
|
-
accountAddressString,
|
25
|
-
accountTypeString,
|
26
|
-
moduleQname,
|
27
|
-
parseMoveType
|
28
|
-
} from "./chunk-4OCWUYSJ.js";
|
29
|
-
import {
|
30
|
-
ALL_ADDRESS,
|
31
|
-
AccountConfig,
|
32
|
-
ContractConfig,
|
33
|
-
HandlerType,
|
34
|
-
MoveFetchConfig,
|
35
|
-
MoveOwnerType,
|
36
|
-
TemplateInstanceState,
|
37
|
-
normalizeLabels
|
38
|
-
} from "./chunk-2F2KNF4Z.js";
|
39
|
-
import {
|
40
|
-
require_lib
|
41
|
-
} from "./chunk-73SHERGU.js";
|
42
|
-
import {
|
43
|
-
__name,
|
44
|
-
__toESM
|
45
|
-
} from "./chunk-R7PMHHKJ.js";
|
46
|
-
|
47
|
-
// src/sui/sui-processor.ts
|
48
|
-
import { ListStateStorage } from "@sentio/runtime";
|
49
|
-
var import_nice_grpc = __toESM(require_lib(), 1);
|
50
|
-
|
51
|
-
// ../../node_modules/.pnpm/@typemove+sui@1.9.0_typescript@5.5.2/node_modules/@typemove/sui/dist/esm/models.js
|
52
|
-
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
53
|
-
|
54
|
-
// ../../node_modules/.pnpm/@typemove+sui@1.9.0_typescript@5.5.2/node_modules/@typemove/sui/dist/esm/transaction.js
|
55
|
-
function isTransactionArgument(value) {
|
56
|
-
if (typeof value !== "object")
|
57
|
-
return false;
|
58
|
-
if (value === null || value === void 0)
|
59
|
-
return false;
|
60
|
-
return value.$kind === "GasCoin" || value.$kind === "Result" || value.$kind === "NestedResult" || value.$kind === "Input";
|
61
|
-
}
|
62
|
-
__name(isTransactionArgument, "isTransactionArgument");
|
63
|
-
function transactionArgumentOrObject(value, transactionBlock) {
|
64
|
-
if (isTransactionArgument(value)) {
|
65
|
-
return value;
|
66
|
-
}
|
67
|
-
return transactionBlock.object(value);
|
68
|
-
}
|
69
|
-
__name(transactionArgumentOrObject, "transactionArgumentOrObject");
|
70
|
-
function transactionArgumentOrPure(value, transactionBlock) {
|
71
|
-
if (isTransactionArgument(value)) {
|
72
|
-
return value;
|
73
|
-
}
|
74
|
-
return typeof value == "string" ? transactionBlock.pure.string(value) : transactionBlock.pure.u64(value);
|
75
|
-
}
|
76
|
-
__name(transactionArgumentOrPure, "transactionArgumentOrPure");
|
77
|
-
function transactionArgumentOrPureAddress(value, transactionBlock) {
|
78
|
-
if (isTransactionArgument(value)) {
|
79
|
-
return value;
|
80
|
-
}
|
81
|
-
return transactionBlock.pure.address(value);
|
82
|
-
}
|
83
|
-
__name(transactionArgumentOrPureAddress, "transactionArgumentOrPureAddress");
|
84
|
-
function transactionArgumentOrPureU8(value, transactionBlock) {
|
85
|
-
if (isTransactionArgument(value)) {
|
86
|
-
return value;
|
87
|
-
}
|
88
|
-
return transactionBlock.pure.u8(value);
|
89
|
-
}
|
90
|
-
__name(transactionArgumentOrPureU8, "transactionArgumentOrPureU8");
|
91
|
-
function transactionArgumentOrPureU16(value, transactionBlock) {
|
92
|
-
if (isTransactionArgument(value)) {
|
93
|
-
return value;
|
94
|
-
}
|
95
|
-
return transactionBlock.pure.u16(value);
|
96
|
-
}
|
97
|
-
__name(transactionArgumentOrPureU16, "transactionArgumentOrPureU16");
|
98
|
-
function transactionArgumentOrPureU32(value, transactionBlock) {
|
99
|
-
if (isTransactionArgument(value)) {
|
100
|
-
return value;
|
101
|
-
}
|
102
|
-
return transactionBlock.pure.u32(value);
|
103
|
-
}
|
104
|
-
__name(transactionArgumentOrPureU32, "transactionArgumentOrPureU32");
|
105
|
-
function transactionArgumentOrPureU64(value, transactionBlock) {
|
106
|
-
if (isTransactionArgument(value)) {
|
107
|
-
return value;
|
108
|
-
}
|
109
|
-
return transactionBlock.pure.u64(value);
|
110
|
-
}
|
111
|
-
__name(transactionArgumentOrPureU64, "transactionArgumentOrPureU64");
|
112
|
-
function transactionArgumentOrPureU128(value, transactionBlock) {
|
113
|
-
if (isTransactionArgument(value)) {
|
114
|
-
return value;
|
115
|
-
}
|
116
|
-
return transactionBlock.pure.u128(value);
|
117
|
-
}
|
118
|
-
__name(transactionArgumentOrPureU128, "transactionArgumentOrPureU128");
|
119
|
-
function transactionArgumentOrPureU256(value, transactionBlock) {
|
120
|
-
if (isTransactionArgument(value)) {
|
121
|
-
return value;
|
122
|
-
}
|
123
|
-
return transactionBlock.pure.u256(value);
|
124
|
-
}
|
125
|
-
__name(transactionArgumentOrPureU256, "transactionArgumentOrPureU256");
|
126
|
-
function transactionArgumentOrPureBool(value, transactionBlock) {
|
127
|
-
if (isTransactionArgument(value)) {
|
128
|
-
return value;
|
129
|
-
}
|
130
|
-
return transactionBlock.pure.bool(value);
|
131
|
-
}
|
132
|
-
__name(transactionArgumentOrPureBool, "transactionArgumentOrPureBool");
|
133
|
-
function transactionArgumentOrVec(value, transactionBlock) {
|
134
|
-
if (isTransactionArgument(value)) {
|
135
|
-
return value;
|
136
|
-
}
|
137
|
-
return transactionBlock.makeMoveVec({
|
138
|
-
elements: value.map((a) => transactionBlock.object(a))
|
139
|
-
});
|
140
|
-
}
|
141
|
-
__name(transactionArgumentOrVec, "transactionArgumentOrVec");
|
142
|
-
|
143
|
-
// ../../node_modules/.pnpm/@typemove+sui@1.9.0_typescript@5.5.2/node_modules/@typemove/sui/dist/esm/to-internal.js
|
144
|
-
function toInternalModule(module) {
|
145
|
-
return {
|
146
|
-
address: module.address,
|
147
|
-
exposedFunctions: Object.entries(module.exposedFunctions).map(([n, f]) => toInternalFunction(n, f)),
|
148
|
-
name: module.name,
|
149
|
-
structs: Object.entries(module.structs).map(([n, s]) => toInternalStruct(n, s)),
|
150
|
-
enums: Object.entries(module.enums || {}).map(([n, e]) => toInternalEnum(n, e))
|
151
|
-
};
|
152
|
-
}
|
153
|
-
__name(toInternalModule, "toInternalModule");
|
154
|
-
function toInternalFunction(name, func) {
|
155
|
-
let visibility;
|
156
|
-
switch (func.visibility) {
|
157
|
-
case "Private":
|
158
|
-
visibility = InternalMoveFunctionVisibility.PRIVATE;
|
159
|
-
break;
|
160
|
-
case "Public":
|
161
|
-
visibility = InternalMoveFunctionVisibility.PUBLIC;
|
162
|
-
break;
|
163
|
-
case "Friend":
|
164
|
-
visibility = InternalMoveFunctionVisibility.FRIEND;
|
165
|
-
break;
|
166
|
-
default:
|
167
|
-
throw Error("No visibility for function" + name);
|
168
|
-
}
|
169
|
-
return {
|
170
|
-
typeParams: func.typeParameters.map((p) => {
|
171
|
-
return { constraints: p.abilities };
|
172
|
-
}),
|
173
|
-
isEntry: func.isEntry,
|
174
|
-
name,
|
175
|
-
params: func.parameters.map(toTypeDescriptor),
|
176
|
-
return: func.return.map(toTypeDescriptor),
|
177
|
-
visibility
|
178
|
-
};
|
179
|
-
}
|
180
|
-
__name(toInternalFunction, "toInternalFunction");
|
181
|
-
function toInternalStruct(name, struct) {
|
182
|
-
return {
|
183
|
-
abilities: struct.abilities.abilities,
|
184
|
-
fields: struct.fields.map(toInternalField),
|
185
|
-
typeParams: struct.typeParameters.map((p) => {
|
186
|
-
return { constraints: p.constraints.abilities };
|
187
|
-
}),
|
188
|
-
isNative: false,
|
189
|
-
isEvent: false,
|
190
|
-
name
|
191
|
-
};
|
192
|
-
}
|
193
|
-
__name(toInternalStruct, "toInternalStruct");
|
194
|
-
function toInternalEnum(name, enumType) {
|
195
|
-
return {
|
196
|
-
name,
|
197
|
-
abilities: enumType.abilities.abilities,
|
198
|
-
typeParams: enumType.typeParameters.map((p) => {
|
199
|
-
return { constraints: p.constraints.abilities };
|
200
|
-
}),
|
201
|
-
variants: Object.entries(enumType.variants).reduce((acc, [k, v]) => {
|
202
|
-
acc[k] = v.map(toInternalField);
|
203
|
-
return acc;
|
204
|
-
}, {})
|
205
|
-
};
|
206
|
-
}
|
207
|
-
__name(toInternalEnum, "toInternalEnum");
|
208
|
-
function toInternalField(module) {
|
209
|
-
return {
|
210
|
-
name: module.name,
|
211
|
-
type: toTypeDescriptor(module.type)
|
212
|
-
};
|
213
|
-
}
|
214
|
-
__name(toInternalField, "toInternalField");
|
215
|
-
function toTypeDescriptor(normalizedType) {
|
216
|
-
if (typeof normalizedType === "string") {
|
217
|
-
return new TypeDescriptor(normalizedType);
|
218
|
-
}
|
219
|
-
if ("Struct" in normalizedType) {
|
220
|
-
const qname = [normalizedType.Struct.address, normalizedType.Struct.module, normalizedType.Struct.name].join(SPLITTER);
|
221
|
-
const args = normalizedType.Struct.typeArguments.map(toTypeDescriptor);
|
222
|
-
return new TypeDescriptor(qname, args);
|
223
|
-
}
|
224
|
-
if ("Vector" in normalizedType) {
|
225
|
-
return new TypeDescriptor("Vector", [toTypeDescriptor(normalizedType.Vector)]);
|
226
|
-
}
|
227
|
-
if ("TypeParameter" in normalizedType) {
|
228
|
-
return new TypeDescriptor("T" + normalizedType.TypeParameter);
|
229
|
-
}
|
230
|
-
if ("Reference" in normalizedType) {
|
231
|
-
const res = toTypeDescriptor(normalizedType.Reference);
|
232
|
-
res.reference = true;
|
233
|
-
return res;
|
234
|
-
}
|
235
|
-
if ("MutableReference" in normalizedType) {
|
236
|
-
const res = toTypeDescriptor(normalizedType.MutableReference);
|
237
|
-
res.reference = true;
|
238
|
-
res.mutable = true;
|
239
|
-
return res;
|
240
|
-
}
|
241
|
-
throw new Error("Unexpected sui type");
|
242
|
-
}
|
243
|
-
__name(toTypeDescriptor, "toTypeDescriptor");
|
244
|
-
|
245
|
-
// ../../node_modules/.pnpm/@typemove+sui@1.9.0_typescript@5.5.2/node_modules/@typemove/sui/dist/esm/sui-chain-adapter.js
|
246
|
-
var SuiChainAdapter = class extends ChainAdapter {
|
247
|
-
static {
|
248
|
-
__name(this, "SuiChainAdapter");
|
249
|
-
}
|
250
|
-
async getChainId() {
|
251
|
-
return this.client.getChainIdentifier();
|
252
|
-
}
|
253
|
-
// static INSTANCE = new SuiChainAdapter()
|
254
|
-
client;
|
255
|
-
constructor(client) {
|
256
|
-
super();
|
257
|
-
this.client = client;
|
258
|
-
}
|
259
|
-
async fetchModule(account, module) {
|
260
|
-
return await this.client.getNormalizedMoveModule({ package: account, module });
|
261
|
-
}
|
262
|
-
async fetchModules(account) {
|
263
|
-
const modules = await this.client.getNormalizedMoveModulesByPackage({
|
264
|
-
package: account
|
265
|
-
});
|
266
|
-
return Object.values(modules);
|
267
|
-
}
|
268
|
-
getMeaningfulFunctionParams(params) {
|
269
|
-
return params;
|
270
|
-
}
|
271
|
-
toInternalModules(modules) {
|
272
|
-
return Object.values(modules).map(toInternalModule);
|
273
|
-
}
|
274
|
-
getAllEventStructs(modules) {
|
275
|
-
const eventMap = /* @__PURE__ */ new Map();
|
276
|
-
for (const module of modules) {
|
277
|
-
const qname = moduleQname(module);
|
278
|
-
for (const struct of module.structs) {
|
279
|
-
const abilities = new Set(struct.abilities);
|
280
|
-
if (abilities.has("Drop") && abilities.has("Copy")) {
|
281
|
-
eventMap.set(qname + SPLITTER + struct.name, struct);
|
282
|
-
}
|
283
|
-
}
|
284
|
-
}
|
285
|
-
return eventMap;
|
286
|
-
}
|
287
|
-
getType(base) {
|
288
|
-
return base.type;
|
289
|
-
}
|
290
|
-
getData(val) {
|
291
|
-
if (val === void 0) {
|
292
|
-
throw Error("val is undefined");
|
293
|
-
}
|
294
|
-
if ("parsedJson" in val) {
|
295
|
-
return val.parsedJson;
|
296
|
-
}
|
297
|
-
if (val.dataType === "moveObject") {
|
298
|
-
return val.fields;
|
299
|
-
}
|
300
|
-
if ("fields" in val) {
|
301
|
-
if ("type" in val && Object.keys(val).length === 2) {
|
302
|
-
return val.fields;
|
303
|
-
}
|
304
|
-
}
|
305
|
-
return val;
|
306
|
-
}
|
307
|
-
};
|
308
|
-
|
309
|
-
// ../../node_modules/.pnpm/@typemove+sui@1.9.0_typescript@5.5.2/node_modules/@typemove/sui/dist/esm/move-coder.js
|
310
|
-
var MoveCoder = class extends AbstractMoveCoder {
|
311
|
-
static {
|
312
|
-
__name(this, "MoveCoder");
|
313
|
-
}
|
314
|
-
constructor(client) {
|
315
|
-
super(new SuiChainAdapter(client));
|
316
|
-
}
|
317
|
-
load(module, address) {
|
318
|
-
let m = this.moduleMapping.get(module.address + "::" + module.name);
|
319
|
-
const mDeclared = this.moduleMapping.get(address + "::" + module.name);
|
320
|
-
if (m && mDeclared) {
|
321
|
-
return m;
|
322
|
-
}
|
323
|
-
this.accounts.add(module.address);
|
324
|
-
m = toInternalModule(module);
|
325
|
-
this.loadInternal(m, address);
|
326
|
-
return m;
|
327
|
-
}
|
328
|
-
async decode(data, type) {
|
329
|
-
switch (type.qname) {
|
330
|
-
case "0x1::ascii::Char":
|
331
|
-
if (data !== void 0 && typeof data !== "string") {
|
332
|
-
const byte = (await super.decode(data, type)).byte;
|
333
|
-
return String.fromCharCode(byte);
|
334
|
-
}
|
335
|
-
case "0x1::ascii::String":
|
336
|
-
if (data !== void 0 && typeof data !== "string") {
|
337
|
-
const bytes = (await super.decode(data, type)).bytes;
|
338
|
-
return new TextDecoder().decode(new Uint8Array(bytes));
|
339
|
-
}
|
340
|
-
case "0x2::object::ID":
|
341
|
-
if (data !== void 0 && typeof data !== "string") {
|
342
|
-
const bytes = (await super.decode(data, type)).bytes;
|
343
|
-
return normalizeSuiObjectId(bytes);
|
344
|
-
}
|
345
|
-
case "0x2::url::Url":
|
346
|
-
if (data !== void 0 && typeof data !== "string") {
|
347
|
-
return (await super.decode(data, type)).url;
|
348
|
-
}
|
349
|
-
case "0x2::coin::Coin":
|
350
|
-
if (data !== void 0 && typeof data !== "string") {
|
351
|
-
const bytes = (await super.decode(data, type)).id.id.bytes;
|
352
|
-
return new TextDecoder().decode(new Uint8Array(bytes));
|
353
|
-
}
|
354
|
-
return data;
|
355
|
-
case "0x2::balance::Balance":
|
356
|
-
if (data.value) {
|
357
|
-
const balance = await super.decode(data, type);
|
358
|
-
return balance.value;
|
359
|
-
}
|
360
|
-
return BigInt(data);
|
361
|
-
case "0x1::option::Option":
|
362
|
-
if (data === null) {
|
363
|
-
return data;
|
364
|
-
}
|
365
|
-
if (data.vec) {
|
366
|
-
let vec = await super.decode(data, type);
|
367
|
-
vec = vec.vec;
|
368
|
-
if (vec.length === 0) {
|
369
|
-
return null;
|
370
|
-
}
|
371
|
-
return vec[0];
|
372
|
-
}
|
373
|
-
return this.decode(data, type.typeArgs[0]);
|
374
|
-
case "Address":
|
375
|
-
const str = data;
|
376
|
-
return normalizeSuiAddress(str);
|
377
|
-
case "0x1::string::String":
|
378
|
-
if (typeof data !== "string") {
|
379
|
-
return new TextDecoder().decode(new Uint8Array(data.bytes));
|
380
|
-
}
|
381
|
-
default:
|
382
|
-
return super.decode(data, type);
|
383
|
-
}
|
384
|
-
}
|
385
|
-
decodeEvent(event) {
|
386
|
-
return this.decodedStruct(event);
|
387
|
-
}
|
388
|
-
filterAndDecodeEvents(type, resources) {
|
389
|
-
if (typeof type === "string") {
|
390
|
-
type = parseMoveType(type);
|
391
|
-
}
|
392
|
-
return this.filterAndDecodeStruct(type, resources);
|
393
|
-
}
|
394
|
-
async getDynamicFields(objects, keyType = ANY_TYPE, valueType = ANY_TYPE) {
|
395
|
-
const type = new TypeDescriptor("0x2::dynamic_field::Field");
|
396
|
-
type.typeArgs = [keyType, valueType];
|
397
|
-
const res = await this.filterAndDecodeObjects(type, objects);
|
398
|
-
return res.map((o) => o.data_decoded);
|
399
|
-
}
|
400
|
-
filterAndDecodeObjects(type, objects) {
|
401
|
-
return this.filterAndDecodeStruct(type, objects);
|
402
|
-
}
|
403
|
-
async decodeFunctionPayload(payload, inputs) {
|
404
|
-
const functionType = [payload.package, payload.module, payload.function].join(SPLITTER);
|
405
|
-
const func = await this.getMoveFunction(functionType);
|
406
|
-
const params = this.adapter.getMeaningfulFunctionParams(func.params);
|
407
|
-
const args = [];
|
408
|
-
for (const value of payload.arguments || []) {
|
409
|
-
const argValue = value;
|
410
|
-
if ("Input" in argValue) {
|
411
|
-
const idx = argValue.Input;
|
412
|
-
const arg = inputs[idx];
|
413
|
-
if (arg.type === "pure") {
|
414
|
-
args.push(arg.value);
|
415
|
-
} else if (arg.type === "object") {
|
416
|
-
args.push(void 0);
|
417
|
-
} else {
|
418
|
-
console.error("unexpected function arg value");
|
419
|
-
args.push(void 0);
|
420
|
-
}
|
421
|
-
} else {
|
422
|
-
args.push(void 0);
|
423
|
-
}
|
424
|
-
}
|
425
|
-
const argumentsTyped = await this.decodeArray(args, params, false);
|
426
|
-
return {
|
427
|
-
...payload,
|
428
|
-
arguments_decoded: argumentsTyped
|
429
|
-
};
|
430
|
-
}
|
431
|
-
bcsRegistered = /* @__PURE__ */ new Set();
|
432
|
-
bcsRegistry = /* @__PURE__ */ new Map();
|
433
|
-
async getBCSTypeWithArgs(type, args = []) {
|
434
|
-
const qname = type.qname;
|
435
|
-
const sig = type.getNormalizedSignature();
|
436
|
-
const cached = this.bcsRegistry.get(sig);
|
437
|
-
if (cached) {
|
438
|
-
return cached;
|
439
|
-
}
|
440
|
-
const lowerQname = qname.toLowerCase();
|
441
|
-
switch (lowerQname) {
|
442
|
-
case "u8":
|
443
|
-
case "u16":
|
444
|
-
case "u32":
|
445
|
-
case "u64":
|
446
|
-
case "u128":
|
447
|
-
case "u256":
|
448
|
-
case "bool":
|
449
|
-
return suiBcs[lowerQname]();
|
450
|
-
case "address":
|
451
|
-
return suiBcs.Address;
|
452
|
-
case "vector":
|
453
|
-
return suiBcs.vector(args[0]);
|
454
|
-
default:
|
455
|
-
if (!qname.includes("::")) {
|
456
|
-
throw `Unimplemented builtin type ${qname}`;
|
457
|
-
}
|
458
|
-
}
|
459
|
-
let moveStruct;
|
460
|
-
try {
|
461
|
-
moveStruct = await this.getMoveStruct(qname);
|
462
|
-
} catch (e) {
|
463
|
-
console.error("Invalid move address", qname);
|
464
|
-
throw e;
|
465
|
-
}
|
466
|
-
const structDef = {};
|
467
|
-
for (const field of moveStruct.fields) {
|
468
|
-
if (field.type.qname.startsWith("T") && args.length) {
|
469
|
-
const index = +field.type.qname.slice(1);
|
470
|
-
structDef[field.name] = args[index];
|
471
|
-
} else if (field.type.typeArgs.length && args.length) {
|
472
|
-
structDef[field.name] = await this.getBCSTypeWithArgs(field.type, args);
|
473
|
-
} else {
|
474
|
-
structDef[field.name] = await this.getBCSType(field.type);
|
475
|
-
}
|
476
|
-
}
|
477
|
-
return suiBcs.struct(qname, structDef);
|
478
|
-
}
|
479
|
-
async getBCSType(type) {
|
480
|
-
const args = await Promise.all(type.typeArgs.map((x) => this.getBCSType(x)));
|
481
|
-
const bcsType = await this.getBCSTypeWithArgs(type, args);
|
482
|
-
this.bcsRegistry.set(type.getNormalizedSignature(), bcsType);
|
483
|
-
return bcsType;
|
484
|
-
}
|
485
|
-
async registerBCSTypes(type) {
|
486
|
-
const sig = type.getNormalizedSignature();
|
487
|
-
if (this.bcsRegistered.has(sig)) {
|
488
|
-
return;
|
489
|
-
}
|
490
|
-
this.bcsRegistered.add(sig);
|
491
|
-
const bcsType = await this.getBCSType(type);
|
492
|
-
this.bcsRegistry.set(type.getNormalizedSignature(), bcsType);
|
493
|
-
}
|
494
|
-
async decodeBCS(type, data, encoding) {
|
495
|
-
await this.registerBCSTypes(type);
|
496
|
-
if (typeof data == "string") {
|
497
|
-
const buf = Buffer.from(data, encoding);
|
498
|
-
data = new Uint8Array(buf, buf.byteOffset, buf.byteLength);
|
499
|
-
}
|
500
|
-
const bcsType = this.bcsRegistry.get(type.getNormalizedSignature());
|
501
|
-
return bcsType?.parse(data);
|
502
|
-
}
|
503
|
-
async decodeDevInspectResult(inspectRes) {
|
504
|
-
const returnValues = [];
|
505
|
-
if (inspectRes.results != null) {
|
506
|
-
for (const r of inspectRes.results) {
|
507
|
-
if (r.returnValues) {
|
508
|
-
for (const returnValue of r.returnValues) {
|
509
|
-
const type = parseMoveType(returnValue[1]);
|
510
|
-
const bcsDecoded = await this.decodeBCS(type, new Uint8Array(returnValue[0]));
|
511
|
-
const decoded = await this.decodeType(bcsDecoded, type);
|
512
|
-
returnValues.push(decoded);
|
513
|
-
}
|
514
|
-
} else {
|
515
|
-
returnValues.push(null);
|
516
|
-
}
|
517
|
-
}
|
518
|
-
}
|
519
|
-
return { ...inspectRes, results_decoded: returnValues };
|
520
|
-
}
|
521
|
-
};
|
522
|
-
var DEFAULT_ENDPOINT = "https://fullnode.mainnet.sui.io/";
|
523
|
-
var CODER_MAP = /* @__PURE__ */ new Map();
|
524
|
-
function defaultMoveCoder(endpoint = DEFAULT_ENDPOINT) {
|
525
|
-
let coder = CODER_MAP.get(endpoint);
|
526
|
-
if (!coder) {
|
527
|
-
coder = new MoveCoder(new SuiClient({ url: endpoint }));
|
528
|
-
CODER_MAP.set(endpoint, coder);
|
529
|
-
}
|
530
|
-
return coder;
|
531
|
-
}
|
532
|
-
__name(defaultMoveCoder, "defaultMoveCoder");
|
533
|
-
var PROVIDER_CODER_MAP = /* @__PURE__ */ new Map();
|
534
|
-
var DEFAULT_CHAIN_ID;
|
535
|
-
async function getMoveCoder(client) {
|
536
|
-
let coder = PROVIDER_CODER_MAP.get(client);
|
537
|
-
if (!coder) {
|
538
|
-
coder = new MoveCoder(client);
|
539
|
-
const id = await client.getChainIdentifier();
|
540
|
-
const defaultCoder = defaultMoveCoder();
|
541
|
-
if (!DEFAULT_CHAIN_ID) {
|
542
|
-
DEFAULT_CHAIN_ID = await defaultCoder.adapter.getChainId();
|
543
|
-
}
|
544
|
-
if (id === DEFAULT_CHAIN_ID) {
|
545
|
-
coder = defaultCoder;
|
546
|
-
}
|
547
|
-
PROVIDER_CODER_MAP.set(client, coder);
|
548
|
-
}
|
549
|
-
return coder;
|
550
|
-
}
|
551
|
-
__name(getMoveCoder, "getMoveCoder");
|
552
|
-
|
553
|
-
// src/sui/move-coder.ts
|
554
|
-
var CODERS = /* @__PURE__ */ new Map();
|
555
|
-
function defaultMoveCoder2(network = SuiNetwork.MAIN_NET) {
|
556
|
-
let coder = CODERS.get(network);
|
557
|
-
if (!coder) {
|
558
|
-
coder = new MoveCoder(getClient(network));
|
559
|
-
CODERS.set(network, coder);
|
560
|
-
}
|
561
|
-
return coder;
|
562
|
-
}
|
563
|
-
__name(defaultMoveCoder2, "defaultMoveCoder");
|
564
|
-
import("node:process").then((p) => p.stdout.write(""));
|
565
|
-
|
566
|
-
// src/sui/context.ts
|
567
|
-
var SuiContext = class extends MoveContext {
|
568
|
-
static {
|
569
|
-
__name(this, "SuiContext");
|
570
|
-
}
|
571
|
-
moduleName;
|
572
|
-
timestamp;
|
573
|
-
checkpoint;
|
574
|
-
transaction;
|
575
|
-
eventIndex;
|
576
|
-
coder;
|
577
|
-
constructor(moduleName, network, address, timestamp, checkpoint, transaction, eventIndex, baseLabels) {
|
578
|
-
super(baseLabels);
|
579
|
-
this.address = address.toLowerCase();
|
580
|
-
this.network = network;
|
581
|
-
this.moduleName = moduleName;
|
582
|
-
this.timestamp = timestamp;
|
583
|
-
this.checkpoint = checkpoint;
|
584
|
-
this.eventIndex = eventIndex;
|
585
|
-
this.coder = defaultMoveCoder2(network);
|
586
|
-
if (transaction) {
|
587
|
-
this.transaction = transaction;
|
588
|
-
}
|
589
|
-
}
|
590
|
-
getChainId() {
|
591
|
-
return this.network;
|
592
|
-
}
|
593
|
-
getTimestamp() {
|
594
|
-
return this.timestamp.getDate();
|
595
|
-
}
|
596
|
-
getMetaDataInternal(name, labels) {
|
597
|
-
return {
|
598
|
-
address: this.address,
|
599
|
-
contractName: this.moduleName,
|
600
|
-
blockNumber: this.checkpoint,
|
601
|
-
transactionIndex: 0,
|
602
|
-
transactionHash: this.transaction?.digest || "",
|
603
|
-
// TODO
|
604
|
-
logIndex: this.eventIndex,
|
605
|
-
chainId: this.getChainId(),
|
606
|
-
name,
|
607
|
-
labels: normalizeLabels(labels)
|
608
|
-
};
|
609
|
-
}
|
610
|
-
get client() {
|
611
|
-
return getClient(this.network);
|
612
|
-
}
|
613
|
-
};
|
614
|
-
var SuiObjectChangeContext = class extends MoveContext {
|
615
|
-
static {
|
616
|
-
__name(this, "SuiObjectChangeContext");
|
617
|
-
}
|
618
|
-
timestamp;
|
619
|
-
checkpoint;
|
620
|
-
coder;
|
621
|
-
txDigest;
|
622
|
-
constructor(network, address, timestamp, checkpoint, txDigest, baseLabels) {
|
623
|
-
super(baseLabels);
|
624
|
-
this.address = address;
|
625
|
-
this.network = network;
|
626
|
-
this.timestamp = timestamp;
|
627
|
-
this.checkpoint = checkpoint;
|
628
|
-
this.txDigest = txDigest;
|
629
|
-
this.coder = defaultMoveCoder2(network);
|
630
|
-
}
|
631
|
-
getChainId() {
|
632
|
-
return this.network;
|
633
|
-
}
|
634
|
-
getTimestamp() {
|
635
|
-
return this.timestamp.getDate();
|
636
|
-
}
|
637
|
-
getMetaDataInternal(name, labels) {
|
638
|
-
return {
|
639
|
-
address: this.address,
|
640
|
-
contractName: "*",
|
641
|
-
blockNumber: this.checkpoint,
|
642
|
-
transactionIndex: -1,
|
643
|
-
transactionHash: this.txDigest,
|
644
|
-
logIndex: 0,
|
645
|
-
chainId: this.getChainId(),
|
646
|
-
name,
|
647
|
-
labels: normalizeLabels(labels)
|
648
|
-
};
|
649
|
-
}
|
650
|
-
get client() {
|
651
|
-
return getClient(this.network);
|
652
|
-
}
|
653
|
-
};
|
654
|
-
var SuiAddressContext = class extends MoveAccountContext {
|
655
|
-
static {
|
656
|
-
__name(this, "SuiAddressContext");
|
657
|
-
}
|
658
|
-
address;
|
659
|
-
network;
|
660
|
-
checkpoint;
|
661
|
-
timestamp;
|
662
|
-
coder;
|
663
|
-
contractName = "address";
|
664
|
-
constructor(network, address, checkpoint, timestamp, baseLabels) {
|
665
|
-
super(baseLabels);
|
666
|
-
this.address = address;
|
667
|
-
this.network = network;
|
668
|
-
this.checkpoint = checkpoint;
|
669
|
-
this.timestamp = timestamp;
|
670
|
-
this.coder = defaultMoveCoder2(network);
|
671
|
-
}
|
672
|
-
getChainId() {
|
673
|
-
return this.network;
|
674
|
-
}
|
675
|
-
getMetaDataInternal(name, labels) {
|
676
|
-
return {
|
677
|
-
address: this.address,
|
678
|
-
contractName: this.contractName,
|
679
|
-
blockNumber: this.checkpoint,
|
680
|
-
transactionIndex: 0,
|
681
|
-
transactionHash: "",
|
682
|
-
logIndex: 0,
|
683
|
-
chainId: this.getChainId(),
|
684
|
-
name,
|
685
|
-
labels: normalizeLabels(labels)
|
686
|
-
};
|
687
|
-
}
|
688
|
-
get client() {
|
689
|
-
return getClient(this.network);
|
690
|
-
}
|
691
|
-
getTimestamp() {
|
692
|
-
return this.timestamp.getDate();
|
693
|
-
}
|
694
|
-
};
|
695
|
-
var SuiObjectContext = class extends SuiAddressContext {
|
696
|
-
static {
|
697
|
-
__name(this, "SuiObjectContext");
|
698
|
-
}
|
699
|
-
contractName = "object";
|
700
|
-
objectId;
|
701
|
-
objectVersion;
|
702
|
-
constructor(network, objectId, objectVersion, checkpoint, timestamp, baseLabels) {
|
703
|
-
super(network, objectId, checkpoint, timestamp, baseLabels);
|
704
|
-
this.objectId = objectId;
|
705
|
-
this.objectVersion = objectVersion;
|
706
|
-
}
|
707
|
-
};
|
708
|
-
import("node:process").then((p) => p.stdout.write(""));
|
709
|
-
|
710
|
-
// src/sui/utils.ts
|
711
|
-
function getMoveCalls(txBlock) {
|
712
|
-
const txKind = txBlock.transaction?.data.transaction;
|
713
|
-
if (!txKind) {
|
714
|
-
return [];
|
715
|
-
}
|
716
|
-
const programmableTx = txKind.kind === "ProgrammableTransaction" ? txKind : void 0;
|
717
|
-
if (!programmableTx) {
|
718
|
-
return [];
|
719
|
-
}
|
720
|
-
return programmableTx.transactions.flatMap((tx) => {
|
721
|
-
if ("MoveCall" in tx) {
|
722
|
-
const call = tx.MoveCall;
|
723
|
-
call.package = accountTypeString(call.package);
|
724
|
-
return [call];
|
725
|
-
}
|
726
|
-
return [];
|
727
|
-
});
|
728
|
-
}
|
729
|
-
__name(getMoveCalls, "getMoveCalls");
|
730
|
-
import("node:process").then((p) => p.stdout.write(""));
|
731
|
-
|
732
|
-
// src/sui/sui-processor.ts
|
733
|
-
var DEFAULT_FETCH_CONFIG = {
|
734
|
-
resourceChanges: false,
|
735
|
-
allEvents: true,
|
736
|
-
inputs: true
|
737
|
-
};
|
738
|
-
function configure(options) {
|
739
|
-
return {
|
740
|
-
startCheckpoint: options.startCheckpoint || 0n,
|
741
|
-
address: options.address === ALL_ADDRESS ? ALL_ADDRESS : accountAddressString(options.address),
|
742
|
-
network: options.network || SuiNetwork.MAIN_NET,
|
743
|
-
baseLabels: options.baseLabels
|
744
|
-
};
|
745
|
-
}
|
746
|
-
__name(configure, "configure");
|
747
|
-
var SuiProcessorState = class _SuiProcessorState extends ListStateStorage {
|
748
|
-
static {
|
749
|
-
__name(this, "SuiProcessorState");
|
750
|
-
}
|
751
|
-
static INSTANCE = new _SuiProcessorState();
|
752
|
-
};
|
753
|
-
var SuiBaseProcessor = class {
|
754
|
-
static {
|
755
|
-
__name(this, "SuiBaseProcessor");
|
756
|
-
}
|
757
|
-
moduleName;
|
758
|
-
config;
|
759
|
-
eventHandlers = [];
|
760
|
-
callHandlers = [];
|
761
|
-
objectChangeHandlers = [];
|
762
|
-
coder;
|
763
|
-
constructor(name, options) {
|
764
|
-
this.moduleName = name;
|
765
|
-
this.config = configure(options);
|
766
|
-
SuiProcessorState.INSTANCE.addValue(this);
|
767
|
-
this.coder = defaultMoveCoder2(this.config.network);
|
768
|
-
return proxyProcessor(this);
|
769
|
-
}
|
770
|
-
getChainId() {
|
771
|
-
return this.config.network;
|
772
|
-
}
|
773
|
-
onMoveEvent(handler, filter, fetchConfig) {
|
774
|
-
let _filters = [];
|
775
|
-
const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig });
|
776
|
-
if (Array.isArray(filter)) {
|
777
|
-
_filters = filter;
|
778
|
-
} else {
|
779
|
-
_filters.push(filter);
|
780
|
-
}
|
781
|
-
const processor = this;
|
782
|
-
this.eventHandlers.push({
|
783
|
-
handlerName: getHandlerName(),
|
784
|
-
handler: /* @__PURE__ */ __name(async function(data) {
|
785
|
-
if (!data.rawTransaction) {
|
786
|
-
throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "event is null");
|
787
|
-
}
|
788
|
-
const txn = JSON.parse(data.rawTransaction);
|
789
|
-
if (txn.events == null) {
|
790
|
-
txn.events = [];
|
791
|
-
}
|
792
|
-
const evt = JSON.parse(data.rawEvent);
|
793
|
-
const idx = Number(evt.id.eventSeq) || 0;
|
794
|
-
const ctx = new SuiContext(
|
795
|
-
processor.moduleName,
|
796
|
-
processor.config.network,
|
797
|
-
processor.config.address,
|
798
|
-
data.timestamp || /* @__PURE__ */ new Date(0),
|
799
|
-
data.slot,
|
800
|
-
txn,
|
801
|
-
idx,
|
802
|
-
processor.config.baseLabels
|
803
|
-
);
|
804
|
-
const decoded = await processor.coder.decodeEvent(evt);
|
805
|
-
await handler(decoded || evt, ctx);
|
806
|
-
return ctx.stopAndGetResult();
|
807
|
-
}, "handler"),
|
808
|
-
filters: _filters,
|
809
|
-
fetchConfig: _fetchConfig
|
810
|
-
});
|
811
|
-
return this;
|
812
|
-
}
|
813
|
-
onEntryFunctionCall(handler, filter, fetchConfig) {
|
814
|
-
let _filters = [];
|
815
|
-
const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig });
|
816
|
-
if (Array.isArray(filter)) {
|
817
|
-
_filters = filter;
|
818
|
-
} else {
|
819
|
-
_filters.push(filter);
|
820
|
-
}
|
821
|
-
const processor = this;
|
822
|
-
const allFunctionType = new Set(_filters.map((f) => f.function));
|
823
|
-
this.callHandlers.push({
|
824
|
-
handlerName: getHandlerName(),
|
825
|
-
handler: /* @__PURE__ */ __name(async function(data) {
|
826
|
-
if (!data.rawTransaction) {
|
827
|
-
throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "call is null");
|
828
|
-
}
|
829
|
-
const tx = JSON.parse(data.rawTransaction);
|
830
|
-
const ctx = new SuiContext(
|
831
|
-
processor.moduleName,
|
832
|
-
processor.config.network,
|
833
|
-
processor.config.address,
|
834
|
-
data.timestamp || /* @__PURE__ */ new Date(0),
|
835
|
-
data.slot,
|
836
|
-
tx,
|
837
|
-
0,
|
838
|
-
processor.config.baseLabels
|
839
|
-
);
|
840
|
-
if (tx) {
|
841
|
-
const calls = getMoveCalls(tx);
|
842
|
-
const txKind = tx.transaction?.data?.transaction;
|
843
|
-
if (!txKind) {
|
844
|
-
throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "Unexpected getTransactionKind get empty");
|
845
|
-
}
|
846
|
-
const programmableTx = txKind.kind === "ProgrammableTransaction" ? txKind : void 0;
|
847
|
-
for (const call of calls) {
|
848
|
-
const functionType = [call.module, call.function].join(SPLITTER);
|
849
|
-
if (!allFunctionType.has(functionType)) {
|
850
|
-
continue;
|
851
|
-
}
|
852
|
-
const decoded = await processor.coder.decodeFunctionPayload(call, programmableTx?.inputs || []);
|
853
|
-
await handler(decoded, ctx);
|
854
|
-
}
|
855
|
-
}
|
856
|
-
return ctx.stopAndGetResult();
|
857
|
-
}, "handler"),
|
858
|
-
filters: _filters,
|
859
|
-
fetchConfig: _fetchConfig
|
860
|
-
});
|
861
|
-
return this;
|
862
|
-
}
|
863
|
-
onEvent(handler, fetchConfig) {
|
864
|
-
this.onMoveEvent(handler, { type: "" }, fetchConfig);
|
865
|
-
return this;
|
866
|
-
}
|
867
|
-
onTransactionBlock(handler, filter, fetchConfig) {
|
868
|
-
const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig });
|
869
|
-
const processor = this;
|
870
|
-
this.callHandlers.push({
|
871
|
-
handlerName: getHandlerName(),
|
872
|
-
handler: /* @__PURE__ */ __name(async function(data) {
|
873
|
-
if (!data.rawTransaction) {
|
874
|
-
throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "transaction is null");
|
875
|
-
}
|
876
|
-
const tx = JSON.parse(data.rawTransaction);
|
877
|
-
const ctx = new SuiContext(
|
878
|
-
processor.moduleName,
|
879
|
-
processor.config.network,
|
880
|
-
processor.config.address,
|
881
|
-
data.timestamp || /* @__PURE__ */ new Date(0),
|
882
|
-
data.slot,
|
883
|
-
tx,
|
884
|
-
0,
|
885
|
-
processor.config.baseLabels
|
886
|
-
);
|
887
|
-
if (tx) {
|
888
|
-
await handler(tx, ctx);
|
889
|
-
}
|
890
|
-
return ctx.stopAndGetResult();
|
891
|
-
}, "handler"),
|
892
|
-
filters: [{ ...filter, function: "" }],
|
893
|
-
fetchConfig: _fetchConfig
|
894
|
-
});
|
895
|
-
return this;
|
896
|
-
}
|
897
|
-
onObjectChange(handler, type) {
|
898
|
-
if (this.config.network === SuiNetwork.TEST_NET) {
|
899
|
-
throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "object change not supported in testnet");
|
900
|
-
}
|
901
|
-
const processor = this;
|
902
|
-
this.objectChangeHandlers.push({
|
903
|
-
handlerName: getHandlerName(),
|
904
|
-
handler: /* @__PURE__ */ __name(async function(data) {
|
905
|
-
const ctx = new SuiObjectChangeContext(
|
906
|
-
processor.config.network,
|
907
|
-
processor.config.address,
|
908
|
-
data.timestamp || /* @__PURE__ */ new Date(0),
|
909
|
-
data.slot,
|
910
|
-
data.txDigest,
|
911
|
-
processor.config.baseLabels
|
912
|
-
);
|
913
|
-
await handler(data.rawChanges.map((r) => JSON.parse(r)), ctx);
|
914
|
-
return ctx.stopAndGetResult();
|
915
|
-
}, "handler"),
|
916
|
-
type
|
917
|
-
});
|
918
|
-
return this;
|
919
|
-
}
|
920
|
-
};
|
921
|
-
var SuiModulesProcessor = class _SuiModulesProcessor extends SuiBaseProcessor {
|
922
|
-
static {
|
923
|
-
__name(this, "SuiModulesProcessor");
|
924
|
-
}
|
925
|
-
static bind(options) {
|
926
|
-
return new _SuiModulesProcessor(ALL_ADDRESS, options);
|
927
|
-
}
|
928
|
-
};
|
929
|
-
var SuiGlobalProcessor = class _SuiGlobalProcessor extends SuiBaseProcessor {
|
930
|
-
static {
|
931
|
-
__name(this, "SuiGlobalProcessor");
|
932
|
-
}
|
933
|
-
static bind(options) {
|
934
|
-
return new _SuiGlobalProcessor(ALL_ADDRESS, { ...options, address: ALL_ADDRESS });
|
935
|
-
}
|
936
|
-
onTransactionBlock(handler, filter, fetchConfig) {
|
937
|
-
return super.onTransactionBlock(handler, filter, fetchConfig);
|
938
|
-
}
|
939
|
-
// deprecated,, use object type processor
|
940
|
-
onObjectChange(handler, type) {
|
941
|
-
return super.onObjectChange(handler, type);
|
942
|
-
}
|
943
|
-
};
|
944
|
-
import("node:process").then((p) => p.stdout.write(""));
|
945
|
-
|
946
|
-
// src/sui/sui-object-processor.ts
|
947
|
-
import { ListStateStorage as ListStateStorage2 } from "@sentio/runtime";
|
948
|
-
var import_nice_grpc2 = __toESM(require_lib(), 1);
|
949
|
-
var DEFAULT_ACCOUNT_FETCH_CONFIG = {
|
950
|
-
owned: false
|
951
|
-
};
|
952
|
-
var SuiAccountProcessorState = class _SuiAccountProcessorState extends ListStateStorage2 {
|
953
|
-
static {
|
954
|
-
__name(this, "SuiAccountProcessorState");
|
955
|
-
}
|
956
|
-
static INSTANCE = new _SuiAccountProcessorState();
|
957
|
-
};
|
958
|
-
var SuiBaseObjectOrAddressProcessor = class {
|
959
|
-
static {
|
960
|
-
__name(this, "SuiBaseObjectOrAddressProcessor");
|
961
|
-
}
|
962
|
-
config;
|
963
|
-
ownerType;
|
964
|
-
templateId;
|
965
|
-
objectHandlers = [];
|
966
|
-
objectChangeHandlers = [];
|
967
|
-
// static bind(options: SuiObjectsBindOptions): SuiBaseObjectsProcessor<any> {
|
968
|
-
// return new SuiBaseObjectsProcessor(options)
|
969
|
-
// }
|
970
|
-
constructor(options) {
|
971
|
-
if (options.ownerType === MoveOwnerType.TYPE) {
|
972
|
-
this.config = {
|
973
|
-
startCheckpoint: options.startCheckpoint || 0n,
|
974
|
-
address: options.address === "*" ? "*" : accountTypeString(options.address),
|
975
|
-
network: options.network || SuiNetwork.MAIN_NET,
|
976
|
-
baseLabels: options.baseLabels
|
977
|
-
};
|
978
|
-
} else {
|
979
|
-
this.config = configure(options);
|
980
|
-
}
|
981
|
-
this.ownerType = options.ownerType;
|
982
|
-
SuiAccountProcessorState.INSTANCE.addValue(this);
|
983
|
-
return proxyProcessor(this);
|
984
|
-
}
|
985
|
-
getChainId() {
|
986
|
-
return this.config.network;
|
987
|
-
}
|
988
|
-
onInterval(handler, timeInterval, checkpointInterval, type, fetchConfig, handlerName = getHandlerName()) {
|
989
|
-
const processor = this;
|
990
|
-
this.objectHandlers.push({
|
991
|
-
handlerName,
|
992
|
-
handler: /* @__PURE__ */ __name(async function(data) {
|
993
|
-
const ctx = new SuiObjectContext(
|
994
|
-
processor.config.network,
|
995
|
-
data.objectId,
|
996
|
-
data.objectVersion,
|
997
|
-
data.slot,
|
998
|
-
data.timestamp || /* @__PURE__ */ new Date(0),
|
999
|
-
processor.config.baseLabels
|
1000
|
-
);
|
1001
|
-
await processor.doHandle(handler, data, ctx);
|
1002
|
-
return ctx.stopAndGetResult();
|
1003
|
-
}, "handler"),
|
1004
|
-
timeIntervalInMinutes: timeInterval,
|
1005
|
-
checkPointInterval: checkpointInterval,
|
1006
|
-
type,
|
1007
|
-
fetchConfig: { ...DEFAULT_ACCOUNT_FETCH_CONFIG, ...fetchConfig }
|
1008
|
-
});
|
1009
|
-
return this;
|
1010
|
-
}
|
1011
|
-
};
|
1012
|
-
var SuiBaseObjectOrAddressProcessorInternal = class extends SuiBaseObjectOrAddressProcessor {
|
1013
|
-
static {
|
1014
|
-
__name(this, "SuiBaseObjectOrAddressProcessorInternal");
|
1015
|
-
}
|
1016
|
-
onTimeInterval(handler, timeIntervalInMinutes = 60, backfillTimeIntervalInMinutes = 240, type, fetchConfig) {
|
1017
|
-
return this.onInterval(
|
1018
|
-
handler,
|
1019
|
-
{
|
1020
|
-
recentInterval: timeIntervalInMinutes,
|
1021
|
-
backfillInterval: backfillTimeIntervalInMinutes
|
1022
|
-
},
|
1023
|
-
void 0,
|
1024
|
-
type,
|
1025
|
-
fetchConfig
|
1026
|
-
);
|
1027
|
-
}
|
1028
|
-
onCheckpointInterval(handler, checkpointInterval = 1e5, backfillCheckpointInterval = 4e5, type, fetchConfig) {
|
1029
|
-
return this.onInterval(
|
1030
|
-
handler,
|
1031
|
-
void 0,
|
1032
|
-
{ recentInterval: checkpointInterval, backfillInterval: backfillCheckpointInterval },
|
1033
|
-
type,
|
1034
|
-
fetchConfig
|
1035
|
-
);
|
1036
|
-
}
|
1037
|
-
};
|
1038
|
-
var SuiAddressProcessor = class _SuiAddressProcessor extends SuiBaseObjectOrAddressProcessorInternal {
|
1039
|
-
static {
|
1040
|
-
__name(this, "SuiAddressProcessor");
|
1041
|
-
}
|
1042
|
-
callHandlers = [];
|
1043
|
-
static bind(options) {
|
1044
|
-
return new _SuiAddressProcessor({ ...options, ownerType: MoveOwnerType.ADDRESS });
|
1045
|
-
}
|
1046
|
-
async doHandle(handler, data, ctx) {
|
1047
|
-
return handler(data.rawObjects.map((o) => JSON.parse(o)), ctx);
|
1048
|
-
}
|
1049
|
-
onTransactionBlock(handler, filter, fetchConfig) {
|
1050
|
-
const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig });
|
1051
|
-
const _filter = {
|
1052
|
-
fromAndToAddress: {
|
1053
|
-
from: "",
|
1054
|
-
to: this.config.address
|
1055
|
-
},
|
1056
|
-
...filter
|
1057
|
-
};
|
1058
|
-
const processor = this;
|
1059
|
-
this.callHandlers.push({
|
1060
|
-
handlerName: getHandlerName(),
|
1061
|
-
handler: /* @__PURE__ */ __name(async function(data) {
|
1062
|
-
if (!data.rawTransaction) {
|
1063
|
-
throw new import_nice_grpc2.ServerError(import_nice_grpc2.Status.INVALID_ARGUMENT, "transaction is null");
|
1064
|
-
}
|
1065
|
-
const tx = JSON.parse(data.rawTransaction);
|
1066
|
-
const ctx = new SuiContext(
|
1067
|
-
"object",
|
1068
|
-
processor.config.network,
|
1069
|
-
processor.config.address,
|
1070
|
-
data.timestamp || /* @__PURE__ */ new Date(0),
|
1071
|
-
data.slot,
|
1072
|
-
tx,
|
1073
|
-
0,
|
1074
|
-
processor.config.baseLabels
|
1075
|
-
);
|
1076
|
-
if (tx) {
|
1077
|
-
await handler(tx, ctx);
|
1078
|
-
}
|
1079
|
-
return ctx.stopAndGetResult();
|
1080
|
-
}, "handler"),
|
1081
|
-
filters: [{ ..._filter, function: "" }],
|
1082
|
-
fetchConfig: _fetchConfig
|
1083
|
-
});
|
1084
|
-
return this;
|
1085
|
-
}
|
1086
|
-
};
|
1087
|
-
var SuiObjectProcessor = class _SuiObjectProcessor extends SuiBaseObjectOrAddressProcessorInternal {
|
1088
|
-
static {
|
1089
|
-
__name(this, "SuiObjectProcessor");
|
1090
|
-
}
|
1091
|
-
static bind(options) {
|
1092
|
-
return new _SuiObjectProcessor({
|
1093
|
-
address: options.objectId,
|
1094
|
-
network: options.network,
|
1095
|
-
startCheckpoint: options.startCheckpoint,
|
1096
|
-
ownerType: MoveOwnerType.OBJECT,
|
1097
|
-
baseLabels: options.baseLabels
|
1098
|
-
});
|
1099
|
-
}
|
1100
|
-
async doHandle(handler, data, ctx) {
|
1101
|
-
if (!data.rawSelf) {
|
1102
|
-
console.log(`Sui object not existed in ${ctx.checkpoint}, please specific a start time`);
|
1103
|
-
return;
|
1104
|
-
}
|
1105
|
-
return handler(
|
1106
|
-
JSON.parse(data.rawSelf),
|
1107
|
-
data.rawObjects.map((o) => JSON.parse(o)),
|
1108
|
-
ctx
|
1109
|
-
);
|
1110
|
-
}
|
1111
|
-
};
|
1112
|
-
var SuiObjectTypeProcessor = class _SuiObjectTypeProcessor extends SuiBaseObjectOrAddressProcessor {
|
1113
|
-
static {
|
1114
|
-
__name(this, "SuiObjectTypeProcessor");
|
1115
|
-
}
|
1116
|
-
objectType;
|
1117
|
-
static bind(options) {
|
1118
|
-
const processor = new _SuiObjectTypeProcessor({
|
1119
|
-
address: ALL_ADDRESS,
|
1120
|
-
// current only support on all address
|
1121
|
-
network: options.network,
|
1122
|
-
startCheckpoint: options.startCheckpoint,
|
1123
|
-
ownerType: MoveOwnerType.TYPE,
|
1124
|
-
baseLabels: options.baseLabels
|
1125
|
-
});
|
1126
|
-
processor.objectType = options.objectType;
|
1127
|
-
return processor;
|
1128
|
-
}
|
1129
|
-
async doHandle(handler, data, ctx) {
|
1130
|
-
if (!data.rawSelf) {
|
1131
|
-
console.log(`Sui object not existed in ${ctx.checkpoint}, please specific a start time`);
|
1132
|
-
return;
|
1133
|
-
}
|
1134
|
-
const object = await ctx.coder.filterAndDecodeObjects(this.objectType, [JSON.parse(data.rawSelf)]);
|
1135
|
-
return handler(object[0], data.rawObjects.map((o) => JSON.parse(o)), ctx);
|
1136
|
-
}
|
1137
|
-
onObjectChange(handler) {
|
1138
|
-
if (this.config.network === SuiNetwork.TEST_NET) {
|
1139
|
-
throw new import_nice_grpc2.ServerError(import_nice_grpc2.Status.INVALID_ARGUMENT, "object change not supported in testnet");
|
1140
|
-
}
|
1141
|
-
const processor = this;
|
1142
|
-
this.objectChangeHandlers.push({
|
1143
|
-
handlerName: getHandlerName(),
|
1144
|
-
handler: /* @__PURE__ */ __name(async function(data) {
|
1145
|
-
const ctx = new SuiObjectChangeContext(
|
1146
|
-
processor.config.network,
|
1147
|
-
processor.config.address,
|
1148
|
-
data.timestamp || /* @__PURE__ */ new Date(0),
|
1149
|
-
data.slot,
|
1150
|
-
data.txDigest,
|
1151
|
-
processor.config.baseLabels
|
1152
|
-
);
|
1153
|
-
await handler(data.rawChanges.map((r) => JSON.parse(r)), ctx);
|
1154
|
-
return ctx.stopAndGetResult();
|
1155
|
-
}, "handler"),
|
1156
|
-
type: this.objectType.qname
|
1157
|
-
});
|
1158
|
-
return this;
|
1159
|
-
}
|
1160
|
-
onTimeInterval(handler, timeIntervalInMinutes = 60, backfillTimeIntervalInMinutes = 240, fetchConfig) {
|
1161
|
-
return this.onInterval(
|
1162
|
-
handler,
|
1163
|
-
{
|
1164
|
-
recentInterval: timeIntervalInMinutes,
|
1165
|
-
backfillInterval: backfillTimeIntervalInMinutes
|
1166
|
-
},
|
1167
|
-
void 0,
|
1168
|
-
this.objectType.qname,
|
1169
|
-
fetchConfig
|
1170
|
-
);
|
1171
|
-
}
|
1172
|
-
onCheckpointInterval(handler, checkpointInterval = 1e5, backfillCheckpointInterval = 4e5, fetchConfig) {
|
1173
|
-
return this.onInterval(
|
1174
|
-
handler,
|
1175
|
-
void 0,
|
1176
|
-
{ recentInterval: checkpointInterval, backfillInterval: backfillCheckpointInterval },
|
1177
|
-
this.objectType.qname,
|
1178
|
-
fetchConfig
|
1179
|
-
);
|
1180
|
-
}
|
1181
|
-
};
|
1182
|
-
var SuiWrappedObjectProcessor = class _SuiWrappedObjectProcessor extends SuiBaseObjectOrAddressProcessorInternal {
|
1183
|
-
static {
|
1184
|
-
__name(this, "SuiWrappedObjectProcessor");
|
1185
|
-
}
|
1186
|
-
static bind(options) {
|
1187
|
-
return new _SuiWrappedObjectProcessor({
|
1188
|
-
address: options.objectId,
|
1189
|
-
network: options.network,
|
1190
|
-
startCheckpoint: options.startCheckpoint,
|
1191
|
-
ownerType: MoveOwnerType.WRAPPED_OBJECT,
|
1192
|
-
baseLabels: options.baseLabels
|
1193
|
-
});
|
1194
|
-
}
|
1195
|
-
async doHandle(handler, data, ctx) {
|
1196
|
-
return handler(data.rawObjects.map((o) => JSON.parse(o)), ctx);
|
1197
|
-
}
|
1198
|
-
};
|
1199
|
-
import("node:process").then((p) => p.stdout.write(""));
|
1200
|
-
|
1201
|
-
// src/sui/sui-object-processor-template.ts
|
1202
|
-
import { ListStateStorage as ListStateStorage3 } from "@sentio/runtime";
|
1203
|
-
var import_nice_grpc3 = __toESM(require_lib(), 1);
|
1204
|
-
var SuiAccountProcessorTemplateState = class _SuiAccountProcessorTemplateState extends ListStateStorage3 {
|
1205
|
-
static {
|
1206
|
-
__name(this, "SuiAccountProcessorTemplateState");
|
1207
|
-
}
|
1208
|
-
static INSTANCE = new _SuiAccountProcessorTemplateState();
|
1209
|
-
};
|
1210
|
-
var SuiObjectOrAddressProcessorTemplate = class {
|
1211
|
-
static {
|
1212
|
-
__name(this, "SuiObjectOrAddressProcessorTemplate");
|
1213
|
-
}
|
1214
|
-
id;
|
1215
|
-
objectHandlers = [];
|
1216
|
-
binds = /* @__PURE__ */ new Set();
|
1217
|
-
constructor() {
|
1218
|
-
this.id = SuiAccountProcessorTemplateState.INSTANCE.getValues().length;
|
1219
|
-
SuiAccountProcessorTemplateState.INSTANCE.addValue(this);
|
1220
|
-
return proxyProcessor(this);
|
1221
|
-
}
|
1222
|
-
bind(options, ctx) {
|
1223
|
-
options.network = options.network || ctx.network;
|
1224
|
-
options.startCheckpoint = options.startCheckpoint || ctx.checkpoint;
|
1225
|
-
let id = options.objectId || options.address;
|
1226
|
-
if (id === "*") {
|
1227
|
-
throw new import_nice_grpc3.ServerError(import_nice_grpc3.Status.INVALID_ARGUMENT, "can't bind template instance with *");
|
1228
|
-
}
|
1229
|
-
id = accountAddressString(id);
|
1230
|
-
const sig = [options.network, id].join("_");
|
1231
|
-
if (this.binds.has(sig)) {
|
1232
|
-
console.log(`Same object id can be bind to one template only once, ignore duplicate bind: ${sig}`);
|
1233
|
-
return;
|
1234
|
-
}
|
1235
|
-
this.binds.add(sig);
|
1236
|
-
const processor = this.createProcessor(options);
|
1237
|
-
for (const h of this.objectHandlers) {
|
1238
|
-
processor.onInterval(
|
1239
|
-
h.handler,
|
1240
|
-
h.timeIntervalInMinutes,
|
1241
|
-
h.checkpointInterval,
|
1242
|
-
h.type,
|
1243
|
-
h.fetchConfig,
|
1244
|
-
h.handlerName
|
1245
|
-
);
|
1246
|
-
}
|
1247
|
-
const config = processor.config;
|
1248
|
-
ctx.update({
|
1249
|
-
states: {
|
1250
|
-
configUpdated: true
|
1251
|
-
}
|
1252
|
-
});
|
1253
|
-
TemplateInstanceState.INSTANCE.addValue({
|
1254
|
-
templateId: this.id,
|
1255
|
-
contract: {
|
1256
|
-
name: "",
|
1257
|
-
chainId: config.network,
|
1258
|
-
address: config.address,
|
1259
|
-
abi: ""
|
1260
|
-
},
|
1261
|
-
startBlock: config.startCheckpoint,
|
1262
|
-
endBlock: 0n,
|
1263
|
-
baseLabels: config.baseLabels
|
1264
|
-
});
|
1265
|
-
console.log(`successfully bind template ${sig}`);
|
1266
|
-
}
|
1267
|
-
unbind(options, ctx) {
|
1268
|
-
options.network = options.network || ctx.network;
|
1269
|
-
options.startCheckpoint = options.startCheckpoint || ctx.checkpoint;
|
1270
|
-
let id = options.objectId || options.address;
|
1271
|
-
if (id === "*") {
|
1272
|
-
throw new import_nice_grpc3.ServerError(import_nice_grpc3.Status.INVALID_ARGUMENT, "can't delete template instance bind with *");
|
1273
|
-
}
|
1274
|
-
id = accountAddressString(id);
|
1275
|
-
const sig = [options.network, id].join("_");
|
1276
|
-
if (!this.binds.has(sig)) {
|
1277
|
-
console.log(`the template instance ${sig} not existed or already unbind`);
|
1278
|
-
return;
|
1279
|
-
}
|
1280
|
-
this.binds.delete(sig);
|
1281
|
-
let deleted = 0;
|
1282
|
-
const oldTemplateInstances = TemplateInstanceState.INSTANCE.unregister();
|
1283
|
-
for (const templateInstance of oldTemplateInstances) {
|
1284
|
-
if (templateInstance.contract?.chainId === options.network && templateInstance.contract.address == id) {
|
1285
|
-
deleted++;
|
1286
|
-
continue;
|
1287
|
-
}
|
1288
|
-
TemplateInstanceState.INSTANCE.addValue(templateInstance);
|
1289
|
-
}
|
1290
|
-
if (deleted !== 1) {
|
1291
|
-
throw new import_nice_grpc3.ServerError(
|
1292
|
-
import_nice_grpc3.Status.INVALID_ARGUMENT,
|
1293
|
-
`Failed to delete template instance ${sig}, deleted ${deleted} times`
|
1294
|
-
);
|
1295
|
-
}
|
1296
|
-
const oldProcessors = SuiAccountProcessorState.INSTANCE.unregister();
|
1297
|
-
deleted = 0;
|
1298
|
-
for (const processor of oldProcessors) {
|
1299
|
-
if (processor.templateId === this.id) {
|
1300
|
-
if (processor.config.network == options.network && processor.config.address === id) {
|
1301
|
-
deleted++;
|
1302
|
-
continue;
|
1303
|
-
}
|
1304
|
-
}
|
1305
|
-
SuiAccountProcessorState.INSTANCE.addValue(processor);
|
1306
|
-
}
|
1307
|
-
if (deleted !== 1) {
|
1308
|
-
throw new import_nice_grpc3.ServerError(
|
1309
|
-
import_nice_grpc3.Status.INVALID_ARGUMENT,
|
1310
|
-
`Failed to delete processor for template ${this.id}, ${sig}. deleted ${deleted} times`
|
1311
|
-
);
|
1312
|
-
}
|
1313
|
-
console.log(`successfully unbind template ${sig}`);
|
1314
|
-
ctx.update({
|
1315
|
-
states: {
|
1316
|
-
configUpdated: true
|
1317
|
-
}
|
1318
|
-
});
|
1319
|
-
}
|
1320
|
-
onInterval(handler, timeInterval, checkpointInterval, type, fetchConfig) {
|
1321
|
-
this.objectHandlers.push({
|
1322
|
-
handlerName: getHandlerName(),
|
1323
|
-
handler,
|
1324
|
-
timeIntervalInMinutes: timeInterval,
|
1325
|
-
checkpointInterval,
|
1326
|
-
type,
|
1327
|
-
fetchConfig: { ...DEFAULT_ACCOUNT_FETCH_CONFIG, ...fetchConfig }
|
1328
|
-
});
|
1329
|
-
return this;
|
1330
|
-
}
|
1331
|
-
onTimeInterval(handler, timeIntervalInMinutes = 60, backfillTimeIntervalInMinutes = 240, type, fetchConfig) {
|
1332
|
-
return this.onInterval(
|
1333
|
-
handler,
|
1334
|
-
{
|
1335
|
-
recentInterval: timeIntervalInMinutes,
|
1336
|
-
backfillInterval: backfillTimeIntervalInMinutes
|
1337
|
-
},
|
1338
|
-
void 0,
|
1339
|
-
type,
|
1340
|
-
fetchConfig
|
1341
|
-
);
|
1342
|
-
}
|
1343
|
-
onCheckpointInterval(handler, checkpointInterval = 1e5, backfillCheckpointInterval = 4e5, type, fetchConfig) {
|
1344
|
-
return this.onInterval(
|
1345
|
-
handler,
|
1346
|
-
void 0,
|
1347
|
-
{ recentInterval: checkpointInterval, backfillInterval: backfillCheckpointInterval },
|
1348
|
-
type,
|
1349
|
-
fetchConfig
|
1350
|
-
);
|
1351
|
-
}
|
1352
|
-
};
|
1353
|
-
var SuiAddressProcessorTemplate = class extends SuiObjectOrAddressProcessorTemplate {
|
1354
|
-
static {
|
1355
|
-
__name(this, "SuiAddressProcessorTemplate");
|
1356
|
-
}
|
1357
|
-
handlers = [];
|
1358
|
-
createProcessor(options) {
|
1359
|
-
const p = SuiAddressProcessor.bind(options);
|
1360
|
-
for (const handler of this.handlers) {
|
1361
|
-
p.onTransactionBlock(handler.handler, handler.filter, handler.fetchConfig);
|
1362
|
-
}
|
1363
|
-
p.templateId = this.id;
|
1364
|
-
return p;
|
1365
|
-
}
|
1366
|
-
onTransactionBlock(handler, filter, fetchConfig) {
|
1367
|
-
this.handlers.push({
|
1368
|
-
handler,
|
1369
|
-
filter,
|
1370
|
-
fetchConfig
|
1371
|
-
});
|
1372
|
-
return this;
|
1373
|
-
}
|
1374
|
-
};
|
1375
|
-
var SuiObjectProcessorTemplate = class extends SuiObjectOrAddressProcessorTemplate {
|
1376
|
-
static {
|
1377
|
-
__name(this, "SuiObjectProcessorTemplate");
|
1378
|
-
}
|
1379
|
-
createProcessor(options) {
|
1380
|
-
const p = SuiObjectProcessor.bind(options);
|
1381
|
-
p.templateId = this.id;
|
1382
|
-
return p;
|
1383
|
-
}
|
1384
|
-
};
|
1385
|
-
var SuiWrappedObjectProcessorTemplate = class extends SuiObjectOrAddressProcessorTemplate {
|
1386
|
-
static {
|
1387
|
-
__name(this, "SuiWrappedObjectProcessorTemplate");
|
1388
|
-
}
|
1389
|
-
createProcessor(options) {
|
1390
|
-
const p = SuiWrappedObjectProcessor.bind(options);
|
1391
|
-
p.templateId = this.id;
|
1392
|
-
return p;
|
1393
|
-
}
|
1394
|
-
};
|
1395
|
-
import("node:process").then((p) => p.stdout.write(""));
|
1396
|
-
|
1397
|
-
// src/sui/models.ts
|
1398
|
-
import("node:process").then((p) => p.stdout.write(""));
|
1399
|
-
|
1400
|
-
// src/sui/sui-plugin.ts
|
1401
|
-
import { errorString, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from "@sentio/runtime";
|
1402
|
-
var import_nice_grpc4 = __toESM(require_lib(), 1);
|
1403
|
-
import { SuiChainId } from "@sentio/chain";
|
1404
|
-
var SuiPlugin = class extends Plugin {
|
1405
|
-
static {
|
1406
|
-
__name(this, "SuiPlugin");
|
1407
|
-
}
|
1408
|
-
name = "SuiPlugin";
|
1409
|
-
handlers = {
|
1410
|
-
suiCallHandlers: [],
|
1411
|
-
suiEventHandlers: [],
|
1412
|
-
suiObjectHandlers: [],
|
1413
|
-
suiObjectChangeHandlers: []
|
1414
|
-
};
|
1415
|
-
async start(request) {
|
1416
|
-
await initCoinList();
|
1417
|
-
console.log("total instances:", request.templateInstances.length);
|
1418
|
-
const allowedChainIds = new Set(Object.values(SuiChainId));
|
1419
|
-
for (const instance of request.templateInstances) {
|
1420
|
-
if (!allowedChainIds.has(instance.contract?.chainId || "")) {
|
1421
|
-
continue;
|
1422
|
-
}
|
1423
|
-
console.log("start template instance", instance.templateId);
|
1424
|
-
const template = SuiAccountProcessorTemplateState.INSTANCE.getValues()[instance.templateId];
|
1425
|
-
template.bind(
|
1426
|
-
{
|
1427
|
-
address: instance.contract?.address || "",
|
1428
|
-
objectId: instance.contract?.address || "",
|
1429
|
-
network: instance.contract?.chainId || SuiNetwork.MAIN_NET,
|
1430
|
-
startCheckpoint: instance.startBlock || 0n,
|
1431
|
-
baseLabels: instance.baseLabels
|
1432
|
-
},
|
1433
|
-
NoopContext
|
1434
|
-
);
|
1435
|
-
}
|
1436
|
-
}
|
1437
|
-
async configure(config) {
|
1438
|
-
const handlers = {
|
1439
|
-
suiCallHandlers: [],
|
1440
|
-
suiEventHandlers: [],
|
1441
|
-
suiObjectHandlers: [],
|
1442
|
-
suiObjectChangeHandlers: []
|
1443
|
-
};
|
1444
|
-
for (const suiProcessor of SuiProcessorState.INSTANCE.getValues()) {
|
1445
|
-
const contractConfig = ContractConfig.fromPartial({
|
1446
|
-
transactionConfig: [],
|
1447
|
-
processorType: USER_PROCESSOR,
|
1448
|
-
contract: {
|
1449
|
-
name: suiProcessor.moduleName,
|
1450
|
-
chainId: suiProcessor.config.network,
|
1451
|
-
address: suiProcessor.config.address,
|
1452
|
-
abi: ""
|
1453
|
-
},
|
1454
|
-
startBlock: suiProcessor.config.startCheckpoint
|
1455
|
-
});
|
1456
|
-
for (const handler of suiProcessor.eventHandlers) {
|
1457
|
-
const handlerId = handlers.suiEventHandlers.push(handler.handler) - 1;
|
1458
|
-
const eventHandlerConfig = {
|
1459
|
-
filters: handler.filters.map((f) => {
|
1460
|
-
return {
|
1461
|
-
type: f.type,
|
1462
|
-
account: f.account || "",
|
1463
|
-
eventAccount: f.eventAccount || ""
|
1464
|
-
};
|
1465
|
-
}),
|
1466
|
-
fetchConfig: handler.fetchConfig,
|
1467
|
-
handlerId,
|
1468
|
-
handlerName: handler.handlerName
|
1469
|
-
};
|
1470
|
-
contractConfig.moveEventConfigs.push(eventHandlerConfig);
|
1471
|
-
}
|
1472
|
-
for (const handler of suiProcessor.callHandlers) {
|
1473
|
-
const handlerId = handlers.suiCallHandlers.push(handler.handler) - 1;
|
1474
|
-
const functionHandlerConfig = {
|
1475
|
-
filters: handler.filters.map((filter) => {
|
1476
|
-
return {
|
1477
|
-
function: filter.function,
|
1478
|
-
typeArguments: filter.typeArguments || [],
|
1479
|
-
withTypeArguments: !!filter.typeArguments,
|
1480
|
-
includeFailed: filter.includeFailed || false,
|
1481
|
-
publicKeyPrefix: filter.publicKeyPrefix || "",
|
1482
|
-
fromAndToAddress: filter.fromAndToAddress
|
1483
|
-
};
|
1484
|
-
}),
|
1485
|
-
fetchConfig: handler.fetchConfig,
|
1486
|
-
handlerId,
|
1487
|
-
handlerName: handler.handlerName
|
1488
|
-
};
|
1489
|
-
contractConfig.moveCallConfigs.push(functionHandlerConfig);
|
1490
|
-
}
|
1491
|
-
for (const handler of suiProcessor.objectChangeHandlers) {
|
1492
|
-
const handlerId = handlers.suiObjectChangeHandlers.push(handler.handler) - 1;
|
1493
|
-
const objectChangeHandler = {
|
1494
|
-
type: handler.type,
|
1495
|
-
handlerId,
|
1496
|
-
handlerName: handler.handlerName
|
1497
|
-
};
|
1498
|
-
contractConfig.moveResourceChangeConfigs.push(objectChangeHandler);
|
1499
|
-
}
|
1500
|
-
config.contractConfigs.push(contractConfig);
|
1501
|
-
}
|
1502
|
-
for (const processor of SuiAccountProcessorState.INSTANCE.getValues()) {
|
1503
|
-
const accountConfig = AccountConfig.fromPartial({
|
1504
|
-
address: processor.config.address,
|
1505
|
-
chainId: processor.getChainId(),
|
1506
|
-
startBlock: processor.config.startCheckpoint
|
1507
|
-
// TODO maybe use another field
|
1508
|
-
});
|
1509
|
-
for (const handler of processor.objectChangeHandlers) {
|
1510
|
-
const handlerId = handlers.suiObjectChangeHandlers.push(handler.handler) - 1;
|
1511
|
-
const objectChangeHandler = {
|
1512
|
-
type: handler.type,
|
1513
|
-
handlerId,
|
1514
|
-
handlerName: handler.handlerName
|
1515
|
-
};
|
1516
|
-
accountConfig.moveResourceChangeConfigs.push(objectChangeHandler);
|
1517
|
-
}
|
1518
|
-
for (const handler of processor.objectHandlers) {
|
1519
|
-
const handlerId = handlers.suiObjectHandlers.push(handler.handler) - 1;
|
1520
|
-
accountConfig.moveIntervalConfigs.push({
|
1521
|
-
intervalConfig: {
|
1522
|
-
handlerId,
|
1523
|
-
handlerName: handler.handlerName,
|
1524
|
-
minutes: 0,
|
1525
|
-
minutesInterval: handler.timeIntervalInMinutes,
|
1526
|
-
slot: 0,
|
1527
|
-
slotInterval: handler.checkPointInterval,
|
1528
|
-
fetchConfig: void 0
|
1529
|
-
},
|
1530
|
-
type: handler.type || "",
|
1531
|
-
ownerType: processor.ownerType,
|
1532
|
-
resourceFetchConfig: handler.fetchConfig,
|
1533
|
-
fetchConfig: void 0
|
1534
|
-
});
|
1535
|
-
}
|
1536
|
-
if (processor instanceof SuiAddressProcessor) {
|
1537
|
-
for (const handler of processor.callHandlers) {
|
1538
|
-
const handlerId = handlers.suiCallHandlers.push(handler.handler) - 1;
|
1539
|
-
const functionHandlerConfig = {
|
1540
|
-
filters: handler.filters.map((filter) => {
|
1541
|
-
return {
|
1542
|
-
function: filter.function,
|
1543
|
-
typeArguments: filter.typeArguments || [],
|
1544
|
-
withTypeArguments: !!filter.typeArguments,
|
1545
|
-
includeFailed: filter.includeFailed || false,
|
1546
|
-
publicKeyPrefix: filter.publicKeyPrefix || "",
|
1547
|
-
fromAndToAddress: filter.fromAndToAddress
|
1548
|
-
};
|
1549
|
-
}),
|
1550
|
-
fetchConfig: handler.fetchConfig,
|
1551
|
-
handlerId,
|
1552
|
-
handlerName: handler.handlerName
|
1553
|
-
};
|
1554
|
-
accountConfig.moveCallConfigs.push(functionHandlerConfig);
|
1555
|
-
}
|
1556
|
-
}
|
1557
|
-
config.accountConfigs.push(accountConfig);
|
1558
|
-
}
|
1559
|
-
this.handlers = handlers;
|
1560
|
-
}
|
1561
|
-
async processSuiEvent(binding) {
|
1562
|
-
if (!binding.data?.suiEvent) {
|
1563
|
-
throw new import_nice_grpc4.ServerError(import_nice_grpc4.Status.INVALID_ARGUMENT, "Event can't be empty");
|
1564
|
-
}
|
1565
|
-
const promises = [];
|
1566
|
-
const event = binding.data.suiEvent;
|
1567
|
-
for (const handlerId of binding.handlerIds) {
|
1568
|
-
promises.push(
|
1569
|
-
this.handlers.suiEventHandlers[handlerId](event).catch((e) => {
|
1570
|
-
throw new import_nice_grpc4.ServerError(
|
1571
|
-
import_nice_grpc4.Status.INTERNAL,
|
1572
|
-
"error processing event: " + JSON.stringify(event) + "\n" + errorString(e)
|
1573
|
-
);
|
1574
|
-
})
|
1575
|
-
);
|
1576
|
-
}
|
1577
|
-
return mergeProcessResults(await Promise.all(promises));
|
1578
|
-
}
|
1579
|
-
async processSuiFunctionCall(binding) {
|
1580
|
-
if (!binding.data?.suiCall) {
|
1581
|
-
throw new import_nice_grpc4.ServerError(import_nice_grpc4.Status.INVALID_ARGUMENT, "Call can't be empty");
|
1582
|
-
}
|
1583
|
-
const call = binding.data.suiCall;
|
1584
|
-
const promises = [];
|
1585
|
-
for (const handlerId of binding.handlerIds) {
|
1586
|
-
const promise = this.handlers.suiCallHandlers[handlerId](call).catch((e) => {
|
1587
|
-
throw new import_nice_grpc4.ServerError(import_nice_grpc4.Status.INTERNAL, "error processing call: " + JSON.stringify(call) + "\n" + errorString(e));
|
1588
|
-
});
|
1589
|
-
promises.push(promise);
|
1590
|
-
}
|
1591
|
-
return mergeProcessResults(await Promise.all(promises));
|
1592
|
-
}
|
1593
|
-
async processSuiObject(binding) {
|
1594
|
-
if (!binding.data?.suiObject) {
|
1595
|
-
throw new import_nice_grpc4.ServerError(import_nice_grpc4.Status.INVALID_ARGUMENT, "Object can't be empty");
|
1596
|
-
}
|
1597
|
-
const object = binding.data.suiObject;
|
1598
|
-
const promises = [];
|
1599
|
-
for (const handlerId of binding.handlerIds) {
|
1600
|
-
promises.push(
|
1601
|
-
this.handlers.suiObjectHandlers[handlerId](object).catch((e) => {
|
1602
|
-
throw new import_nice_grpc4.ServerError(
|
1603
|
-
import_nice_grpc4.Status.INTERNAL,
|
1604
|
-
"error processing object: " + JSON.stringify(object) + "\n" + errorString(e)
|
1605
|
-
);
|
1606
|
-
})
|
1607
|
-
);
|
1608
|
-
}
|
1609
|
-
return mergeProcessResults(await Promise.all(promises));
|
1610
|
-
}
|
1611
|
-
async processSuiObjectChange(binding) {
|
1612
|
-
if (!binding.data?.suiObjectChange) {
|
1613
|
-
throw new import_nice_grpc4.ServerError(import_nice_grpc4.Status.INVALID_ARGUMENT, "Object change can't be empty");
|
1614
|
-
}
|
1615
|
-
const objectChange = binding.data.suiObjectChange;
|
1616
|
-
const promises = [];
|
1617
|
-
for (const handlerId of binding.handlerIds) {
|
1618
|
-
promises.push(
|
1619
|
-
this.handlers.suiObjectChangeHandlers[handlerId](objectChange).catch((e) => {
|
1620
|
-
throw new import_nice_grpc4.ServerError(
|
1621
|
-
import_nice_grpc4.Status.INTERNAL,
|
1622
|
-
"error processing object change: " + JSON.stringify(objectChange) + "\n" + errorString(e)
|
1623
|
-
);
|
1624
|
-
})
|
1625
|
-
);
|
1626
|
-
}
|
1627
|
-
return mergeProcessResults(await Promise.all(promises));
|
1628
|
-
}
|
1629
|
-
supportedHandlers = [
|
1630
|
-
HandlerType.SUI_EVENT,
|
1631
|
-
HandlerType.SUI_CALL,
|
1632
|
-
HandlerType.SUI_OBJECT,
|
1633
|
-
HandlerType.SUI_OBJECT_CHANGE
|
1634
|
-
];
|
1635
|
-
processBinding(request) {
|
1636
|
-
switch (request.handlerType) {
|
1637
|
-
case HandlerType.SUI_EVENT:
|
1638
|
-
return this.processSuiEvent(request);
|
1639
|
-
case HandlerType.SUI_CALL:
|
1640
|
-
return this.processSuiFunctionCall(request);
|
1641
|
-
case HandlerType.SUI_OBJECT:
|
1642
|
-
return this.processSuiObject(request);
|
1643
|
-
case HandlerType.SUI_OBJECT_CHANGE:
|
1644
|
-
return this.processSuiObjectChange(request);
|
1645
|
-
default:
|
1646
|
-
throw new import_nice_grpc4.ServerError(import_nice_grpc4.Status.INVALID_ARGUMENT, "No handle type registered " + request.handlerType);
|
1647
|
-
}
|
1648
|
-
}
|
1649
|
-
};
|
1650
|
-
PluginManager.INSTANCE.register(new SuiPlugin());
|
1651
|
-
var NoopContext = new SuiContext("", SuiChainId.SUI_MAINNET, "", /* @__PURE__ */ new Date(), 0n, {}, 0, {});
|
1652
|
-
import("node:process").then((p) => p.stdout.write(""));
|
1653
|
-
|
1654
|
-
// src/sui/index.ts
|
1655
|
-
import("node:process").then((p) => p.stdout.write(""));
|
1656
|
-
|
1657
|
-
export {
|
1658
|
-
ZERO_ADDRESS,
|
1659
|
-
transactionArgumentOrObject,
|
1660
|
-
transactionArgumentOrPure,
|
1661
|
-
transactionArgumentOrPureAddress,
|
1662
|
-
transactionArgumentOrPureU8,
|
1663
|
-
transactionArgumentOrPureU16,
|
1664
|
-
transactionArgumentOrPureU32,
|
1665
|
-
transactionArgumentOrPureU64,
|
1666
|
-
transactionArgumentOrPureU128,
|
1667
|
-
transactionArgumentOrPureU256,
|
1668
|
-
transactionArgumentOrPureBool,
|
1669
|
-
transactionArgumentOrVec,
|
1670
|
-
MoveCoder,
|
1671
|
-
getMoveCoder,
|
1672
|
-
defaultMoveCoder2 as defaultMoveCoder,
|
1673
|
-
SuiContext,
|
1674
|
-
SuiObjectChangeContext,
|
1675
|
-
SuiAddressContext,
|
1676
|
-
SuiObjectContext,
|
1677
|
-
getMoveCalls,
|
1678
|
-
SuiBaseProcessor,
|
1679
|
-
SuiModulesProcessor,
|
1680
|
-
SuiGlobalProcessor,
|
1681
|
-
SuiAddressProcessor,
|
1682
|
-
SuiObjectProcessor,
|
1683
|
-
SuiObjectTypeProcessor,
|
1684
|
-
SuiWrappedObjectProcessor,
|
1685
|
-
SuiAddressProcessorTemplate,
|
1686
|
-
SuiObjectProcessorTemplate,
|
1687
|
-
SuiWrappedObjectProcessorTemplate,
|
1688
|
-
SuiPlugin
|
1689
|
-
};
|
1690
|
-
//# sourceMappingURL=chunk-E2DS6WZF.js.map
|