@sentio/sdk 3.9.0-rc.4 → 3.9.0-rc.5

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 (37) hide show
  1. package/lib/solana/builtin/index.d.ts +1 -0
  2. package/lib/solana/builtin/index.d.ts.map +1 -1
  3. package/lib/solana/builtin/index.js +1 -0
  4. package/lib/solana/builtin/index.js.map +1 -1
  5. package/lib/solana/builtin/spl-token-2022-processor.d.ts +46 -0
  6. package/lib/solana/builtin/spl-token-2022-processor.d.ts.map +1 -0
  7. package/lib/solana/builtin/spl-token-2022-processor.js +132 -0
  8. package/lib/solana/builtin/spl-token-2022-processor.js.map +1 -0
  9. package/lib/solana/builtin/spl-token-processor.d.ts +30 -30
  10. package/lib/solana/builtin/spl-token-processor.d.ts.map +1 -1
  11. package/lib/solana/builtin/types.d.ts +1699 -81
  12. package/lib/solana/builtin/types.d.ts.map +1 -1
  13. package/lib/solana/builtin/types.js +520 -72
  14. package/lib/solana/builtin/types.js.map +1 -1
  15. package/lib/solana/codegen/codegen.js +2 -2
  16. package/lib/solana/codegen/codegen.js.map +1 -1
  17. package/lib/solana/index.d.ts +1 -1
  18. package/lib/solana/index.js +1 -1
  19. package/lib/solana/solana-context.d.ts +1 -1
  20. package/lib/solana/solana-context.d.ts.map +1 -1
  21. package/lib/solana/solana-processor.d.ts +2 -2
  22. package/lib/solana/solana-processor.d.ts.map +1 -1
  23. package/lib/solana/solana-rpc-types.d.ts +75 -0
  24. package/lib/solana/solana-rpc-types.d.ts.map +1 -0
  25. package/lib/solana/solana-rpc-types.js +2 -0
  26. package/lib/solana/solana-rpc-types.js.map +1 -0
  27. package/package.json +6 -6
  28. package/src/solana/builtin/index.ts +2 -1
  29. package/src/solana/builtin/spl-token-2022-processor.ts +324 -0
  30. package/src/solana/builtin/spl-token-processor.ts +30 -30
  31. package/src/solana/builtin/types.ts +659 -144
  32. package/src/solana/codegen/codegen.ts +6 -6
  33. package/src/solana/index.ts +1 -1
  34. package/src/solana/solana-context.ts +1 -1
  35. package/src/solana/solana-plugin.ts +1 -1
  36. package/src/solana/solana-processor.ts +2 -2
  37. package/src/solana/solana-rpc-types.ts +73 -0
@@ -1,15 +1,15 @@
1
1
  import path from 'path'
2
2
  import fs from 'fs'
3
3
  import chalk from 'chalk'
4
- import { Idl } from '@coral-xyz/anchor'
5
4
  import {
5
+ Idl,
6
+ IdlDefinedFields,
6
7
  IdlField,
7
8
  IdlInstruction,
8
- IdlType,
9
9
  IdlInstructionAccountItem,
10
- IdlDefinedFields,
10
+ IdlType,
11
11
  IdlTypeDef
12
- } from '@coral-xyz/anchor/dist/esm/idl.js'
12
+ } from '@anchor-lang/core'
13
13
  import { recursiveCodegen } from '../../core/codegen.js'
14
14
 
