@notifi-network/fusion-sdk 0.0.2 → 0.0.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EthCallRequest, EthCallResponse, GetAccountBalanceRequest, GetAccountBalanceResponse, BcmGetSuiAccountBalanceRequest, BcmGetSuiAccountBalanceResponse, BcmRunSuiTransactionCallRequest, BcmRunSuiTransactionCallResponse, BcmGetSuiObjectRequest, BcmGetSuiObjectResponse, BcmGetSolanaBalanceRequest, BcmGetSolanaBalanceResponse, BcmGetSolanaAccountInfoRequest, BcmGetSolanaAccountInfoResponse, BcmGetSolanaSlotRequest, BcmGetSolanaSlotResponse } from "../protos_gen/services/blockchain_manager/v1/blockchain_manager.js";
|
|
2
|
+
import { BlockchainType } from "../protos_gen/notifi/common/v1/types.js";
|
|
2
3
|
/**
|
|
3
4
|
* Class for interacting with the Fusion EVM RPC service.
|
|
4
5
|
* Provides methods to perform Ethereum-specific blockchain operations.
|
|
@@ -6,6 +7,10 @@ import { EthCallRequest, EthCallResponse, GetAccountBalanceRequest, GetAccountBa
|
|
|
6
7
|
export declare class FusionEvmRpcWrapper {
|
|
7
8
|
private client;
|
|
8
9
|
private contextId;
|
|
10
|
+
/**
|
|
11
|
+
* Expose BlockchainType enum for external usage.
|
|
12
|
+
*/
|
|
13
|
+
static BlockchainType: typeof BlockchainType;
|
|
9
14
|
/**
|
|
10
15
|
* Creates an instance of FusionEvmRpc.
|
|
11
16
|
* @param contextId - The context ID for the gRPC requests.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { FusionEvmRpcClient, FusionSuiRpcClient, FusionSolanaRpcClient } from "../protos_gen/services/blockchain_manager/v1/blockchain_manager.js";
|
|
2
2
|
import { Metadata, credentials } from "@grpc/grpc-js";
|
|
3
|
-
|
|
3
|
+
import { BlockchainType } from "../protos_gen/notifi/common/v1/types.js";
|
|
4
|
+
const DEFAULT_EVM_ADDRESS = process.env.EVM_RPC_ADDRESS || "localhost:50054";
|
|
5
|
+
const DEFAULT_SOLANA_ADDRESS = process.env.SOLANA_RPC_ADDRESS || "localhost:50055";
|
|
6
|
+
const DEFAULT_SUI_ADDRESS = process.env.SUI_RPC_ADDRESS || "localhost:50057";
|
|
4
7
|
/**
|
|
5
8
|
* Class for interacting with the Fusion EVM RPC service.
|
|
6
9
|
* Provides methods to perform Ethereum-specific blockchain operations.
|
|
@@ -8,6 +11,10 @@ const DEFAULT_ADDRESS = process.env.BLOCKCHAIN_MANAGER_ADDRESS || "localhost:500
|
|
|
8
11
|
export class FusionEvmRpcWrapper {
|
|
9
12
|
client;
|
|
10
13
|
contextId;
|
|
14
|
+
/**
|
|
15
|
+
* Expose BlockchainType enum for external usage.
|
|
16
|
+
*/
|
|
17
|
+
static BlockchainType = BlockchainType;
|
|
11
18
|
/**
|
|
12
19
|
* Creates an instance of FusionEvmRpc.
|
|
13
20
|
* @param contextId - The context ID for the gRPC requests.
|
|
@@ -15,8 +22,8 @@ export class FusionEvmRpcWrapper {
|
|
|
15
22
|
constructor(contextId) {
|
|
16
23
|
this.contextId = contextId;
|
|
17
24
|
// Only use insecure connection for local development
|
|
18
|
-
// Check
|
|
19
|
-
this.client = new FusionEvmRpcClient(
|
|
25
|
+
// Check DEFAULT_EVM_ADDRESS if it contains "localhost", and if so, use insecure connection
|
|
26
|
+
this.client = new FusionEvmRpcClient(DEFAULT_EVM_ADDRESS, DEFAULT_EVM_ADDRESS.startsWith("localhost") ? credentials.createInsecure() : credentials.createSsl());
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Executes an Ethereum call operation.
|
|
@@ -68,7 +75,7 @@ export class FusionSuiRpcWrapper {
|
|
|
68
75
|
*/
|
|
69
76
|
constructor(contextId) {
|
|
70
77
|
this.contextId = contextId;
|
|
71
|
-
this.client = new FusionSuiRpcClient(
|
|
78
|
+
this.client = new FusionSuiRpcClient(DEFAULT_SUI_ADDRESS, DEFAULT_SUI_ADDRESS.startsWith("localhost") ? credentials.createInsecure() : credentials.createSsl());
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
74
81
|
* Retrieves the account balance for a Sui address.
|
|
@@ -138,7 +145,7 @@ export class FusionSolanaRpcWrapper {
|
|
|
138
145
|
*/
|
|
139
146
|
constructor(contextId) {
|
|
140
147
|
this.contextId = contextId;
|
|
141
|
-
this.client = new FusionSolanaRpcClient(
|
|
148
|
+
this.client = new FusionSolanaRpcClient(DEFAULT_SOLANA_ADDRESS, DEFAULT_SOLANA_ADDRESS.startsWith("localhost") ? credentials.createInsecure() : credentials.createSsl());
|
|
142
149
|
}
|
|
143
150
|
/**
|
|
144
151
|
* Retrieves the balance for a Solana address.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notifi-network/fusion-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "SDK utils for Notifi Fusion parser development. This includes types and helpers for accessing ephemeral/persistent storage, RPCs for different chains, and other utilities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@bufbuild/protobuf": "^2.3.0",
|
|
26
27
|
"@grpc/grpc-js": "^1.13.3",
|
|
27
28
|
"@types/node": "^22.15.17",
|
|
28
29
|
"inquirer": "^12.5.2",
|
|
@@ -33,7 +34,6 @@
|
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@bufbuild/buf": "^1.53.0",
|
|
36
|
-
"@bufbuild/protobuf": "^2.3.0",
|
|
37
37
|
"protoc-gen-ts": "^0.8.7",
|
|
38
38
|
"ts-proto": "^2.7.0",
|
|
39
39
|
"@types/ini": "^4.1.1",
|