@hyperbridge/sdk 1.3.25 → 1.4.0

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/README.md CHANGED
@@ -17,35 +17,48 @@ pnpm add @hyperbridge/sdk
17
17
  ### Initialize Client
18
18
 
19
19
  ```ts
20
- import { IndexerClient, createQueryClient } from "@hyperbridge/sdk"
20
+ import { IndexerClient, createQueryClient, EvmChain, SubstrateChain } from "@hyperbridge/sdk"
21
21
 
22
22
  const queryClient = createQueryClient({
23
23
  url: "http://localhost:3000", // URL of the Hyperbridge indexer API
24
24
  })
25
25
 
26
+ // Create chain instances directly
27
+ const sourceChain = new EvmChain({
28
+ chainId: 97,
29
+ rpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545",
30
+ host: "0x...", // Host contract address
31
+ consensusStateId: "BSC0"
32
+ })
33
+
34
+ const destChain = new EvmChain({
35
+ chainId: 10200,
36
+ rpcUrl: "https://rpc.chiadochain.net",
37
+ host: "0x...", // Host contract address
38
+ consensusStateId: "GNO0"
39
+ })
40
+
41
+ const hyperbridgeChain = new SubstrateChain({
42
+ stateMachineId: "KUSAMA-4009",
43
+ wsUrl: "wss://gargantua.polytope.technology",
44
+ hasher: "Keccak",
45
+ consensusStateId: "PAS0"
46
+ })
47
+
48
+ // Connect to Substrate chain
49
+ await hyperbridgeChain.connect()
50
+
51
+ // Create the IndexerClient
26
52
  const indexer = new IndexerClient({
27
53
  queryClient: queryClient,
28
54
  pollInterval: 1_000, // Every second
29
- source: {
30
- consensusStateId: "BSC0",
31
- rpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545",
32
- stateMachineId: "EVM-97",
33
- host: "0x...", // Host contract address
34
- },
35
- dest: {
36
- consensusStateId: "GNO0",
37
- rpcUrl: "https://rpc.chiadochain.net",
38
- stateMachineId: "EVM-10200",
39
- host: "0x...", // Host contract address
40
- },
41
- hyperbridge: {
42
- consensusStateId: "PAS0",
43
- stateMachineId: "KUSAMA-4009",
44
- wsUrl: "wss://gargantua.polytope.technology",
45
- },
55
+ source: sourceChain,
56
+ dest: destChain,
57
+ hyperbridge: hyperbridgeChain
46
58
  })
47
59
  ```
48
60
 
61
+
49
62
  ### Monitor Post Request Status
50
63
 
51
64
  ```ts