15
15
  export function codegen(abisDir: string, targetPath = path.join('src', 'types', 'solana'), genExample = false) {
@@ -49,7 +49,7 @@ function codeGenSolanaIdlProcessor(idlObj: Idl): string {
49
49
  return `import { BorshInstructionCoder, Instruction, Idl } from '@sentio/sdk/solana'
50
50
  import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from "@sentio/sdk/solana"
51
51
  import { ${idlName}_idl } from "./${idlName}.js"
52
- import { PublicKey } from '@solana/web3.js'
52
+ import type { Address } from '@solana/kit'
53
53
 
54
54
  ${idlObj.types?.map((def) => codeGenType(def)).join('')}
55
55
 
@@ -180,7 +180,7 @@ function mapType(tpe: IdlType): string {
180
180
  }
181
181
  switch (tpe) {
182
182
  case 'pubkey':
183
- return 'PublicKey'
183
+ return 'Address'
184
184
  case 'bool':
185
185
  return 'boolean'
186
186
  case 'string':
@@ -3,4 +3,4 @@ export * from './solana-context.js'
3
3
  export * from './solana-processor.js'
4
4
  export * from './solana-options.js'
5
5
 
6
- export { BorshInstructionCoder, type Instruction, type Idl } from '@coral-xyz/anchor'
6
+ export { BorshInstructionCoder, type Instruction, type Idl } from '@anchor-lang/core'
@@ -1,6 +1,6 @@
1
1
  import { normalizeLabels, Labels, BaseContext, RecordMetaData } from '../index.js'
2
2
  import { SolanaChainId } from '@sentio/chain'
3
- import { TransactionResponse } from '@solana/web3.js'
3
+ import type { TransactionResponse } from './solana-rpc-types.js'
4
4
 
5
5
  export class SolanaContext extends BaseContext {
6
6
  network: SolanaChainId
@@ -12,7 +12,7 @@ import {
12
12
  import { ServerError, Status } from 'nice-grpc'
13
13
 
14
14
  import { SolanaProcessorState } from './solana-processor.js'
15
- import { Instruction as SolInstruction } from '@coral-xyz/anchor'
15
+ import { Instruction as SolInstruction } from '@anchor-lang/core'
16
16
 
17
17
  export class SolanaPlugin extends Plugin {
18
18
  name: string = 'SolanaPlugin'
@@ -1,13 +1,13 @@
1
1
  import { Data_SolBlock, Data_SolInstruction, HandleInterval, ProcessResult } from '@sentio/protos'
2
2
  import { SolanaContext } from './solana-context.js'
3
- import { Instruction } from '@coral-xyz/anchor'
3
+ import { Instruction } from '@anchor-lang/core'
4
4
  import { SolanaBindOptions, SolanaFetchConfig } from './solana-options.js'
5
5
  import { ListStateStorage } from '@sentio/runtime'
6
6
  import { ALL_ADDRESS, Labels, PromiseOrVoid } from '../core/index.js'
7
7
  import { SolanaChainId } from '@sentio/chain'
8
8
  import { HandlerOptions } from '../core/handler-options.js'
9
9
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
10
- import { TransactionResponse, BlockResponse } from '@solana/web3.js'
10
+ import type { TransactionResponse, BlockResponse } from './solana-rpc-types.js'
11
11
 
12
12
  type IndexConfigure = {
13
13
  startSlot: bigint
@@ -0,0 +1,73 @@
1
+ import type { Address, Signature, Blockhash } from '@solana/kit'
2
+
3
+ export type TransactionVersion = 'legacy' | number
4
+
5
+ export interface TransactionMessageHeader {
6
+ numRequiredSignatures: number
7
+ numReadonlySignedAccounts: number
8
+ numReadonlyUnsignedAccounts: number
9
+ }
10
+
11
+ export interface CompiledInstruction {
12
+ programIdIndex: number
13
+ accounts: number[]
14
+ data: string
15
+ }
16
+
17
+ export interface TransactionMessage {
18
+ accountKeys: Address[]
19
+ header: TransactionMessageHeader
20
+ instructions: CompiledInstruction[]
21
+ recentBlockhash: Blockhash
22
+ }
23
+
24
+ export interface TokenBalance {
25
+ accountIndex: number
26
+ mint: string
27
+ owner?: string
28
+ programId?: string
29
+ uiTokenAmount: {
30
+ amount: string
31
+ decimals: number
32
+ uiAmount: number | null
33
+ uiAmountString: string
34
+ }
35
+ }
36
+
37
+ export interface ConfirmedTransactionMeta {
38
+ err: unknown
39
+ fee: number
40
+ innerInstructions?: Array<{ index: number; instructions: CompiledInstruction[] }> | null
41
+ logMessages?: string[] | null
42
+ preBalances: number[]
43
+ postBalances: number[]
44
+ preTokenBalances?: TokenBalance[] | null
45
+ postTokenBalances?: TokenBalance[] | null
46
+ rewards?: unknown[] | null
47
+ loadedAddresses?: { writable: Address[]; readonly: Address[] }
48
+ }
49
+
50
+ export interface TransactionResponse {
51
+ slot: number
52
+ blockTime?: number | null
53
+ transaction: {
54
+ message: TransactionMessage
55
+ signatures: Signature[]
56
+ }
57
+ meta: ConfirmedTransactionMeta | null
58
+ version?: TransactionVersion
59
+ }
60
+
61
+ export interface BlockResponse {
62
+ blockhash: Blockhash
63
+ previousBlockhash: Blockhash
64
+ parentSlot: number
65
+ blockHeight?: number | null
66
+ blockTime?: number | null
67
+ transactions: Array<{
68
+ transaction: { message: TransactionMessage; signatures: Signature[] }
69
+ meta: ConfirmedTransactionMeta | null
70
+ version?: TransactionVersion
71
+ }>
72
+ rewards?: unknown[]
73
+ }