@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.
Files changed (90) hide show
  1. package/lib/processor-runner.js +2 -2
  2. package/lib/processor-runner.js.map +1 -1
  3. package/package.json +4 -4
  4. package/src/processor-runner.ts +2 -2
  5. package/lib/aptos/types.test.js +0 -19
  6. package/lib/core/generic-processor.test.js +0 -58
  7. package/lib/core/meter.test.js +0 -21
  8. package/lib/core/numberish.test.js +0 -70
  9. package/lib/tests/aptos.test.d.ts +0 -1
  10. package/lib/tests/aptos.test.js +0 -379
  11. package/lib/tests/aptos.test.js.map +0 -1
  12. package/lib/tests/codegen.test.d.ts +0 -1
  13. package/lib/tests/codegen.test.js +0 -49
  14. package/lib/tests/codegen.test.js.map +0 -1
  15. package/lib/tests/erc20-template.test.d.ts +0 -1
  16. package/lib/tests/erc20-template.test.js +0 -56
  17. package/lib/tests/erc20-template.test.js.map +0 -1
  18. package/lib/tests/erc20.d.ts +0 -1
  19. package/lib/tests/erc20.js +0 -54
  20. package/lib/tests/erc20.js.map +0 -1
  21. package/lib/tests/erc20.test.d.ts +0 -1
  22. package/lib/tests/erc20.test.js +0 -94
  23. package/lib/tests/erc20.test.js.map +0 -1
  24. package/lib/tests/error-capture.test.d.ts +0 -1
  25. package/lib/tests/error-capture.test.js +0 -76
  26. package/lib/tests/error-capture.test.js.map +0 -1
  27. package/lib/tests/logger.test.d.ts +0 -1
  28. package/lib/tests/logger.test.js +0 -40
  29. package/lib/tests/logger.test.js.map +0 -1
  30. package/lib/tests/solana.test.d.ts +0 -1
  31. package/lib/tests/solana.test.js +0 -77
  32. package/lib/tests/solana.test.js.map +0 -1
  33. package/lib/tests/souffl3.d.ts +0 -1
  34. package/lib/tests/souffl3.js +0 -49
  35. package/lib/tests/souffl3.js.map +0 -1
  36. package/lib/tests/sui.test.d.ts +0 -1
  37. package/lib/tests/sui.test.js +0 -193
  38. package/lib/tests/sui.test.js.map +0 -1
  39. package/lib/tests/types/aptos/soffl3.d.ts +0 -786
  40. package/lib/tests/types/aptos/soffl3.js +0 -559
  41. package/lib/tests/types/aptos/soffl3.js.map +0 -1
  42. package/lib/tests/types/aptos/souffle.d.ts +0 -348
  43. package/lib/tests/types/aptos/souffle.js +0 -303
  44. package/lib/tests/types/aptos/souffle.js.map +0 -1
  45. package/lib/tests/types/solana/basic_1.d.ts +0 -26
  46. package/lib/tests/types/solana/basic_1.js +0 -66
  47. package/lib/tests/types/solana/basic_1.js.map +0 -1
  48. package/lib/tests/types/solana/basic_1_processor.d.ts +0 -13
  49. package/lib/tests/types/solana/basic_1_processor.js +0 -41
  50. package/lib/tests/types/solana/basic_1_processor.js.map +0 -1
  51. package/lib/tests/wormhole-token-bridge.d.ts +0 -1
  52. package/lib/tests/wormhole-token-bridge.js +0 -22
  53. package/lib/tests/wormhole-token-bridge.js.map +0 -1
  54. package/lib/utils/dex-price.test.js +0 -22
  55. package/lib/utils/erc20.test.js +0 -23
  56. package/src/aptos/types.test.ts +0 -18
  57. package/src/aptos-codegen/typegen.test.ts +0 -44
  58. package/src/core/generic-processor.test.ts +0 -69
  59. package/src/core/meter.test.ts +0 -23
  60. package/src/core/numberish.test.ts +0 -82
  61. package/src/tests/abis/aptos/soffl3.json +0 -1411
  62. package/src/tests/abis/aptos/souffle.json +0 -389
  63. package/src/tests/abis/evm/CommitmentPool.json +0 -1034
  64. package/src/tests/abis/evm/Seaport.json +0 -2595
  65. package/src/tests/abis/evm/anyswapRouter.json +0 -490
  66. package/src/tests/abis/solana/basic_1.json +0 -62
  67. package/src/tests/aptos.test.ts +0 -402
  68. package/src/tests/codegen.test.ts +0 -29
  69. package/src/tests/erc20-template.test.ts +0 -60
  70. package/src/tests/erc20.test.ts +0 -115
  71. package/src/tests/erc20.ts +0 -60
  72. package/src/tests/error-capture.test.ts +0 -82
  73. package/src/tests/logger.test.ts +0 -46
  74. package/src/tests/solana.test.ts +0 -79
  75. package/src/tests/souffl3.ts +0 -56
  76. package/src/tests/sui.test.ts +0 -197
  77. package/src/tests/types/aptos/soffl3.ts +0 -1377
  78. package/src/tests/types/aptos/souffle.ts +0 -698
  79. package/src/tests/types/solana/basic_1.ts +0 -62
  80. package/src/tests/types/solana/basic_1_processor.ts +0 -41
  81. package/src/tests/wormhole-token-bridge.ts +0 -21
  82. package/src/types/global.d.ts +0 -5
  83. package/src/utils/dex-price.test.ts +0 -25
  84. package/src/utils/erc20.test.ts +0 -26
  85. package/templates/aptos/.gitignore +0 -107
  86. package/templates/aptos/src/processor.test.ts +0 -14
  87. package/templates/evm/.gitignore +0 -107
  88. package/templates/evm/src/processor.test.ts +0 -29
  89. package/templates/raw/.gitignore +0 -107
  90. package/templates/raw/src/processor.test.ts +0 -14
