@cityofzion/bs-solana 2.0.8 → 2.0.10
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/dist/BSSolana.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class BSSolana<N extends string = string> implements IBSSolana<N>
|
|
|
11
11
|
readonly tokens: TBSToken[];
|
|
12
12
|
readonly nativeTokens: TBSToken[];
|
|
13
13
|
network: TBSNetwork<TBSSolanaNetworkId>;
|
|
14
|
-
|
|
14
|
+
rpcNetworkUrls: string[];
|
|
15
15
|
readonly availableNetworks: TBSNetwork<TBSSolanaNetworkId>[];
|
|
16
16
|
readonly defaultNetwork: TBSNetwork<TBSSolanaNetworkId>;
|
|
17
17
|
ledgerService: Web3LedgerServiceSolana<N>;
|
package/dist/BSSolana.js
CHANGED
|
@@ -91,13 +91,13 @@ class BSSolana {
|
|
|
91
91
|
this.setNetwork(network !== null && network !== void 0 ? network : this.defaultNetwork);
|
|
92
92
|
}
|
|
93
93
|
setNetwork(network) {
|
|
94
|
-
const
|
|
95
|
-
const isValidNetwork = blockchain_service_1.BSUtilsHelper.validateNetwork(network, this.availableNetworks,
|
|
94
|
+
const rpcNetworkUrls = BSSolanaConstants_1.BSSolanaConstants.RPC_LIST_BY_NETWORK_ID[network.id] || [];
|
|
95
|
+
const isValidNetwork = blockchain_service_1.BSUtilsHelper.validateNetwork(network, this.availableNetworks, rpcNetworkUrls);
|
|
96
96
|
if (!isValidNetwork) {
|
|
97
97
|
throw new Error(`Network with id ${network.id} is not available for ${this.name}`);
|
|
98
98
|
}
|
|
99
99
|
this.network = network;
|
|
100
|
-
this.
|
|
100
|
+
this.rpcNetworkUrls = rpcNetworkUrls;
|
|
101
101
|
this.tokenService = new TokenServiceSolana_1.TokenServiceSolana();
|
|
102
102
|
this.blockchainDataService = new TatumRpcBDSSolana_1.TatumRpcBDSSolana(this);
|
|
103
103
|
this.nftDataService = new TatumRpcNDSSolana_1.TatumRpcNDSSolana(this);
|
|
@@ -143,10 +143,7 @@ class BSSolana {
|
|
|
143
143
|
catch (_a) {
|
|
144
144
|
keyBuffer = Uint8Array.from(key.split(',').map(Number));
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
return true;
|
|
146
|
+
return (keyBuffer === null || keyBuffer === void 0 ? void 0 : keyBuffer.length) === KEY_BYTES_LENGTH;
|
|
150
147
|
}
|
|
151
148
|
generateAccountFromMnemonic(mnemonic, index) {
|
|
152
149
|
const bip44Path = this.bip44DerivationPath.replace('?', index.toString());
|
|
@@ -4,7 +4,7 @@ export declare class BSSolanaConstants {
|
|
|
4
4
|
static readonly DEFAULT_BIP44_DERIVATION_PATH = "m/44'/501'/?'/0'";
|
|
5
5
|
static readonly NATIVE_TOKEN: TBSToken;
|
|
6
6
|
static readonly NATIVE_WRAPPED_HASH = "So11111111111111111111111111111111111111112";
|
|
7
|
-
static readonly RPC_LIST_BY_NETWORK_ID:
|
|
7
|
+
static readonly RPC_LIST_BY_NETWORK_ID: Record<TBSSolanaNetworkId, string[]>;
|
|
8
8
|
static readonly MAINNET_NETWORK: TBSNetwork<TBSSolanaNetworkId>;
|
|
9
9
|
static readonly TESTNET_NETWORK: TBSNetwork<TBSSolanaNetworkId>;
|
|
10
10
|
static readonly ALL_NETWORKS: TBSNetwork<TBSSolanaNetworkId>[];
|
|
@@ -63,16 +63,9 @@ const BSSolanaConstants_1 = require("../../constants/BSSolanaConstants");
|
|
|
63
63
|
const web3_js_1 = __importDefault(require("@solana/web3.js"));
|
|
64
64
|
const solanaSplSDK = __importStar(require("@solana/spl-token"));
|
|
65
65
|
const BSSolanaCachedMethodsHelper_1 = require("../../helpers/BSSolanaCachedMethodsHelper");
|
|
66
|
-
const BSSolanaHelper_1 = require("../../helpers/BSSolanaHelper");
|
|
67
66
|
class TatumRpcBDSSolana {
|
|
68
67
|
static getConnection(network) {
|
|
69
|
-
return new web3_js_1.default.Connection(TatumRpcBDSSolana.URL_BY_NETWORK_ID[network.id]
|
|
70
|
-
httpHeaders: {
|
|
71
|
-
'x-api-key': BSSolanaHelper_1.BSSolanaHelper.isMainnetNetwork(network)
|
|
72
|
-
? process.env.TATUM_MAINNET_API_KEY
|
|
73
|
-
: process.env.TATUM_TESTNET_API_KEY,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
68
|
+
return new web3_js_1.default.Connection(TatumRpcBDSSolana.URL_BY_NETWORK_ID[network.id]);
|
|
76
69
|
}
|
|
77
70
|
constructor(service) {
|
|
78
71
|
_TatumRpcBDSSolana_instances.add(this);
|
|
@@ -366,6 +359,6 @@ _TatumRpcBDSSolana_service = new WeakMap(), _TatumRpcBDSSolana_connection = new
|
|
|
366
359
|
});
|
|
367
360
|
};
|
|
368
361
|
TatumRpcBDSSolana.URL_BY_NETWORK_ID = {
|
|
369
|
-
'mainnet-beta': 'https://
|
|
370
|
-
devnet: 'https://
|
|
362
|
+
'mainnet-beta': 'https://api.coz.io/api/v2/solana/meta/mainnet',
|
|
363
|
+
devnet: 'https://api.coz.io/api/v2/solana/meta/devnet',
|
|
371
364
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-solana",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@ledgerhq/hw-transport": "~6.31.11",
|
|
22
22
|
"@metaplex-foundation/js": "~0.20.1",
|
|
23
23
|
"date-fns": "~4.1.0",
|
|
24
|
-
"@cityofzion/blockchain-service": "1.22.
|
|
24
|
+
"@cityofzion/blockchain-service": "1.22.7"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@ledgerhq/hw-transport-node-hid": "~6.29.12",
|