@sentio/sdk 1.27.3 → 1.27.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/processor-runner.js +2 -2
- package/lib/processor-runner.js.map +1 -1
- package/package.json +4 -4
- package/src/processor-runner.ts +2 -2
- package/lib/aptos/types.test.js +0 -19
- package/lib/core/generic-processor.test.js +0 -58
- package/lib/core/meter.test.js +0 -21
- package/lib/core/numberish.test.js +0 -70
- package/lib/tests/aptos.test.d.ts +0 -1
- package/lib/tests/aptos.test.js +0 -379
- package/lib/tests/aptos.test.js.map +0 -1
- package/lib/tests/codegen.test.d.ts +0 -1
- package/lib/tests/codegen.test.js +0 -49
- package/lib/tests/codegen.test.js.map +0 -1
- package/lib/tests/erc20-template.test.d.ts +0 -1
- package/lib/tests/erc20-template.test.js +0 -56
- package/lib/tests/erc20-template.test.js.map +0 -1
- package/lib/tests/erc20.d.ts +0 -1
- package/lib/tests/erc20.js +0 -54
- package/lib/tests/erc20.js.map +0 -1
- package/lib/tests/erc20.test.d.ts +0 -1
- package/lib/tests/erc20.test.js +0 -94
- package/lib/tests/erc20.test.js.map +0 -1
- package/lib/tests/error-capture.test.d.ts +0 -1
- package/lib/tests/error-capture.test.js +0 -76
- package/lib/tests/error-capture.test.js.map +0 -1
- package/lib/tests/logger.test.d.ts +0 -1
- package/lib/tests/logger.test.js +0 -40
- package/lib/tests/logger.test.js.map +0 -1
- package/lib/tests/solana.test.d.ts +0 -1
- package/lib/tests/solana.test.js +0 -77
- package/lib/tests/solana.test.js.map +0 -1
- package/lib/tests/souffl3.d.ts +0 -1
- package/lib/tests/souffl3.js +0 -49
- package/lib/tests/souffl3.js.map +0 -1
- package/lib/tests/sui.test.d.ts +0 -1
- package/lib/tests/sui.test.js +0 -193
- package/lib/tests/sui.test.js.map +0 -1
- package/lib/tests/types/aptos/soffl3.d.ts +0 -786
- package/lib/tests/types/aptos/soffl3.js +0 -559
- package/lib/tests/types/aptos/soffl3.js.map +0 -1
- package/lib/tests/types/aptos/souffle.d.ts +0 -348
- package/lib/tests/types/aptos/souffle.js +0 -303
- package/lib/tests/types/aptos/souffle.js.map +0 -1
- package/lib/tests/types/solana/basic_1.d.ts +0 -26
- package/lib/tests/types/solana/basic_1.js +0 -66
- package/lib/tests/types/solana/basic_1.js.map +0 -1
- package/lib/tests/types/solana/basic_1_processor.d.ts +0 -13
- package/lib/tests/types/solana/basic_1_processor.js +0 -41
- package/lib/tests/types/solana/basic_1_processor.js.map +0 -1
- package/lib/tests/wormhole-token-bridge.d.ts +0 -1
- package/lib/tests/wormhole-token-bridge.js +0 -22
- package/lib/tests/wormhole-token-bridge.js.map +0 -1
- package/lib/utils/dex-price.test.js +0 -22
- package/lib/utils/erc20.test.js +0 -23
- package/src/aptos/types.test.ts +0 -18
- package/src/aptos-codegen/typegen.test.ts +0 -44
- package/src/core/generic-processor.test.ts +0 -69
- package/src/core/meter.test.ts +0 -23
- package/src/core/numberish.test.ts +0 -82
- package/src/tests/abis/aptos/soffl3.json +0 -1411
- package/src/tests/abis/aptos/souffle.json +0 -389
- package/src/tests/abis/evm/CommitmentPool.json +0 -1034
- package/src/tests/abis/evm/Seaport.json +0 -2595
- package/src/tests/abis/evm/anyswapRouter.json +0 -490
- package/src/tests/abis/solana/basic_1.json +0 -62
- package/src/tests/aptos.test.ts +0 -402
- package/src/tests/codegen.test.ts +0 -29
- package/src/tests/erc20-template.test.ts +0 -60
- package/src/tests/erc20.test.ts +0 -115
- package/src/tests/erc20.ts +0 -60
- package/src/tests/error-capture.test.ts +0 -82
- package/src/tests/logger.test.ts +0 -46
- package/src/tests/solana.test.ts +0 -79
- package/src/tests/souffl3.ts +0 -56
- package/src/tests/sui.test.ts +0 -197
- package/src/tests/types/aptos/soffl3.ts +0 -1377
- package/src/tests/types/aptos/souffle.ts +0 -698
- package/src/tests/types/solana/basic_1.ts +0 -62
- package/src/tests/types/solana/basic_1_processor.ts +0 -41
- package/src/tests/wormhole-token-bridge.ts +0 -21
- package/src/types/global.d.ts +0 -5
- package/src/utils/dex-price.test.ts +0 -25
- package/src/utils/erc20.test.ts +0 -26
- package/templates/aptos/.gitignore +0 -107
- package/templates/aptos/src/processor.test.ts +0 -14
- package/templates/evm/.gitignore +0 -107
- package/templates/evm/src/processor.test.ts +0 -29
- package/templates/raw/.gitignore +0 -107
- package/templates/raw/src/processor.test.ts +0 -14
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { assert } from 'chai'
|
|
2
|
-
|
|
3
|
-
import { TestProcessorServer } from '../testing'
|
|
4
|
-
import { BigNumber } from 'ethers'
|
|
5
|
-
import { mockApprovalLog, mockOwnershipTransferredLog, mockTransferLog } from '../builtin/erc20/test-utils'
|
|
6
|
-
import { ERC20Processor } from '../builtin/internal/erc20_processor'
|
|
7
|
-
import { conversion } from '../utils'
|
|
8
|
-
import { BigDecimal } from '@sentio/sdk'
|
|
9
|
-
|
|
10
|
-
describe('Test Error Capture', () => {
|
|
11
|
-
const service = new TestProcessorServer(() => {
|
|
12
|
-
ERC20Processor.bind({ address: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91' })
|
|
13
|
-
.onEventApproval((evt, ctx) => {
|
|
14
|
-
const v = new BigDecimal(1).div(conversion.toBigDecimal(evt.args.value))
|
|
15
|
-
ctx.meter.Gauge('xx').record(v)
|
|
16
|
-
})
|
|
17
|
-
.onEventTransfer((evt, ctx) => {
|
|
18
|
-
const v = new BigDecimal(0).div(conversion.toBigDecimal(evt.args.value))
|
|
19
|
-
ctx.meter.Gauge('xx').record(v)
|
|
20
|
-
})
|
|
21
|
-
.onEventOwnershipTransferred((evt, ctx) => {
|
|
22
|
-
ctx.meter.Gauge('xx').record(BigNumber.from(10 ** 18))
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
beforeAll(async () => {
|
|
27
|
-
await service.start()
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
test('Check infinite', async () => {
|
|
31
|
-
let err: Error | undefined
|
|
32
|
-
try {
|
|
33
|
-
// TODO check why order matters
|
|
34
|
-
// await service.testLog(mockApprovalLog("0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91", {
|
|
35
|
-
// value: BigNumber.from(3000000),
|
|
36
|
-
// spender: "0x0000000000000000000000000000000000000000",
|
|
37
|
-
// owner: "0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91"
|
|
38
|
-
// }))
|
|
39
|
-
await service.testLog(
|
|
40
|
-
mockApprovalLog('0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91', {
|
|
41
|
-
owner: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91',
|
|
42
|
-
spender: '0x0000000000000000000000000000000000000000',
|
|
43
|
-
value: BigNumber.from(0),
|
|
44
|
-
})
|
|
45
|
-
)
|
|
46
|
-
} catch (e) {
|
|
47
|
-
err = e
|
|
48
|
-
}
|
|
49
|
-
assert(err?.message.includes('Record infinite value'))
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
test('Check NaN', async () => {
|
|
53
|
-
let err: Error | undefined
|
|
54
|
-
try {
|
|
55
|
-
await service.testLog(
|
|
56
|
-
mockTransferLog('0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91', {
|
|
57
|
-
from: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91',
|
|
58
|
-
to: '0x0000000000000000000000000000000000000000',
|
|
59
|
-
value: BigNumber.from(0),
|
|
60
|
-
})
|
|
61
|
-
)
|
|
62
|
-
} catch (e) {
|
|
63
|
-
err = e
|
|
64
|
-
}
|
|
65
|
-
assert(err?.message.includes('NaN'))
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
test('Check overflow', async () => {
|
|
69
|
-
let err: Error | undefined
|
|
70
|
-
try {
|
|
71
|
-
await service.testLog(
|
|
72
|
-
mockOwnershipTransferredLog('0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91', {
|
|
73
|
-
previousOwner: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91',
|
|
74
|
-
newOwner: '0x0000000000000000000000000000000000000000',
|
|
75
|
-
})
|
|
76
|
-
)
|
|
77
|
-
} catch (e) {
|
|
78
|
-
err = e
|
|
79
|
-
}
|
|
80
|
-
assert(err?.message.includes('overflow'))
|
|
81
|
-
})
|
|
82
|
-
})
|
package/src/tests/logger.test.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { assert, expect } from 'chai'
|
|
2
|
-
|
|
3
|
-
import { TestProcessorServer } from '../testing'
|
|
4
|
-
import { BigNumber } from 'ethers'
|
|
5
|
-
import { mockApprovalLog, mockTransferLog } from '../builtin/erc20/test-utils'
|
|
6
|
-
import { ERC20Processor } from '../builtin/internal/erc20_processor'
|
|
7
|
-
|
|
8
|
-
describe('Test Error Capture', () => {
|
|
9
|
-
const service = new TestProcessorServer(() => {
|
|
10
|
-
ERC20Processor.bind({ address: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91' })
|
|
11
|
-
.onEventApproval((evt, ctx) => {
|
|
12
|
-
ctx.logger.info(`approve ${evt.args}`)
|
|
13
|
-
})
|
|
14
|
-
.onEventTransfer((evt, ctx) => {
|
|
15
|
-
ctx.logger.warn('transferred ' + evt.args.value, { from: evt.args.from })
|
|
16
|
-
})
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
beforeAll(async () => {
|
|
20
|
-
await service.start()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
test('Check approve', async () => {
|
|
24
|
-
const res = await service.testLog(
|
|
25
|
-
mockApprovalLog('0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91', {
|
|
26
|
-
owner: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91',
|
|
27
|
-
spender: '0x0000000000000000000000000000000000000000',
|
|
28
|
-
value: BigNumber.from(0),
|
|
29
|
-
})
|
|
30
|
-
)
|
|
31
|
-
assert(res.result?.logs?.[0].message.includes('approve '))
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
test('Check transfer', async () => {
|
|
35
|
-
const res = await service.testLog(
|
|
36
|
-
mockTransferLog('0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91', {
|
|
37
|
-
from: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91',
|
|
38
|
-
to: '0x0000000000000000000000000000000000000000',
|
|
39
|
-
value: BigNumber.from(0),
|
|
40
|
-
})
|
|
41
|
-
)
|
|
42
|
-
const log = res.result?.logs?.[0]
|
|
43
|
-
expect(log?.message).eq('transferred 0')
|
|
44
|
-
expect(JSON.parse(log?.attributes || '')['from'].toLowerCase()).eq('0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91')
|
|
45
|
-
})
|
|
46
|
-
})
|
package/src/tests/solana.test.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// TODO move out of this package
|
|
2
|
-
|
|
3
|
-
import { expect } from 'chai'
|
|
4
|
-
|
|
5
|
-
import { HandlerType, ProcessInstructionsRequest } from '..'
|
|
6
|
-
|
|
7
|
-
import Long from 'long'
|
|
8
|
-
import { TextEncoder } from 'util'
|
|
9
|
-
import { TestProcessorServer, firstCounterValue } from '../testing'
|
|
10
|
-
|
|
11
|
-
describe('Test Solana Example', () => {
|
|
12
|
-
const service = new TestProcessorServer(() => {
|
|
13
|
-
require('./wormhole-token-bridge')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
beforeAll(async () => {
|
|
17
|
-
await service.start({ templateInstances: [] })
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
test('check configuration ', async () => {
|
|
21
|
-
const config = await service.getConfig({})
|
|
22
|
-
expect(config.contractConfigs).length(2)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
test('Check wormhole token bridge instruction dispatch', async () => {
|
|
26
|
-
const request: ProcessInstructionsRequest = {
|
|
27
|
-
instructions: [
|
|
28
|
-
{
|
|
29
|
-
instructionData: '33G5T8yXAQWdH8FX7fTy1mBJ6e4dUKfQWbViSrT7qJjpS8UAA3ftEQx9sNzrkaJm56xtENhDsWf',
|
|
30
|
-
slot: Long.fromNumber(12345),
|
|
31
|
-
programAccountId: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
|
|
32
|
-
accounts: ['worm'],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
instructionData: '33G5T8yXAQWdH8FX7fTy1mBJ6e4dUKfQWbViSrT7qJjpS8UAA3ftEQx9sNzrkaJm56xtENhDsWf',
|
|
36
|
-
slot: Long.fromNumber(1),
|
|
37
|
-
programAccountId: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
|
|
38
|
-
accounts: ['worm'],
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
}
|
|
42
|
-
const res = await service.processInstructions(request)
|
|
43
|
-
expect(res.result?.counters).length(4)
|
|
44
|
-
expect(res.result?.gauges).length(0)
|
|
45
|
-
expect(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(12345)
|
|
46
|
-
expect(firstCounterValue(res.result, 'total_transfer_amount')).equal(1000000n)
|
|
47
|
-
expect(firstCounterValue(res.result, 'worm')).equal(1000000n)
|
|
48
|
-
expect(res.result?.counters[0].runtimeInfo?.from).equals(HandlerType.INSTRUCTION)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
test('Check SPLToken parsed instruction dispatch', async () => {
|
|
52
|
-
const parsedIns = {
|
|
53
|
-
info: {
|
|
54
|
-
account: '2SDN4vEJdCdW3pGyhx2km9gB3LeHzMGLrG2j4uVNZfrx',
|
|
55
|
-
amount: '12000000000000',
|
|
56
|
-
mint: '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs',
|
|
57
|
-
mintAuthority: 'BCD75RNBHrJJpW4dXVagL5mPjzRLnVZq4YirJdjEYMV7',
|
|
58
|
-
},
|
|
59
|
-
type: 'mintTo',
|
|
60
|
-
}
|
|
61
|
-
const request: ProcessInstructionsRequest = {
|
|
62
|
-
instructions: [
|
|
63
|
-
{
|
|
64
|
-
instructionData: '',
|
|
65
|
-
slot: Long.fromNumber(0),
|
|
66
|
-
programAccountId: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
|
|
67
|
-
parsed: new TextEncoder().encode(JSON.stringify(parsedIns)),
|
|
68
|
-
accounts: [],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
}
|
|
72
|
-
const res = await service.processInstructions(request)
|
|
73
|
-
expect(res.result?.counters).length(1)
|
|
74
|
-
expect(res.result?.gauges).length(0)
|
|
75
|
-
expect(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(0)
|
|
76
|
-
expect(firstCounterValue(res.result, 'totalWeth_supply')).equal(12000000000000)
|
|
77
|
-
expect(res.result?.counters[0].runtimeInfo?.from).equals(HandlerType.INSTRUCTION)
|
|
78
|
-
})
|
|
79
|
-
})
|
package/src/tests/souffl3.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { SouffleChefCampaign, CandyMachine } from './types/aptos/souffle'
|
|
2
|
-
import { token } from '../builtin/aptos/0x3'
|
|
3
|
-
import { aptos_account, voting } from '../builtin/aptos/0x1'
|
|
4
|
-
import { TYPE_REGISTRY } from '../aptos/types'
|
|
5
|
-
import { AccountEventTracker } from '@sentio/sdk'
|
|
6
|
-
import { AptosAccountProcessor } from '../aptos/aptos-processor'
|
|
7
|
-
|
|
8
|
-
const accountTracker = AccountEventTracker.register('pull')
|
|
9
|
-
|
|
10
|
-
SouffleChefCampaign.bind({ startVersion: 3212312n })
|
|
11
|
-
.onEntryPullTokenV2((call: SouffleChefCampaign.PullTokenV2Payload, ctx) => {
|
|
12
|
-
ctx.meter.Counter('call_num').add(1)
|
|
13
|
-
ctx.meter.Counter('pulled').add(call.arguments_typed[3])
|
|
14
|
-
})
|
|
15
|
-
.onEventPullTokenEvent((evt, ctx) => {
|
|
16
|
-
ctx.meter.Counter('burned').add(1)
|
|
17
|
-
accountTracker.trackEvent(ctx, { distinctId: ctx.transaction.sender })
|
|
18
|
-
})
|
|
19
|
-
.onEvent(
|
|
20
|
-
(event, ctx) => {
|
|
21
|
-
ctx.meter.Counter('evt_num').add(1)
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: '0x1::coin::DepositEvent',
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
.onTransaction((txn, ctx) => {
|
|
28
|
-
const events = TYPE_REGISTRY.filterAndDecodeEvents<token.DepositEvent>('0x3::token::DepositEvent', txn.events)
|
|
29
|
-
for (const event of events) {
|
|
30
|
-
// const depositEventInstance = DEFAULT_TYPE_REGISTRY.decodeEvent(event) as DepositEventInstance
|
|
31
|
-
ctx.meter.Counter('deposit_token_count').add(event.data_typed.amount)
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
CandyMachine.bind().onEntryPullToken((call: CandyMachine.PullTokenPayload, ctx) => {
|
|
36
|
-
ctx.meter.Counter('pulled').add(call.arguments[2])
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
token.bind().onEventDepositEvent((evt: token.DepositEventInstance, ctx) => {
|
|
40
|
-
ctx.meter.Gauge('version').record(evt.data_typed.id.property_version)
|
|
41
|
-
ctx.meter.Counter('deposit').add(evt.data_typed.amount, { token: evt.data_typed.id.token_data_id.name })
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
voting.bind().onEventCreateProposalEvent((evt, ctx) => {
|
|
45
|
-
// console.log(evt)
|
|
46
|
-
evt.data_typed.expiration_secs + evt.data_typed.expiration_secs
|
|
47
|
-
ctx.meter.Gauge('size').record(evt.data_typed.metadata.data.length)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
AptosAccountProcessor.bind({ address: '0x1' }).onTimeInterval((resources, ctx) => {
|
|
51
|
-
ctx.meter.Counter('onTimer').add(1)
|
|
52
|
-
}, 10000)
|
|
53
|
-
|
|
54
|
-
aptos_account.bind().onEntryCreateAccount((call, ctx) => {
|
|
55
|
-
ctx.meter.Counter('xx').add(1)
|
|
56
|
-
})
|
package/src/tests/sui.test.ts
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai'
|
|
2
|
-
import Long from 'long'
|
|
3
|
-
import { TextEncoder } from 'util'
|
|
4
|
-
import { ProcessTransactionsRequest, SuiBaseProcessor, SuiBindOptions } from '..'
|
|
5
|
-
import { chain } from '../utils'
|
|
6
|
-
|
|
7
|
-
import { TestProcessorServer } from '../testing'
|
|
8
|
-
|
|
9
|
-
describe('Test Sui Example', () => {
|
|
10
|
-
const service = new TestProcessorServer(() => {
|
|
11
|
-
class TicTacToeProcessor extends SuiBaseProcessor {
|
|
12
|
-
static bind(options: SuiBindOptions): TicTacToeProcessor {
|
|
13
|
-
return new TicTacToeProcessor('TicTacToe', options)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
TicTacToeProcessor.bind({
|
|
18
|
-
startBlock: 0,
|
|
19
|
-
address: '',
|
|
20
|
-
}).onTransaction((txn, ctx) => {
|
|
21
|
-
if (txn.certificate.data.transactions && txn.certificate.data.transactions.length > 0) {
|
|
22
|
-
if (
|
|
23
|
-
txn.certificate.data.transactions[0].Call.package.objectId === '0xb8252513f0b9efaa3e260842c4b84d8ff933522d'
|
|
24
|
-
) {
|
|
25
|
-
if (txn.effects.events) {
|
|
26
|
-
txn.effects.events.forEach((event: { newObject: { recipient: { AddressOwner: any } } }) => {
|
|
27
|
-
if (event.newObject) {
|
|
28
|
-
const owner = event.newObject.recipient.AddressOwner
|
|
29
|
-
if ((owner.toString() as string).includes('0x1c27')) {
|
|
30
|
-
ctx.meter.Counter('win_count').add(1)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
beforeAll(async () => {
|
|
41
|
-
await service.start({ templateInstances: [] })
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
test('check configuration ', async () => {
|
|
45
|
-
const config = await service.getConfig({})
|
|
46
|
-
expect(config.contractConfigs).length(1)
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
test('Check tictactoe transaction dispatch', async () => {
|
|
50
|
-
const request: ProcessTransactionsRequest = {
|
|
51
|
-
chainId: chain.SUI_DEVNET_ID,
|
|
52
|
-
transactions: [
|
|
53
|
-
{
|
|
54
|
-
slot: Long.fromNumber(12345),
|
|
55
|
-
raw: new TextEncoder().encode(JSON.stringify(testData)),
|
|
56
|
-
programAccountId: '0xb8252513f0b9efaa3e260842c4b84d8ff933522d',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
}
|
|
60
|
-
const res = await service.processTransactions(request)
|
|
61
|
-
expect(res.result?.counters).length(1)
|
|
62
|
-
expect(res.result?.gauges).length(0)
|
|
63
|
-
expect(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(12345)
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
const testData = {
|
|
68
|
-
certificate: {
|
|
69
|
-
transactionDigest: 'z3HjnnFFKAaszOi0pMSImtGMpRd2r7ljLjAjUoqs3Kw=',
|
|
70
|
-
data: {
|
|
71
|
-
transactions: [
|
|
72
|
-
{
|
|
73
|
-
Call: {
|
|
74
|
-
package: {
|
|
75
|
-
objectId: '0xb8252513f0b9efaa3e260842c4b84d8ff933522d',
|
|
76
|
-
version: 1,
|
|
77
|
-
digest: 'UyeEXDb5jCLGuk/PVcqdLtbKSI3mSANB2/DxiyzXRC8=',
|
|
78
|
-
},
|
|
79
|
-
module: 'shared_tic_tac_toe',
|
|
80
|
-
function: 'place_mark',
|
|
81
|
-
arguments: ['0x8ed24078d64aa1a2a7593cba7ab64eb2016fa3d4', 2, ''],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
sender: '0x1c270459011d19dc342751aff75b4188334438fa',
|
|
86
|
-
gasPayment: {
|
|
87
|
-
objectId: '0x018b73e6652bab0f6419fa998263b568fa0688bb',
|
|
88
|
-
version: 8,
|
|
89
|
-
digest: 'suj5fniFCh3oqu+3BQWASz5zyUl4jUWVmJFf76AwVoE=',
|
|
90
|
-
},
|
|
91
|
-
gasBudget: 1000,
|
|
92
|
-
},
|
|
93
|
-
txSignature:
|
|
94
|
-
'ACIBv8kDff83DOjZsrUe4RqC1BLBGZtLAwFf/3tHUWJe1F+fxtg16Kqdm85TY9IWeYhVTtQkmchROxX8g0pi/Ak48WB/fgCTwX6K9CIMWgmr+j4k7x4dPYBNizpjHvBgCQ==',
|
|
95
|
-
authSignInfo: {
|
|
96
|
-
epoch: 0,
|
|
97
|
-
signature: [
|
|
98
|
-
'o4tOmjc4jJ27NoKGEHlNDZav0rBJLDqzzsL1kGJOviPKgpLlxyFCeBHrgjAwoc4Y5M75wYgccCuiv67l1w05DQ==',
|
|
99
|
-
'B2tClnK9GYCDFg6HbO/IW7hlJkhfIXi6NoDn7s4Pyw94BjMB/v0S0ZufbLwDO/WhBwU83q+wRTanG4HRhvUuBw==',
|
|
100
|
-
'5s49bESgHvDH7/oqjuxjy9YW4xWCG4e8g6hGlZC0bTXskPdf+q6bSGglkkMpOr1B3uIlMeif1NAlRQCKsfNcCg==',
|
|
101
|
-
],
|
|
102
|
-
signers_map: [58, 48, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 16, 0, 0, 0, 1, 0, 2, 0, 3, 0],
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
effects: {
|
|
106
|
-
status: {
|
|
107
|
-
status: 'success',
|
|
108
|
-
},
|
|
109
|
-
gasUsed: {
|
|
110
|
-
computationCost: 716,
|
|
111
|
-
storageCost: 48,
|
|
112
|
-
storageRebate: 35,
|
|
113
|
-
},
|
|
114
|
-
sharedObjects: [
|
|
115
|
-
{
|
|
116
|
-
objectId: '0x8ed24078d64aa1a2a7593cba7ab64eb2016fa3d4',
|
|
117
|
-
version: 6,
|
|
118
|
-
digest: 'kY/I9fcr6rL2EbDO88MxrEmEaxAEtRxgd+lcfQnE4ww=',
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
transactionDigest: 'z3HjnnFFKAaszOi0pMSImtGMpRd2r7ljLjAjUoqs3Kw=',
|
|
122
|
-
created: [
|
|
123
|
-
{
|
|
124
|
-
owner: {
|
|
125
|
-
AddressOwner: '0x1c270459011d19dc342751aff75b4188334438fa',
|
|
126
|
-
},
|
|
127
|
-
reference: {
|
|
128
|
-
objectId: '0x2e37e03297a9d138687ffd921f8a830a6f498ec6',
|
|
129
|
-
version: 1,
|
|
130
|
-
digest: '1zZhoVoTLPRM1YpGX9EcrwPJulKcXyLrF+40rTIQ06g=',
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
mutated: [
|
|
135
|
-
{
|
|
136
|
-
owner: {
|
|
137
|
-
AddressOwner: '0x1c270459011d19dc342751aff75b4188334438fa',
|
|
138
|
-
},
|
|
139
|
-
reference: {
|
|
140
|
-
objectId: '0x018b73e6652bab0f6419fa998263b568fa0688bb',
|
|
141
|
-
version: 9,
|
|
142
|
-
digest: 'naHwWYK8vl7UBnhp40o7h7JI+cxvFF8rTIOQ4RJ4vus=',
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
owner: 'Shared',
|
|
147
|
-
reference: {
|
|
148
|
-
objectId: '0x8ed24078d64aa1a2a7593cba7ab64eb2016fa3d4',
|
|
149
|
-
version: 7,
|
|
150
|
-
digest: 's3R+lWAMGde7eqZzllafAJkoR7Em55An8gHgz7oCImw=',
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
gasObject: {
|
|
155
|
-
owner: {
|
|
156
|
-
AddressOwner: '0x1c270459011d19dc342751aff75b4188334438fa',
|
|
157
|
-
},
|
|
158
|
-
reference: {
|
|
159
|
-
objectId: '0x018b73e6652bab0f6419fa998263b568fa0688bb',
|
|
160
|
-
version: 9,
|
|
161
|
-
digest: 'naHwWYK8vl7UBnhp40o7h7JI+cxvFF8rTIOQ4RJ4vus=',
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
events: [
|
|
165
|
-
{
|
|
166
|
-
moveEvent: {
|
|
167
|
-
packageId: '0xb8252513f0b9efaa3e260842c4b84d8ff933522d',
|
|
168
|
-
transactionModule: 'shared_tic_tac_toe',
|
|
169
|
-
sender: '0x1c270459011d19dc342751aff75b4188334438fa',
|
|
170
|
-
type: '0xb8252513f0b9efaa3e260842c4b84d8ff933522d::shared_tic_tac_toe::GameEndEvent',
|
|
171
|
-
fields: {
|
|
172
|
-
game_id: '0x8ed24078d64aa1a2a7593cba7ab64eb2016fa3d4',
|
|
173
|
-
},
|
|
174
|
-
bcs: 'jtJAeNZKoaKnWTy6erZOsgFvo9Q=',
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
newObject: {
|
|
179
|
-
packageId: '0xb8252513f0b9efaa3e260842c4b84d8ff933522d',
|
|
180
|
-
transactionModule: 'shared_tic_tac_toe',
|
|
181
|
-
sender: '0x1c270459011d19dc342751aff75b4188334438fa',
|
|
182
|
-
recipient: {
|
|
183
|
-
AddressOwner: '0x1c270459011d19dc342751aff75b4188334438fa',
|
|
184
|
-
},
|
|
185
|
-
objectId: '0x2e37e03297a9d138687ffd921f8a830a6f498ec6',
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
dependencies: [
|
|
190
|
-
'UgLnWz4u9GTgAJYwR+rz+YO5TDJiZHuFjzyh9blJO2o=',
|
|
191
|
-
'lw2dyQ9J3fPeH5Lx5aiHfjxDHJENTH4910r2/Y/PQX4=',
|
|
192
|
-
'phojYeMd7C6mRxGXQFDPF10NFYMEUfBND+f8wJGKkbg=',
|
|
193
|
-
],
|
|
194
|
-
},
|
|
195
|
-
timestamp_ms: 1662996912461,
|
|
196
|
-
parsed_data: null,
|
|
197
|
-
}
|