@sentio/sdk 2.41.3-rc.2 → 2.41.3-rc.4
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/btc/btc-plugin.d.ts +17 -0
- package/lib/btc/btc-plugin.d.ts.map +1 -0
- package/lib/btc/btc-plugin.js +75 -0
- package/lib/btc/btc-plugin.js.map +1 -0
- package/lib/btc/btc-processor.d.ts +25 -0
- package/lib/btc/btc-processor.d.ts.map +1 -0
- package/lib/btc/btc-processor.js +30 -0
- package/lib/btc/btc-processor.js.map +1 -0
- package/lib/btc/index.d.ts +4 -0
- package/lib/btc/index.d.ts.map +1 -0
- package/lib/btc/index.js +4 -0
- package/lib/btc/index.js.map +1 -0
- package/lib/btc/types.d.ts +71 -0
- package/lib/btc/types.d.ts.map +1 -0
- package/lib/btc/types.js +31 -0
- package/lib/btc/types.js.map +1 -0
- package/lib/fuel/base-processor.d.ts +0 -2
- package/lib/fuel/base-processor.d.ts.map +1 -1
- package/lib/fuel/base-processor.js +1 -6
- package/lib/fuel/base-processor.js.map +1 -1
- package/lib/fuel/codegen/codegen.d.ts.map +1 -1
- package/lib/fuel/codegen/codegen.js +17 -26
- package/lib/fuel/codegen/codegen.js.map +1 -1
- package/lib/fuel/context.d.ts +2 -2
- package/lib/fuel/context.d.ts.map +1 -1
- package/lib/fuel/context.js +2 -3
- package/lib/fuel/context.js.map +1 -1
- package/lib/fuel/network.d.ts.map +1 -1
- package/lib/fuel/network.js +1 -2
- package/lib/fuel/network.js.map +1 -1
- package/lib/fuel/transaction.d.ts.map +1 -1
- package/lib/fuel/transaction.js +2 -1
- package/lib/fuel/transaction.js.map +1 -1
- package/lib/testing/btc-facet.d.ts +10 -0
- package/lib/testing/btc-facet.d.ts.map +1 -0
- package/lib/testing/btc-facet.js +38 -0
- package/lib/testing/btc-facet.js.map +1 -0
- package/lib/testing/test-processor-server.d.ts +2 -0
- package/lib/testing/test-processor-server.d.ts.map +1 -1
- package/lib/testing/test-processor-server.js +3 -0
- package/lib/testing/test-processor-server.js.map +1 -1
- package/package.json +7 -6
- package/src/btc/btc-plugin.ts +105 -0
- package/src/btc/btc-processor.ts +50 -0
- package/src/btc/index.ts +3 -0
- package/src/btc/types.ts +93 -0
- package/src/fuel/base-processor.ts +7 -7
- package/src/fuel/codegen/codegen.ts +20 -28
- package/src/fuel/context.ts +3 -3
- package/src/fuel/network.ts +1 -2
- package/src/fuel/transaction.ts +3 -1
- package/src/testing/btc-facet.ts +45 -0
- package/src/testing/test-processor-server.ts +3 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
import { HandlerType } from '@sentio/protos';
|
2
|
+
import { BTCChainId } from '@sentio/chain';
|
3
|
+
import '../btc/btc-plugin.js';
|
4
|
+
export class BTCFacet {
|
5
|
+
server;
|
6
|
+
constructor(server) {
|
7
|
+
this.server = server;
|
8
|
+
}
|
9
|
+
testOnTransactions(events, network = BTCChainId.BTC_TESTNET) {
|
10
|
+
const bindings = this.buildBinding(events, network);
|
11
|
+
if (!bindings) {
|
12
|
+
throw Error('Invalid test : ' + JSON.stringify(events));
|
13
|
+
}
|
14
|
+
return this.server.processBindings({
|
15
|
+
bindings
|
16
|
+
});
|
17
|
+
}
|
18
|
+
buildBinding(data, network) {
|
19
|
+
const res = [];
|
20
|
+
for (const config of this.server.contractConfigs) {
|
21
|
+
if (config.contract?.chainId !== network) {
|
22
|
+
continue;
|
23
|
+
}
|
24
|
+
for (const txConfig of config.btcTransactionConfigs) {
|
25
|
+
const binding = {
|
26
|
+
data: {
|
27
|
+
btcTransaction: data
|
28
|
+
},
|
29
|
+
handlerIds: [txConfig.handlerId],
|
30
|
+
handlerType: HandlerType.BTC_TRANSACTION
|
31
|
+
};
|
32
|
+
res.push(binding);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return res;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
//# sourceMappingURL=btc-facet.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"btc-fac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AA;IACZ,CAAC;CACF"}
|
@@ -8,6 +8,7 @@ import { SuiFacet } from './sui-facet.js';
|
|
8
8
|
import { FuelFacet } from './fuel-facet.js';
|
9
9
|
import { CosmosFacet } from './cosmos-facet.js';
|
10
10
|
import { StarknetFacet } from './starknet-facet.js';
|
11
|
+
import { BTCFacet } from './btc-facet.js';
|
11
12
|
export declare const TEST_CONTEXT: CallContext;
|
12
13
|
export declare function cleanTest(): void;
|
13
14
|
export declare class TestProcessorServer implements ProcessorServiceImplementation {
|
@@ -21,6 +22,7 @@ export declare class TestProcessorServer implements ProcessorServiceImplementati
|
|
21
22
|
fuel: FuelFacet;
|
22
23
|
cosmos: CosmosFacet;
|
23
24
|
starknet: StarknetFacet;
|
25
|
+
btc: BTCFacet;
|
24
26
|
constructor(loader: () => Promise<any>, httpEndpoints?: Record<string, string>);
|
25
27
|
start(request?: StartRequest, context?: CallContext): Promise<Empty>;
|
26
28
|
stop(request: Empty, context?: CallContext): Promise<Empty>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"test-processor-server.d.ts","sourceRoot":"","sources":["../../src/testing/test-processor-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,EACX,KAAK,EACL,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACb,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAa,oBAAoB,EAAS,MAAM,iBAAiB,CAAA;AAGxE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,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osmos-facet.js';
|
9
9
|
import { StarknetFacet } from './starknet-facet.js';
|
10
|
+
import { BTCFacet } from './btc-facet.js';
|
10
11
|
export const TEST_CONTEXT = {};
|
11
12
|
export function cleanTest() {
|
12
13
|
State.reset();
|
@@ -22,6 +23,7 @@ export class TestProcessorServer {
|
|
22
23
|
fuel;
|
23
24
|
cosmos;
|
24
25
|
starknet;
|
26
|
+
btc;
|
25
27
|
constructor(loader, httpEndpoints = {}) {
|
26
28
|
cleanTest();
|
27
29
|
this.service = new ProcessorServiceImpl(loader);
|
@@ -32,6 +34,7 @@ export class TestProcessorServer {
|
|
32
34
|
this.fuel = new FuelFacet(this);
|
33
35
|
this.cosmos = new CosmosFacet(this);
|
34
36
|
this.starknet = new StarknetFacet(this);
|
37
|
+
this.btc = new BTCFacet(this);
|
35
38
|
for (const k in CHAIN_MAP) {
|
36
39
|
const http = httpEndpoints[k] || '';
|
37
40
|
Endpoints.INSTANCE.chainServer.set(k, http);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"test-processor-server.js","sourceRoot":"","sources":["../../src/testing/test-processor-server.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
1
|
+
{"version":3,"file":"test-processor-server.js","sourceRoot":"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S,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED,eAAe,CACb,OAA+B,EAC/B,UAAuB,YAAY;QAEnC,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IAED,cAAc,CAAC,OAAoB,EAAE,UAAuB,YAAY;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IACvE,CAAC;IAED,qBAAqB,CACnB,QAA6C,EAC7C,OAAoB;QAEpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IAED,wBAAwB,CACtB,QAAgD,EAChD,OAAoB;QAEpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;CAKF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/sdk",
|
3
|
-
"version": "2.41.3-rc.
|
3
|
+
"version": "2.41.3-rc.4",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -39,7 +39,8 @@
|
|
39
39
|
"./fuel": "./lib/fuel/index.js",
|
40
40
|
"./fuel/codegen": "./lib/fuel/codegen/index.js",
|
41
41
|
"./store": "./lib/store/index.js",
|
42
|
-
"./store/codegen": "./lib/store/codegen.js"
|
42
|
+
"./store/codegen": "./lib/store/codegen.js",
|
43
|
+
"./btc": "./lib/btc/index.js"
|
43
44
|
},
|
44
45
|
"files": [
|
45
46
|
"{lib,src}",
|
@@ -54,7 +55,7 @@
|
|
54
55
|
"@project-serum/anchor": "^0.26.0",
|
55
56
|
"@sentio/abi-wan-kanabi": "2.2.2-1",
|
56
57
|
"@sentio/bigdecimal": "9.1.1-patch.3",
|
57
|
-
"@sentio/chain": "^2.1.
|
58
|
+
"@sentio/chain": "^2.1.6",
|
58
59
|
"@sentio/ethers-v6": "^1.0.29",
|
59
60
|
"@solana/web3.js": "1.91.8",
|
60
61
|
"@typemove/aptos": "~1.6.3",
|
@@ -64,7 +65,7 @@
|
|
64
65
|
"chalk": "^5.3.0",
|
65
66
|
"csv-parse": "^5.5.3",
|
66
67
|
"ethers": "npm:@sentio/ethers@6.13.1-patch.1",
|
67
|
-
"fuels": "^0.
|
68
|
+
"fuels": "^0.94.1",
|
68
69
|
"graphql": "^16.9.0",
|
69
70
|
"js-sha3": "^0.9.3",
|
70
71
|
"lru-cache": "^11.0.0",
|
@@ -83,8 +84,8 @@
|
|
83
84
|
"typechain": "^8.3.2",
|
84
85
|
"utility-types": "^3.11.0",
|
85
86
|
"yaml": "^2.3.4",
|
86
|
-
"@sentio/runtime": "^2.41.3-rc.
|
87
|
-
"@sentio/protos": "2.41.3-rc.
|
87
|
+
"@sentio/runtime": "^2.41.3-rc.4",
|
88
|
+
"@sentio/protos": "2.41.3-rc.4"
|
88
89
|
},
|
89
90
|
"peerDependencies": {
|
90
91
|
"tsup": "npm:@sentio/tsup@^6.7.2"
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
|
2
|
+
import {
|
3
|
+
ContractConfig,
|
4
|
+
Data_BTCTransaction,
|
5
|
+
DataBinding,
|
6
|
+
HandlerType,
|
7
|
+
ProcessConfigResponse,
|
8
|
+
ProcessResult,
|
9
|
+
StartRequest
|
10
|
+
} from '@sentio/protos'
|
11
|
+
|
12
|
+
import { ServerError, Status } from 'nice-grpc'
|
13
|
+
import { TemplateInstanceState } from '../core/template.js'
|
14
|
+
import { BTCProcessorState } from './btc-processor.js'
|
15
|
+
|
16
|
+
interface Handlers {
|
17
|
+
txHandlers: ((trace: Data_BTCTransaction) => Promise<ProcessResult>)[]
|
18
|
+
}
|
19
|
+
|
20
|
+
export class BTCPlugin extends Plugin {
|
21
|
+
name: string = 'BTCPlugin'
|
22
|
+
handlers: Handlers = {
|
23
|
+
txHandlers: []
|
24
|
+
}
|
25
|
+
|
26
|
+
async configure(config: ProcessConfigResponse) {
|
27
|
+
const handlers: Handlers = {
|
28
|
+
txHandlers: []
|
29
|
+
}
|
30
|
+
|
31
|
+
for (const processor of BTCProcessorState.INSTANCE.getValues()) {
|
32
|
+
const contractConfig = ContractConfig.fromPartial({
|
33
|
+
processorType: USER_PROCESSOR,
|
34
|
+
contract: {
|
35
|
+
name: processor.config.name,
|
36
|
+
chainId: processor.config.chainId.toString(),
|
37
|
+
address: processor.config.address || '*',
|
38
|
+
abi: ''
|
39
|
+
},
|
40
|
+
startBlock: processor.config.startBlock,
|
41
|
+
endBlock: processor.config.endBlock
|
42
|
+
})
|
43
|
+
for (const callHandler of processor.callHandlers) {
|
44
|
+
const handlerId = handlers.txHandlers.push(callHandler.handler) - 1
|
45
|
+
|
46
|
+
contractConfig.btcTransactionConfigs.push({
|
47
|
+
filters: [
|
48
|
+
{
|
49
|
+
address: contractConfig.contract?.address || '*'
|
50
|
+
}
|
51
|
+
],
|
52
|
+
handlerId
|
53
|
+
})
|
54
|
+
}
|
55
|
+
|
56
|
+
// Finish up a contract
|
57
|
+
config.contractConfigs.push(contractConfig)
|
58
|
+
}
|
59
|
+
|
60
|
+
this.handlers = handlers
|
61
|
+
}
|
62
|
+
|
63
|
+
supportedHandlers = [HandlerType.BTC_TRANSACTION]
|
64
|
+
|
65
|
+
processBinding(request: DataBinding): Promise<ProcessResult> {
|
66
|
+
switch (request.handlerType) {
|
67
|
+
case HandlerType.BTC_TRANSACTION:
|
68
|
+
return this.processTransaction(request)
|
69
|
+
default:
|
70
|
+
throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
async start(request: StartRequest) {}
|
75
|
+
|
76
|
+
stateDiff(config: ProcessConfigResponse): boolean {
|
77
|
+
return TemplateInstanceState.INSTANCE.getValues().length !== config.templateInstances.length
|
78
|
+
}
|
79
|
+
|
80
|
+
async processTransaction(binding: DataBinding): Promise<ProcessResult> {
|
81
|
+
if (!binding.data?.btcTransaction) {
|
82
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "BTCEvents can't be null")
|
83
|
+
}
|
84
|
+
|
85
|
+
const promises: Promise<ProcessResult>[] = []
|
86
|
+
|
87
|
+
const result = binding.data?.btcTransaction
|
88
|
+
|
89
|
+
for (const handlerId of binding.handlerIds) {
|
90
|
+
const promise = this.handlers.txHandlers[handlerId](binding.data?.btcTransaction).catch((e) => {
|
91
|
+
throw new ServerError(
|
92
|
+
Status.INTERNAL,
|
93
|
+
'error processing transaction: ' + JSON.stringify(result) + '\n' + errorString(e)
|
94
|
+
)
|
95
|
+
})
|
96
|
+
if (GLOBAL_CONFIG.execution.sequential) {
|
97
|
+
await promise
|
98
|
+
}
|
99
|
+
promises.push(promise)
|
100
|
+
}
|
101
|
+
return mergeProcessResults(await Promise.all(promises))
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
PluginManager.INSTANCE.register(new BTCPlugin())
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { ListStateStorage } from '@sentio/runtime'
|
2
|
+
import { BTCContext, Transaction } from './types.js'
|
3
|
+
import { Data_BTCTransaction, ProcessResult } from '@sentio/protos'
|
4
|
+
|
5
|
+
export class BTCProcessorState extends ListStateStorage<BTCProcessor> {
|
6
|
+
static INSTANCE = new BTCProcessorState()
|
7
|
+
}
|
8
|
+
|
9
|
+
export class BTCProcessor {
|
10
|
+
callHandlers: CallHandler<Data_BTCTransaction>[] = []
|
11
|
+
|
12
|
+
constructor(readonly config: BTCProcessorConfig) {}
|
13
|
+
|
14
|
+
static bind(config: BTCProcessorConfig): BTCProcessor {
|
15
|
+
const processor = new BTCProcessor(config)
|
16
|
+
BTCProcessorState.INSTANCE.addValue(processor)
|
17
|
+
return processor
|
18
|
+
}
|
19
|
+
|
20
|
+
public onTransaction(handler: (transaction: Transaction, ctx: BTCContext) => void | Promise<void>) {
|
21
|
+
const callHandler = {
|
22
|
+
handler: async (call: Data_BTCTransaction) => {
|
23
|
+
const tx = call.transaction as Transaction
|
24
|
+
|
25
|
+
const ctx = new BTCContext(
|
26
|
+
this.config.chainId,
|
27
|
+
this.config.name ?? this.config.address ?? '',
|
28
|
+
tx,
|
29
|
+
this.config.address
|
30
|
+
)
|
31
|
+
await handler(tx, ctx)
|
32
|
+
return ctx.stopAndGetResult()
|
33
|
+
}
|
34
|
+
}
|
35
|
+
this.callHandlers.push(callHandler)
|
36
|
+
return this
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
interface BTCProcessorConfig {
|
41
|
+
chainId: string
|
42
|
+
name?: string
|
43
|
+
address: string
|
44
|
+
startBlock?: bigint
|
45
|
+
endBlock?: bigint
|
46
|
+
}
|
47
|
+
|
48
|
+
export type CallHandler<T> = {
|
49
|
+
handler: (call: T) => Promise<ProcessResult>
|
50
|
+
}
|
package/src/btc/index.ts
ADDED
package/src/btc/types.ts
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
import { BaseContext, Labels, normalizeLabels } from '../core/index.js'
|
2
|
+
import { RecordMetaData } from '@sentio/protos'
|
3
|
+
import { ChainId } from '@sentio/chain'
|
4
|
+
|
5
|
+
type Vin = {
|
6
|
+
txid: string
|
7
|
+
vout: number
|
8
|
+
is_coinbase: boolean
|
9
|
+
scriptsig: string
|
10
|
+
scriptsig_asm: string
|
11
|
+
inner_redeemscript_asm?: string
|
12
|
+
inner_witnessscript_asm?: string
|
13
|
+
sequence: number
|
14
|
+
witness: string[]
|
15
|
+
prevout: Vout
|
16
|
+
is_pegin?: boolean
|
17
|
+
issuance?: {
|
18
|
+
asset_id: string
|
19
|
+
is_reissuance: boolean
|
20
|
+
asset_blinding_nonce: string
|
21
|
+
asset_entropy: string
|
22
|
+
contract_hash: string
|
23
|
+
assetamount?: number
|
24
|
+
assetamountcommitment?: string
|
25
|
+
tokenamount?: number
|
26
|
+
tokenamountcommitment?: string
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
type Vout = {
|
31
|
+
scriptpubkey: string
|
32
|
+
scriptpubkey_asm: string
|
33
|
+
scriptpubkey_type: string
|
34
|
+
scriptpubkey_address: string
|
35
|
+
value: number
|
36
|
+
valuecommitment?: string
|
37
|
+
asset?: string
|
38
|
+
assetcommitment?: string
|
39
|
+
pegout?: {
|
40
|
+
genesis_hash: string
|
41
|
+
scriptpubkey: string
|
42
|
+
scriptpubkey_asm: string
|
43
|
+
scriptpubkey_address: string
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
type Status = {
|
48
|
+
confirmed: boolean
|
49
|
+
block_height?: number
|
50
|
+
block_hash?: string
|
51
|
+
block_time?: number
|
52
|
+
}
|
53
|
+
|
54
|
+
export type Transaction = {
|
55
|
+
txid: string
|
56
|
+
version: number
|
57
|
+
locktime: number
|
58
|
+
size: number
|
59
|
+
weight: number
|
60
|
+
fee: number
|
61
|
+
vin: Vin[]
|
62
|
+
vout: Vout[]
|
63
|
+
status: Status
|
64
|
+
}
|
65
|
+
|
66
|
+
export class BTCContext extends BaseContext {
|
67
|
+
constructor(
|
68
|
+
readonly chainId: string,
|
69
|
+
readonly name: string,
|
70
|
+
readonly tx: Transaction,
|
71
|
+
readonly address: string
|
72
|
+
) {
|
73
|
+
super({})
|
74
|
+
}
|
75
|
+
|
76
|
+
protected getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
77
|
+
return {
|
78
|
+
address: this.address,
|
79
|
+
contractName: this.name,
|
80
|
+
blockNumber: BigInt(this.tx.status?.block_time ?? 0),
|
81
|
+
transactionIndex: 0,
|
82
|
+
transactionHash: this.tx.txid,
|
83
|
+
chainId: this.getChainId(),
|
84
|
+
name: name,
|
85
|
+
logIndex: 0,
|
86
|
+
labels: normalizeLabels(labels)
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
getChainId(): ChainId {
|
91
|
+
return this.chainId as ChainId
|
92
|
+
}
|
93
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FuelProcessor, FuelProcessorConfig } from './fuel-processor.js'
|
2
2
|
import { JsonAbi } from 'fuels'
|
3
|
-
import { FuelCall } from './context.js'
|
3
|
+
// import { FuelCall } from './context.js'
|
4
4
|
import { FuelChainId } from '@sentio/chain'
|
5
5
|
import { FuelLog, FuelProcessorState } from './types.js'
|
6
6
|
|
@@ -24,10 +24,10 @@ export class TypedCall<T extends Array<any>, R> {
|
|
24
24
|
argsObject?: Record<string, any>
|
25
25
|
logs?: FuelLog<unknown>[]
|
26
26
|
|
27
|
-
constructor(call: FuelCall) {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
27
|
+
// constructor(call: FuelCall) {
|
28
|
+
// this.args = call.args as T
|
29
|
+
// this.returnValue = call.value as R
|
30
|
+
// this.argsObject = call.args
|
31
|
+
// this.logs = call.logs
|
32
|
+
// }
|
33
33
|
}
|
@@ -4,6 +4,7 @@ import { AbiTypeGen, IFile, IFunction, ProgramTypeEnum } from '@fuel-ts/abi-type
|
|
4
4
|
import mkdirp from 'mkdirp'
|
5
5
|
import path from 'path'
|
6
6
|
import { upperFirst } from './utils.js'
|
7
|
+
import { versions as builtinVersions } from '@fuel-ts/versions'
|
7
8
|
|
8
9
|
export async function codegen(abisDir: string, outDir: string) {
|
9
10
|
if (!fs.existsSync(abisDir)) {
|
@@ -15,24 +16,7 @@ export async function codegen(abisDir: string, outDir: string) {
|
|
15
16
|
}
|
16
17
|
|
17
18
|
function patchImport(contents: string) {
|
18
|
-
return (
|
19
|
-
contents
|
20
|
-
/* .replace(
|
21
|
-
`import { Interface, Contract, ContractFactory } from "fuels";`,
|
22
|
-
`import { Contract, } from "@fuel-ts/program";
|
23
|
-
import { ContractFactory } from "@fuel-ts/contract";
|
24
|
-
import { Interface } from "@fuel-ts/abi-coder";`
|
25
|
-
)
|
26
|
-
.replace(
|
27
|
-
`import type { Provider, Account, AbstractAddress, BytesLike, DeployContractOptions, StorageSlot } from "fuels";
|
28
|
-
`,
|
29
|
-
`import type { Provider, Account } from "@fuel-ts/account";
|
30
|
-
import type { AbstractAddress, BytesLike } from "@fuel-ts/interfaces";
|
31
|
-
import type { DeployContractOptions } from "@fuel-ts/contract";
|
32
|
-
import type { StorageSlot } from "@fuel-ts/transactions";`
|
33
|
-
)*/
|
34
|
-
.replace(/from\s+['"](\..+)['"]/g, `from '\$1.js'`)
|
35
|
-
)
|
19
|
+
return contents.replace(/from\s+['"](\..+)['"]/g, `from '\$1.js'`)
|
36
20
|
}
|
37
21
|
|
38
22
|
/*function patchEnumType(contents: string) {
|
@@ -77,11 +61,11 @@ async function codegenInternal(abisDir: string, outDir: string): Promise<number>
|
|
77
61
|
binFiles: [],
|
78
62
|
storageSlotsFiles: [],
|
79
63
|
outputDir: outDir,
|
80
|
-
programType: ProgramTypeEnum.CONTRACT
|
64
|
+
programType: ProgramTypeEnum.CONTRACT,
|
65
|
+
versions: { FUELS: builtinVersions.FUELS }
|
81
66
|
})
|
82
67
|
|
83
68
|
mkdirp.sync(outDir)
|
84
|
-
mkdirp.sync(path.join(outDir, 'factories'))
|
85
69
|
let count = 0
|
86
70
|
abiTypeGen.files.forEach((file) => {
|
87
71
|
if (!file.path.endsWith('.hex.ts')) {
|
@@ -101,15 +85,21 @@ async function codegenInternal(abisDir: string, outDir: string): Promise<number>
|
|
101
85
|
// }
|
102
86
|
|
103
87
|
for (const abi of abiTypeGen.abis) {
|
104
|
-
const name = abi.
|
88
|
+
const name = abi.capitalizedName.endsWith('Abi') ? abi.capitalizedName.slice(0, -3) : abi.capitalizedName
|
105
89
|
const filePath = path.join(outDir, `${name}Processor.ts`)
|
106
90
|
const importedTypes = collectImportedTypes(abi.types)
|
107
91
|
|
108
92
|
const logByTypes: Record<string, string[]> = {}
|
109
93
|
|
110
94
|
for (const logType of abi.rawContents.loggedTypes) {
|
95
|
+
const metadataTypeId = abi.rawContents.concreteTypes.find(
|
96
|
+
(t) => t.concreteTypeId == logType.concreteTypeId
|
97
|
+
)?.metadataTypeId
|
111
98
|
// @ts-ignore - we know that the type is in the abi
|
112
|
-
|
99
|
+
let t = abi.types.find((t) => t.rawAbiType.concreteTypeId == logType.concreteTypeId)
|
100
|
+
if (!t) {
|
101
|
+
t = abi.types.find((t) => t.rawAbiType.typeId == metadataTypeId)
|
102
|
+
}
|
113
103
|
// @ts-ignore - we know that the type is in the abi
|
114
104
|
const typeName = t?.attributes?.outputLabel
|
115
105
|
if (typeName) {
|
@@ -126,15 +116,14 @@ async function codegenInternal(abisDir: string, outDir: string): Promise<number>
|
|
126
116
|
/* eslint-disable */
|
127
117
|
|
128
118
|
import { FuelAbstractProcessor, FuelContext, FuelProcessorConfig, TypedCall, FuelFetchConfig, FuelCall, FuelLog} from '@sentio/sdk/fuel'
|
129
|
-
import {${abi.name}__factory } from './factories/${abi.name}__factory.js'
|
130
119
|
import {${abi.commonTypesInUse.join(',')}} from './common.js'
|
131
|
-
import {${importedTypes.join(',')}} from './${abi.
|
120
|
+
import {${importedTypes.join(',')}, ${abi.capitalizedName}} from './${abi.capitalizedName}.js'
|
132
121
|
|
133
122
|
import type { BigNumberish, BN } from 'fuels';
|
134
|
-
import type { BytesLike } from 'fuels';
|
123
|
+
import type { BytesLike, Bytes } from 'fuels';
|
135
124
|
|
136
125
|
|
137
|
-
namespace ${name} {
|
126
|
+
namespace ${name}NS {
|
138
127
|
export abstract class CallWithLogs<T extends Array<any>, R> extends TypedCall<T, R> {
|
139
128
|
${Object.entries(logByTypes)
|
140
129
|
.flatMap(([t, ids]) => {
|
@@ -149,12 +138,15 @@ ${Object.entries(logByTypes)
|
|
149
138
|
.join('\n')}
|
150
139
|
}
|
151
140
|
|
152
|
-
${
|
141
|
+
${
|
142
|
+
''
|
143
|
+
// abi.functions.map(genCallType).join('\n')
|
144
|
+
}
|
153
145
|
}
|
154
146
|
|
155
147
|
export class ${name}Processor extends FuelAbstractProcessor {
|
156
148
|
constructor(config?: FuelProcessorConfig) {
|
157
|
-
super(${abi.
|
149
|
+
super(${abi.capitalizedName}.abi, config)
|
158
150
|
}
|
159
151
|
|
160
152
|
static bind(config: FuelProcessorConfig) {
|
package/src/fuel/context.ts
CHANGED
@@ -2,11 +2,11 @@ import { BaseContext, Labels, normalizeLabels } from '../core/index.js'
|
|
2
2
|
import { ChainId } from '@sentio/chain'
|
3
3
|
import { RecordMetaData } from '@sentio/protos'
|
4
4
|
import type { CallResult } from 'fuels'
|
5
|
-
import {
|
5
|
+
import { InvocationScopeLike } from 'fuels'
|
6
6
|
import { FuelTransaction } from './transaction.js'
|
7
7
|
import { FuelLog } from './types.js'
|
8
8
|
|
9
|
-
export class FuelCall
|
9
|
+
export class FuelCall {
|
10
10
|
constructor(
|
11
11
|
funcScopes: InvocationScopeLike | Array<InvocationScopeLike>,
|
12
12
|
callResult: CallResult,
|
@@ -14,7 +14,7 @@ export class FuelCall extends InvocationCallResult {
|
|
14
14
|
readonly args?: Record<string, any>,
|
15
15
|
readonly logs?: FuelLog<unknown>[]
|
16
16
|
) {
|
17
|
-
super(funcScopes, callResult, isMultiCall)
|
17
|
+
// super(funcScopes, callResult, isMultiCall)
|
18
18
|
}
|
19
19
|
}
|
20
20
|
|
package/src/fuel/network.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { FuelChainId } from '@sentio/chain'
|
2
|
-
import { FUEL_NETWORK_URL } from 'fuels'
|
3
2
|
|
4
3
|
export type FuelNetwork = FuelChainId
|
5
4
|
export const FuelNetwork = <const>{
|
@@ -12,5 +11,5 @@ export function getRpcEndpoint(network: FuelNetwork): string {
|
|
12
11
|
case FuelNetwork.TEST_NET:
|
13
12
|
return 'https://testnet.fuel.network/v1/graphql'
|
14
13
|
}
|
15
|
-
return
|
14
|
+
return 'https://testnet.fuel.network/v1/graphql'
|
16
15
|
}
|
package/src/fuel/transaction.ts
CHANGED
@@ -108,10 +108,12 @@ export async function decodeFuelTransactionWithAbi(
|
|
108
108
|
}
|
109
109
|
})
|
110
110
|
|
111
|
-
const txResponse = new TransactionResponse(gqlTransaction.
|
111
|
+
const txResponse = new TransactionResponse(gqlTransaction.status.transactionId, provider, {
|
112
112
|
main: Object.values(abiMap)[0],
|
113
113
|
otherContractsAbis: {}
|
114
114
|
})
|
115
|
+
|
116
|
+
// @ts-ignore - hack
|
115
117
|
txResponse.gqlTransaction = {
|
116
118
|
...gqlTransaction,
|
117
119
|
status: gqlTransactionStatus
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { TestProcessorServer } from './test-processor-server.js'
|
2
|
+
import { DataBinding, HandlerType } from '@sentio/protos'
|
3
|
+
import { BTCChainId } from '@sentio/chain'
|
4
|
+
import '../btc/btc-plugin.js'
|
5
|
+
|
6
|
+
export class BTCFacet {
|
7
|
+
server: TestProcessorServer
|
8
|
+
|
9
|
+
constructor(server: TestProcessorServer) {
|
10
|
+
this.server = server
|
11
|
+
}
|
12
|
+
|
13
|
+
testOnTransactions(events: any, network: BTCChainId = BTCChainId.BTC_TESTNET) {
|
14
|
+
const bindings = this.buildBinding(events, network)
|
15
|
+
if (!bindings) {
|
16
|
+
throw Error('Invalid test : ' + JSON.stringify(events))
|
17
|
+
}
|
18
|
+
|
19
|
+
return this.server.processBindings({
|
20
|
+
bindings
|
21
|
+
})
|
22
|
+
}
|
23
|
+
|
24
|
+
private buildBinding(data: any, network: BTCChainId): DataBinding[] {
|
25
|
+
const res: DataBinding[] = []
|
26
|
+
|
27
|
+
for (const config of this.server.contractConfigs) {
|
28
|
+
if (config.contract?.chainId !== network) {
|
29
|
+
continue
|
30
|
+
}
|
31
|
+
|
32
|
+
for (const txConfig of config.btcTransactionConfigs) {
|
33
|
+
const binding = {
|
34
|
+
data: {
|
35
|
+
btcTransaction: data
|
36
|
+
},
|
37
|
+
handlerIds: [txConfig.handlerId],
|
38
|
+
handlerType: HandlerType.BTC_TRANSACTION
|
39
|
+
} as DataBinding
|
40
|
+
res.push(binding)
|
41
|
+
}
|
42
|
+
}
|
43
|
+
return res
|
44
|
+
}
|
45
|
+
}
|
@@ -27,6 +27,7 @@ import { SuiFacet } from './sui-facet.js'
|
|
27
27
|
import { FuelFacet } from './fuel-facet.js'
|
28
28
|
import { CosmosFacet } from './cosmos-facet.js'
|
29
29
|
import { StarknetFacet } from './starknet-facet.js'
|
30
|
+
import { BTCFacet } from './btc-facet.js'
|
30
31
|
|
31
32
|
export const TEST_CONTEXT: CallContext = <CallContext>{}
|
32
33
|
|
@@ -46,6 +47,7 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
46
47
|
fuel: FuelFacet
|
47
48
|
cosmos: CosmosFacet
|
48
49
|
starknet: StarknetFacet
|
50
|
+
btc: BTCFacet
|
49
51
|
|
50
52
|
constructor(loader: () => Promise<any>, httpEndpoints: Record<string, string> = {}) {
|
51
53
|
cleanTest()
|
@@ -58,6 +60,7 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
58
60
|
this.fuel = new FuelFacet(this)
|
59
61
|
this.cosmos = new CosmosFacet(this)
|
60
62
|
this.starknet = new StarknetFacet(this)
|
63
|
+
this.btc = new BTCFacet(this)
|
61
64
|
|
62
65
|
for (const k in CHAIN_MAP) {
|
63
66
|
const http = httpEndpoints[k] || ''
|