@@ -1,62 +0,0 @@
1
- export const basic_1_idl = {
2
- "version": "0.1.0",
3
- "name": "basic_1",
4
- "instructions": [
5
- {
6
- "name": "initialize",
7
- "accounts": [
8
- {
9
- "name": "myAccount",
10
- "isMut": true,
11
- "isSigner": true
12
- },
13
- {
14
- "name": "user",
15
- "isMut": true,
16
- "isSigner": true
17
- },
18
- {
19
- "name": "systemProgram",
20
- "isMut": false,
21
- "isSigner": false
22
- }
23
- ],
24
- "args": [
25
- {
26
- "name": "data",
27
- "type": "u64"
28
- }
29
- ]
30
- },
31
- {
32
- "name": "update",
33
- "accounts": [
34
- {
35
- "name": "myAccount",
36
- "isMut": true,
37
- "isSigner": false
38
- }
39
- ],
40
- "args": [
41
- {
42
- "name": "data",
43
- "type": "u64"
44
- }
45
- ]
46
- }
47
- ],
48
- "accounts": [
49
- {
50
- "name": "MyAccount",
51
- "type": {
52
- "kind": "struct",
53
- "fields": [
54
- {
55
- "name": "data",
56
- "type": "u64"
57
- }
58
- ]
59
- }
60
- }
61
- ]
62
- }
@@ -1,41 +0,0 @@
1
- import { BorshInstructionCoder, Instruction, Idl, BN } from '@project-serum/anchor'
2
- import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from "@sentio/sdk"
3
- import { basic_1_idl } from "./basic_1"
4
- import bs58 from 'bs58'
5
- import { PublicKey } from '@solana/web3.js'
6
-
7
- export class Basic1Processor extends SolanaBaseProcessor {
8
- static bind(options: SolanaBindOptions): Basic1Processor {
9
- if (options && !options.name) {
10
- options.name = 'Basic1'
11
- }
12
- return new Basic1Processor(options)
13
- }
14
-
15
- decodeInstruction: (rawInstruction: string) => Instruction | null = (rawInstruction) => {
16
- const instructionCoder = new BorshInstructionCoder(basic_1_idl as Idl)
17
- const decodedIns = instructionCoder.decode(Buffer.from(bs58.decode(rawInstruction)))
18
- return decodedIns
19
- }
20
-
21
-
22
- onInitialize(handler: (args: { data: BN }, accounts: string[], ctx: SolanaContext) => void): Basic1Processor {
23
- this.onInstruction('initialize', (ins: Instruction, ctx, accounts: string[]) => {
24
- if (ins) {
25
- handler(ins.data as { data: BN }, accounts, ctx)
26
- }
27
- })
28
- return this
29
- }
30
-
31
- onUpdate(handler: (args: { data: BN }, accounts: string[], ctx: SolanaContext) => void): Basic1Processor {
32
- this.onInstruction('update', (ins: Instruction, ctx, accounts: string[]) => {
33
- if (ins) {
34
- handler(ins.data as { data: BN }, accounts, ctx)
35
- }
36
- })
37
- return this
38
- }
39
-
40
- }
41
-
@@ -1,21 +0,0 @@
1
- import { TokenBridgeProcessor, SPLTokenProcessor } from '../builtin/solana'
2
-
3
- TokenBridgeProcessor.bind({
4
- address: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
5
- }).onTransferNative((args, accounts, ctx) => {
6
- ctx.meter.Counter('total_transfer_amount').add(args.amount)
7
- ctx.meter.Counter(accounts[0]).add(args.amount)
8
- })
9
-
10
- SPLTokenProcessor.bind({ address: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb' })
11
- .onMintTo((data, ctx) => {
12
- if (data.mint === '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs') {
13
- ctx.meter.Counter('totalWeth_supply').add(data.amount as number)
14
- }
15
- })
16
- .onBurn((data, ctx) => {
17
- if (data.mint === '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs') {
18
- ctx.meter.Counter('totalWeth_supply').sub(data.amount as number)
19
- }
20
- })
21
- .innerInstruction(true)
@@ -1,5 +0,0 @@
1
- import { ProcessorState } from '../processor-state'
2
-
3
- declare global {
4
- var PROCESSOR_STATE: ProcessorState
5
- }
@@ -1,25 +0,0 @@
1
- import { EthereumDexPrice, GoerliDexPrice } from './dex-price'
2
- import { ProcessorState } from '@sentio/sdk'
3
- import { loadTestProvidersFromEnv } from '../testing/test-provider'
4
-
5
- import { expect } from 'chai'
6
-
7
- describe('dex price tests', () => {
8
- global.PROCESSOR_STATE = new ProcessorState()
9
- const haveProviders = loadTestProvidersFromEnv(['1', '5'])
10
-
11
- const testIf = haveProviders ? test : test.skip
12
-
13
- testIf('get price at mainnet', async () => {
14
- const usdc = await EthereumDexPrice.getPrice('usdc', 15677823)
15
- expect(usdc.price).eq(0.99991649)
16
-
17
- const compound = await EthereumDexPrice.getPrice('COMP', 15677823)
18
- expect(compound.price).eq(60.27)
19
- })
20
-
21
- testIf('get price at goerli', async () => {
22
- const dai = await GoerliDexPrice.getPrice('DAI', 7712734)
23
- expect(dai.price).eq(0.99971281)
24
- })
25
- })
@@ -1,26 +0,0 @@
1
- import { ProcessorState } from '@sentio/sdk'
2
- import { getERC20TokenInfo } from './token'
3
- import { loadTestProvidersFromEnv } from '../testing/test-provider'
4
-
5
- describe('erc20 tests', () => {
6
- global.PROCESSOR_STATE = new ProcessorState()
7
- const haveProviders = loadTestProvidersFromEnv('1')
8
-
9
- const testIf = haveProviders ? test : test.skip
10
-
11
- testIf('test bytes32', async () => {
12
- const info = await getERC20TokenInfo('0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2')
13
-
14
- expect(info.decimal).toEqual(18)
15
- expect(info.symbol).toEqual('MKR')
16
- expect(info.name).toEqual('Maker')
17
- })
18
-
19
- testIf('test normal', async () => {
20
- const info = await getERC20TokenInfo('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')
21
-
22
- expect(info.decimal).toEqual(6)
23
- expect(info.symbol).toEqual('USDC')
24
- expect(info.name).toEqual('USD Coin')
25
- })
26
- })
@@ -1,107 +0,0 @@
1
- .idea
2
- src/types
3
-
4
- # Logs
5
- logs
6
- *.log
7
- npm-debug.log*
8
- yarn-debug.log*
9
- yarn-error.log*
10
- lerna-debug.log*
11
-
12
- # Diagnostic reports (https://nodejs.org/api/report.html)
13
- report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14
-
15
- # Runtime data
16
- pids
17
- *.pid
18
- *.seed
19
- *.pid.lock
20
-
21
- # Directory for instrumented libs generated by jscoverage/JSCover
22
- lib-cov
23
-
24
- # Coverage directory used by tools like istanbul
25
- coverage
26
- *.lcov
27
-
28
- # nyc test coverage
29
- .nyc_output
30
-
31
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
32
- .grunt
33
-
34
- # Bower dependency directory (https://bower.io/)
35
- bower_components
36
-
37
- # node-waf configuration
38
- .lock-wscript
39
-
40
- # Compiled binary addons (https://nodejs.org/api/addons.html)
41
- build/Release
42
-
43
- # Dependency directories
44
- node_modules/
45
- jspm_packages/
46
-
47
- # TypeScript v1 declaration files
48
- typings/
49
-
50
- # TypeScript cache
51
- *.tsbuildinfo
52
-
53
- # Optional npm cache directory
54
- .npm
55
-
56
- # Optional eslint cache
57
- .eslintcache
58
-
59
- # Microbundle cache
60
- .rpt2_cache/
61
- .rts2_cache_cjs/
62
- .rts2_cache_es/
63
- .rts2_cache_umd/
64
-
65
- # Optional REPL history
66
- .node_repl_history
67
-
68
- # Output of 'npm pack'
69
- *.tgz
70
-
71
- # Yarn Integrity file
72
- .yarn-integrity
73
-
74
- # dotenv environment variables file
75
- .env
76
- .env.test
77
-
78
- # parcel-bundler cache (https://parceljs.org/)
79
- .cache
80
-
81
- # Next.js build output
82
- .next
83
-
84
- # Nuxt.js build / generate output
85
- .nuxt
86
- dist
87
-
88
- # Gatsby files
89
- .cache/
90
- # Comment in the public line in if your project uses Gatsby and *not* Next.js
91
- # https://nextjs.org/blog/next-9-1#public-directory-support
92
- # public
93
-
94
- # vuepress build output
95
- .vuepress/dist
96
-
97
- # Serverless directories
98
- .serverless/
99
-
100
- # FuseBox cache
101
- .fusebox/
102
-
103
- # DynamoDB Local files
104
- .dynamodb/
105
-
106
- # TernJS port file
107
- .tern-port
@@ -1,14 +0,0 @@
1
- import { TestProcessorServer } from '@sentio/sdk/lib/testing'
2
-
3
- describe('Test Processor', () => {
4
- const service = new TestProcessorServer(() => require('./processor'))
5
-
6
- beforeAll(async () => {
7
- await service.start()
8
- })
9
-
10
- test('has config', async () => {
11
- const config = await service.getConfig({})
12
- expect(config.contractConfigs.length > 0)
13
- })
14
- })
@@ -1,107 +0,0 @@
1
- .idea
2
- src/types
3
-
4
- # Logs
5
- logs
6
- *.log
7
- npm-debug.log*
8
- yarn-debug.log*
9
- yarn-error.log*
10
- lerna-debug.log*
11
-
12
- # Diagnostic reports (https://nodejs.org/api/report.html)
13
- report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14
-
15
- # Runtime data
16
- pids
17
- *.pid
18
- *.seed
19
- *.pid.lock
20
-
21
- # Directory for instrumented libs generated by jscoverage/JSCover
22
- lib-cov
23
-
24
- # Coverage directory used by tools like istanbul
25
- coverage
26
- *.lcov
27
-
28
- # nyc test coverage
29
- .nyc_output
30
-
31
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
32
- .grunt
33
-
34
- # Bower dependency directory (https://bower.io/)
35
- bower_components
36
-
37
- # node-waf configuration
38
- .lock-wscript
39
-
40
- # Compiled binary addons (https://nodejs.org/api/addons.html)
41
- build/Release
42
-
43
- # Dependency directories
44
- node_modules/
45
- jspm_packages/
46
-
47
- # TypeScript v1 declaration files
48
- typings/
49
-
50
- # TypeScript cache
51
- *.tsbuildinfo
52
-
53
- # Optional npm cache directory
54
- .npm
55
-
56
- # Optional eslint cache
57
- .eslintcache
58
-
59
- # Microbundle cache
60
- .rpt2_cache/
61
- .rts2_cache_cjs/
62
- .rts2_cache_es/
63
- .rts2_cache_umd/
64
-
65
- # Optional REPL history
66
- .node_repl_history
67
-
68
- # Output of 'npm pack'
69
- *.tgz
70
-
71
- # Yarn Integrity file
72
- .yarn-integrity
73
-
74
- # dotenv environment variables file
75
- .env
76
- .env.test
77
-
78
- # parcel-bundler cache (https://parceljs.org/)
79
- .cache
80
-
81
- # Next.js build output
82
- .next
83
-
84
- # Nuxt.js build / generate output
85
- .nuxt
86
- dist
87
-
88
- # Gatsby files
89
- .cache/
90
- # Comment in the public line in if your project uses Gatsby and *not* Next.js
91
- # https://nextjs.org/blog/next-9-1#public-directory-support
92
- # public
93
-
94
- # vuepress build output
95
- .vuepress/dist
96
-
97
- # Serverless directories
98
- .serverless/
99
-
100
- # FuseBox cache
101
- .fusebox/
102
-
103
- # DynamoDB Local files
104
- .dynamodb/
105
-
106
- # TernJS port file
107
- .tern-port
@@ -1,29 +0,0 @@
1
- import { TestProcessorServer, firstCounterValue } from '@sentio/sdk/lib/testing'
2
- import { mockTransferLog } from '@sentio/sdk/lib/builtin/erc20/test-utils'
3
- import { BigNumber } from 'ethers'
4
-
5
- describe('Test Processor', () => {
6
- const service = new TestProcessorServer(() => require('./processor'))
7
-
8
- beforeAll(async () => {
9
- await service.start()
10
- })
11
-
12
- test('has valid config', async () => {
13
- const config = await service.getConfig({})
14
- expect(config.contractConfigs.length > 0).toBeTruthy()
15
- })
16
-
17
- test('check transfer event handling', async () => {
18
- const resp = await service.testLog(
19
- mockTransferLog('0x1e4ede388cbc9f4b5c79681b7f94d36a11abebc9', {
20
- from: '0x0000000000000000000000000000000000000000',
21
- to: '0xb329e39ebefd16f40d38f07643652ce17ca5bac1',
22
- value: BigNumber.from(10n ** 18n * 10n),
23
- })
24
- )
25
-
26
- const tokenCounter = firstCounterValue(resp.result, 'token')
27
- expect(tokenCounter).toEqual(10n)
28
- })
29
- })
@@ -1,107 +0,0 @@
1
- .idea
2
- src/types
3
-
4
- # Logs
5
- logs
6
- *.log
7
- npm-debug.log*
8
- yarn-debug.log*
9
- yarn-error.log*
10
- lerna-debug.log*
11
-
12
- # Diagnostic reports (https://nodejs.org/api/report.html)
13
- report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14
-
15
- # Runtime data
16
- pids
17
- *.pid
18
- *.seed
19
- *.pid.lock
20
-
21
- # Directory for instrumented libs generated by jscoverage/JSCover
22
- lib-cov
23
-
24
- # Coverage directory used by tools like istanbul
25
- coverage
26
- *.lcov
27
-
28
- # nyc test coverage
29
- .nyc_output
30
-
31
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
32
- .grunt
33
-
34
- # Bower dependency directory (https://bower.io/)
35
- bower_components
36
-
37
- # node-waf configuration
38
- .lock-wscript
39
-
40
- # Compiled binary addons (https://nodejs.org/api/addons.html)
41
- build/Release
42
-
43
- # Dependency directories
44
- node_modules/
45
- jspm_packages/
46
-
47
- # TypeScript v1 declaration files
48
- typings/
49
-
50
- # TypeScript cache
51
- *.tsbuildinfo
52
-
53
- # Optional npm cache directory
54
- .npm
55
-
56
- # Optional eslint cache
57
- .eslintcache
58
-
59
- # Microbundle cache
60
- .rpt2_cache/
61
- .rts2_cache_cjs/
62
- .rts2_cache_es/
63
- .rts2_cache_umd/
64
-
65
- # Optional REPL history
66
- .node_repl_history
67
-
68
- # Output of 'npm pack'
69
- *.tgz
70
-
71
- # Yarn Integrity file
72
- .yarn-integrity
73
-
74
- # dotenv environment variables file
75
- .env
76
- .env.test
77
-
78
- # parcel-bundler cache (https://parceljs.org/)
79
- .cache
80
-
81
- # Next.js build output
82
- .next
83
-
84
- # Nuxt.js build / generate output
85
- .nuxt
86
- dist
87
-
88
- # Gatsby files
89
- .cache/
90
- # Comment in the public line in if your project uses Gatsby and *not* Next.js
91
- # https://nextjs.org/blog/next-9-1#public-directory-support
92
- # public
93
-
94
- # vuepress build output
95
- .vuepress/dist
96
-
97
- # Serverless directories
98
- .serverless/
99
-
100
- # FuseBox cache
101
- .fusebox/
102
-
103
- # DynamoDB Local files
104
- .dynamodb/
105
-
106
- # TernJS port file
107
- .tern-port
@@ -1,14 +0,0 @@
1
- import { TestProcessorServer } from '@sentio/sdk/lib/testing'
2
-
3
- describe('Test Processor', () => {
4
- const service = new TestProcessorServer(() => require('./processor'))
5
-
6
- beforeAll(async () => {
7
- await service.start()
8
- })
9
-
10
- test('has valid config', async () => {
11
- // const config = await service.getConfig({})
12
- // expect(config.contractConfigs.length > 0).toBeTruthy()
13
- })
14
- })