@sentio/sdk 2.0.0-rc.21 → 2.0.0-rc.22
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/codegen/codegen.js +5 -1
- package/lib/aptos/codegen/codegen.js.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy_processor.js +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155_processor.js +1 -1
- package/lib/eth/builtin/internal/erc1155_processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20_processor.js +1 -1
- package/lib/eth/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes_processor.js +1 -1
- package/lib/eth/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721_processor.js +1 -1
- package/lib/eth/builtin/internal/erc721_processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9_processor.js +1 -1
- package/lib/eth/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/eth/codegen/file.js +1 -1
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/context.d.ts +2 -1
- package/lib/eth/context.js +4 -5
- package/lib/eth/context.js.map +1 -1
- package/lib/eth/generic-processor.js +1 -1
- package/lib/eth/generic-processor.js.map +1 -1
- package/package.json +5 -5
- package/src/aptos/codegen/codegen.ts +5 -1
- package/src/eth/builtin/internal/eacaggregatorproxy_processor.ts +1 -1
- package/src/eth/builtin/internal/erc1155_processor.ts +1 -1
- package/src/eth/builtin/internal/erc20_processor.ts +1 -1
- package/src/eth/builtin/internal/erc20bytes_processor.ts +1 -1
- package/src/eth/builtin/internal/erc721_processor.ts +1 -1
- package/src/eth/builtin/internal/weth9_processor.ts +1 -1
- package/src/eth/codegen/file.ts +1 -1
- package/src/eth/context.ts +4 -5
- package/src/eth/generic-processor.ts +1 -1
package/lib/eth/context.js
CHANGED
|
@@ -89,10 +89,7 @@ export class ContractContext extends EthContext {
|
|
|
89
89
|
contract;
|
|
90
90
|
contractName;
|
|
91
91
|
constructor(contractName, view, chainId, timestamp, block, log, trace, transaction, transactionReceipt) {
|
|
92
|
-
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
const address = view.rawContract.getAddress();
|
|
95
|
-
super(chainId, address, timestamp, block, log, trace, transaction, transactionReceipt);
|
|
92
|
+
super(chainId, view.address, timestamp, block, log, trace, transaction, transactionReceipt);
|
|
96
93
|
view.context = this;
|
|
97
94
|
this.contractName = contractName;
|
|
98
95
|
this.contract = view;
|
|
@@ -115,9 +112,11 @@ export class ContractView {
|
|
|
115
112
|
}
|
|
116
113
|
export class BoundContractView {
|
|
117
114
|
view;
|
|
115
|
+
address;
|
|
118
116
|
// context will be set right after context creation (in context's constructor)
|
|
119
117
|
context;
|
|
120
|
-
constructor(view) {
|
|
118
|
+
constructor(address, view) {
|
|
119
|
+
this.address = address;
|
|
121
120
|
this.view = view;
|
|
122
121
|
}
|
|
123
122
|
get rawContract() {
|
package/lib/eth/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/eth/context.ts"],"names":[],"mappings":"AAKA,OAAO,EAAU,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,MAAM,OAAgB,UAAW,SAAQ,WAAW;IAClD,OAAO,CAAQ;IACf,OAAO,CAAQ;IACE,GAAG,CAAY;IAChC,KAAK,CAAQ;IACI,KAAK,CAAQ;IAC9B,WAAW,CAAiB;IAC5B,eAAe,CAAS;IACxB,WAAW,CAAc;IACzB,kBAAkB,CAAqB;IACvC,SAAS,CAAM;IAEf,YACE,OAAe,EACf,OAAe,EACf,SAAgB,EAChB,KAAa,EACb,GAAe,EACf,KAAa,EACb,WAAyB,EACzB,kBAA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aseContract, Transaction, TransactionReceipt, Block } from 'ethers'\nimport { LogParams } from 'ethers/providers'\n\nimport { RecordMetaData } from '@sentio/protos'\nimport { Trace } from './trace.js'\nimport { Labels, normalizeLabels } from '../core/metadata.js'\nimport { CHAIN_IDS } from '../core/chain.js'\nimport { BaseContext } from '../core/base-context.js'\n\nexport abstract class EthContext extends BaseContext {\n chainId: number\n address: string\n private readonly log?: LogParams\n block?: Block\n private readonly trace?: Trace\n blockNumber: bigint | number\n transactionHash?: string\n transaction?: Transaction\n transactionReceipt?: TransactionReceipt\n timestamp: Date\n\n constructor(\n chainId: number,\n address: string,\n timestamp?: Date,\n block?: Block,\n log?: LogParams,\n trace?: Trace,\n transaction?: Transaction,\n transactionReceipt?: TransactionReceipt\n ) {\n super()\n this.chainId = chainId\n this.log = log\n this.block = block\n this.trace = trace\n this.address = address\n this.transaction = transaction\n this.transactionReceipt = transactionReceipt\n this.timestamp = timestamp || new Date(0)\n if (log) {\n this.blockNumber = log.blockNumber\n this.transactionHash = log.transactionHash\n } else if (block) {\n this.blockNumber = block.number\n } else if (trace) {\n this.blockNumber = trace.blockNumber\n this.transactionHash = trace.transactionHash\n }\n }\n\n protected abstract getContractName(): string\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n if (this.log) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: this.log.transactionIndex,\n transactionHash: this.transactionHash || '',\n logIndex: this.log.index,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n if (this.block) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: -1,\n transactionHash: '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n if (this.trace) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: this.trace.transactionPosition,\n transactionHash: this.transactionHash || '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n throw new Error(\"Invaid ctx argument can't happen\")\n }\n}\n\nexport class AccountContext extends EthContext {\n // constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {\n // super(chainId, address, new Date(0), block, log, trace)\n // }\n protected getContractName(): string {\n return 'account'\n }\n}\n\nexport class ContractContext<\n TContract extends BaseContract,\n TContractBoundView extends BoundContractView<TContract, ContractView<TContract>>\n> extends EthContext {\n contract: TContractBoundView\n contractName: string\n\n constructor(\n contractName: string,\n view: TContractBoundView,\n chainId: number,\n timestamp?: Date,\n block?: Block,\n log?: LogParams,\n trace?: Trace,\n transaction?: Transaction,\n transactionReceipt?: TransactionReceipt\n ) {\n super(chainId, view.address, timestamp, block, log, trace, transaction, transactionReceipt)\n view.context = this\n this.contractName = contractName\n this.contract = view\n }\n\n protected getContractName(): string {\n return this.contractName\n }\n}\n\nexport class ContractView<TContract extends BaseContract> {\n protected contract: TContract\n\n constructor(contract: TContract) {\n this.contract = contract\n }\n\n get rawContract() {\n return this.contract\n }\n\n get provider() {\n return this.contract.runner?.provider\n }\n}\n\nexport class BoundContractView<TContract extends BaseContract, TContractView extends ContractView<TContract>> {\n protected view: TContractView\n readonly address: string\n // context will be set right after context creation (in context's constructor)\n context: ContractContext<TContract, BoundContractView<TContract, TContractView>>\n\n constructor(address: string, view: TContractView) {\n this.address = address\n this.view = view\n }\n\n get rawContract() {\n return this.view.rawContract\n }\n\n get provider() {\n return this.view.provider\n }\n\n get filters() {\n return this.view.rawContract.filters\n }\n}\n\nexport class SuiContext extends BaseContext {\n address: string\n moduleName: string\n blockNumber: bigint\n\n constructor(address: string, slot: bigint) {\n super()\n this.address = address\n this.blockNumber = slot\n }\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n return {\n address: this.address,\n contractName: this.moduleName,\n blockNumber: this.blockNumber,\n transactionIndex: 0,\n transactionHash: '', // TODO\n logIndex: 0,\n chainId: CHAIN_IDS.SUI_DEVNET, // TODO set in context\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n"]}
|
|
@@ -11,7 +11,7 @@ export class GenericProcessor extends BaseProcessor {
|
|
|
11
11
|
}
|
|
12
12
|
CreateBoundContractView() {
|
|
13
13
|
const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network));
|
|
14
|
-
return new BoundContractView(new ContractView(contract));
|
|
14
|
+
return new BoundContractView(this.config.address, new ContractView(contract));
|
|
15
15
|
}
|
|
16
16
|
static bind(eventABI, options) {
|
|
17
17
|
if (!Array.isArray(eventABI)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-processor.js","sourceRoot":"","sources":["../../src/eth/generic-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,OAAO,gBAAiB,SAAQ,aAGrC;IACC,QAAQ,CAAU;IAClB,YAAY,QAAkB,EAAE,OAAoB;QAClD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAES,uBAAuB;QAC/B,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QACvG,OAAO,IAAI,iBAAiB,CAAC,IAAI,YAAY,CAAe,QAAQ,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"generic-processor.js","sourceRoot":"","sources":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import { BoundContractView, ContractView } from './context.js'\nimport { BindOptions } from './bind-options.js'\nimport { BaseProcessor } from './base-processor.js'\nimport { getProvider } from './provider.js'\nimport { addProcessor } from './binds.js'\n\nexport class GenericProcessor extends BaseProcessor<\n BaseContract,\n BoundContractView<BaseContract, ContractView<BaseContract>>\n> {\n eventABI: string[]\n constructor(eventABI: string[], options: BindOptions) {\n super(options)\n this.eventABI = eventABI\n }\n\n protected CreateBoundContractView(): BoundContractView<BaseContract, ContractView<BaseContract>> {\n const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network))\n return new BoundContractView(this.config.address, new ContractView<BaseContract>(contract))\n }\n\n public static bind(eventABI: string[] | string, options: BindOptions): GenericProcessor {\n if (!Array.isArray(eventABI)) {\n eventABI = [eventABI]\n }\n if (!options.name) {\n options.name = 'Generic'\n }\n const processor = new GenericProcessor(eventABI, options)\n addProcessor(options, processor)\n return processor\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.22",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"compile": "tsc -p . && cp src/utils/*.csv lib/utils && cp src/tsup.config.ts lib",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@project-serum/anchor": "^0.26.0",
|
|
19
19
|
"@sentio/bigdecimal": "^9.1.1-patch.3",
|
|
20
20
|
"@sentio/ethers-v6": "^1.0.24",
|
|
21
|
-
"@sentio/protos": "^2.0.0-rc.
|
|
22
|
-
"@sentio/runtime": "^2.0.0-rc.
|
|
23
|
-
"@sentio/sdk": "^2.0.0-rc.
|
|
21
|
+
"@sentio/protos": "^2.0.0-rc.22",
|
|
22
|
+
"@sentio/runtime": "^2.0.0-rc.22",
|
|
23
|
+
"@sentio/sdk": "^2.0.0-rc.22",
|
|
24
24
|
"@solana/web3.js": "^1.47.3",
|
|
25
25
|
"@types/prettier": "^2.7.2",
|
|
26
26
|
"aptos-sdk": "npm:@sentio/aptos@^1.6.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"typedoc": {
|
|
72
72
|
"entryPoint": "./src/index.ts"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "6e28f01925cdb5c1142a342d57144221d36967fd"
|
|
75
75
|
}
|
|
@@ -217,7 +217,11 @@ export class AccountCodegen {
|
|
|
217
217
|
|
|
218
218
|
${this.modules
|
|
219
219
|
.map((m) => {
|
|
220
|
-
|
|
220
|
+
if (m.abi) {
|
|
221
|
+
return `_r.load(${normalizeToJSName(m.abi.name)}.ABI)`
|
|
222
|
+
}
|
|
223
|
+
console.error('Find Module with empty ABI')
|
|
224
|
+
return ''
|
|
221
225
|
})
|
|
222
226
|
.join('\n')}
|
|
223
227
|
}
|
|
@@ -985,7 +985,7 @@ export class EACAggregatorProxyProcessor extends BaseProcessor<
|
|
|
985
985
|
this.config.address,
|
|
986
986
|
this.config.network
|
|
987
987
|
);
|
|
988
|
-
return new EACAggregatorProxyBoundContractView(view);
|
|
988
|
+
return new EACAggregatorProxyBoundContractView(this.config.address, view);
|
|
989
989
|
}
|
|
990
990
|
|
|
991
991
|
public static bind(options: BindOptions): EACAggregatorProxyProcessor {
|
|
@@ -423,7 +423,7 @@ export class ERC1155Processor extends BaseProcessor<
|
|
|
423
423
|
|
|
424
424
|
protected CreateBoundContractView(): ERC1155BoundContractView {
|
|
425
425
|
const view = getERC1155Contract(this.config.address, this.config.network);
|
|
426
|
-
return new ERC1155BoundContractView(view);
|
|
426
|
+
return new ERC1155BoundContractView(this.config.address, view);
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
public static bind(options: BindOptions): ERC1155Processor {
|
|
@@ -543,7 +543,7 @@ export class ERC20Processor extends BaseProcessor<
|
|
|
543
543
|
|
|
544
544
|
protected CreateBoundContractView(): ERC20BoundContractView {
|
|
545
545
|
const view = getERC20Contract(this.config.address, this.config.network);
|
|
546
|
-
return new ERC20BoundContractView(view);
|
|
546
|
+
return new ERC20BoundContractView(this.config.address, view);
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
public static bind(options: BindOptions): ERC20Processor {
|
|
@@ -354,7 +354,7 @@ export class ERC20BytesProcessor extends BaseProcessor<
|
|
|
354
354
|
this.config.address,
|
|
355
355
|
this.config.network
|
|
356
356
|
);
|
|
357
|
-
return new ERC20BytesBoundContractView(view);
|
|
357
|
+
return new ERC20BytesBoundContractView(this.config.address, view);
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
public static bind(options: BindOptions): ERC20BytesProcessor {
|
|
@@ -560,7 +560,7 @@ export class ERC721Processor extends BaseProcessor<
|
|
|
560
560
|
|
|
561
561
|
protected CreateBoundContractView(): ERC721BoundContractView {
|
|
562
562
|
const view = getERC721Contract(this.config.address, this.config.network);
|
|
563
|
-
return new ERC721BoundContractView(view);
|
|
563
|
+
return new ERC721BoundContractView(this.config.address, view);
|
|
564
564
|
}
|
|
565
565
|
|
|
566
566
|
public static bind(options: BindOptions): ERC721Processor {
|
|
@@ -403,7 +403,7 @@ export class WETH9Processor extends BaseProcessor<
|
|
|
403
403
|
|
|
404
404
|
protected CreateBoundContractView(): WETH9BoundContractView {
|
|
405
405
|
const view = getWETH9Contract(this.config.address, this.config.network);
|
|
406
|
-
return new WETH9BoundContractView(view);
|
|
406
|
+
return new WETH9BoundContractView(this.config.address, view);
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
public static bind(options: BindOptions): WETH9Processor {
|
package/src/eth/codegen/file.ts
CHANGED
|
@@ -63,7 +63,7 @@ export function codeGenSentioFile(contract: Contract): string {
|
|
|
63
63
|
|
|
64
64
|
protected CreateBoundContractView(): ${contract.name}BoundContractView {
|
|
65
65
|
const view = get${contract.name}Contract(this.config.address, this.config.network)
|
|
66
|
-
return new ${contract.name}BoundContractView(view)
|
|
66
|
+
return new ${contract.name}BoundContractView(this.config.address, view)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
public static bind(options: BindOptions): ${contract.name}Processor {
|
package/src/eth/context.ts
CHANGED
|
@@ -122,10 +122,7 @@ export class ContractContext<
|
|
|
122
122
|
transaction?: Transaction,
|
|
123
123
|
transactionReceipt?: TransactionReceipt
|
|
124
124
|
) {
|
|
125
|
-
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
const address = view.rawContract.getAddress() as string
|
|
128
|
-
super(chainId, address, timestamp, block, log, trace, transaction, transactionReceipt)
|
|
125
|
+
super(chainId, view.address, timestamp, block, log, trace, transaction, transactionReceipt)
|
|
129
126
|
view.context = this
|
|
130
127
|
this.contractName = contractName
|
|
131
128
|
this.contract = view
|
|
@@ -154,10 +151,12 @@ export class ContractView<TContract extends BaseContract> {
|
|
|
154
151
|
|
|
155
152
|
export class BoundContractView<TContract extends BaseContract, TContractView extends ContractView<TContract>> {
|
|
156
153
|
protected view: TContractView
|
|
154
|
+
readonly address: string
|
|
157
155
|
// context will be set right after context creation (in context's constructor)
|
|
158
156
|
context: ContractContext<TContract, BoundContractView<TContract, TContractView>>
|
|
159
157
|
|
|
160
|
-
constructor(view: TContractView) {
|
|
158
|
+
constructor(address: string, view: TContractView) {
|
|
159
|
+
this.address = address
|
|
161
160
|
this.view = view
|
|
162
161
|
}
|
|
163
162
|
|
|
@@ -17,7 +17,7 @@ export class GenericProcessor extends BaseProcessor<
|
|
|
17
17
|
|
|
18
18
|
protected CreateBoundContractView(): BoundContractView<BaseContract, ContractView<BaseContract>> {
|
|
19
19
|
const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network))
|
|
20
|
-
return new BoundContractView(new ContractView<BaseContract>(contract))
|
|
20
|
+
return new BoundContractView(this.config.address, new ContractView<BaseContract>(contract))
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
public static bind(eventABI: string[] | string, options: BindOptions): GenericProcessor {
|