@massalabs/wallet-provider 1.3.6-dev.20230913090211 → 1.3.6-dev.20230918072432
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/bundle.js +46 -1
- package/bundle.min.js +1 -1
- package/dist/bearbyWallet/BearbyConnect.d.ts.map +1 -1
- package/dist/bearbyWallet/BearbyConnect.js +0 -1
- package/dist/bearbyWallet/BearbyProvider.d.ts +1 -0
- package/dist/bearbyWallet/BearbyProvider.d.ts.map +1 -1
- package/dist/bearbyWallet/BearbyProvider.js +4 -0
- package/dist/cmd/bearbyWallet/BearbyAccount.js.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyConnect.d.ts.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyConnect.js +0 -1
- package/dist/cmd/bearbyWallet/BearbyConnect.js.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyProvider.d.ts +1 -0
- package/dist/cmd/bearbyWallet/BearbyProvider.d.ts.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyProvider.js +4 -0
- package/dist/cmd/bearbyWallet/BearbyProvider.js.map +1 -1
- package/dist/cmd/connector/Connector.d.ts.map +1 -1
- package/dist/cmd/connector/Connector.js.map +1 -1
- package/dist/cmd/index.d.ts +1 -0
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/index.js +1 -0
- package/dist/cmd/index.js.map +1 -1
- package/dist/cmd/massaStation/MassaStationProvider.d.ts +10 -0
- package/dist/cmd/massaStation/MassaStationProvider.d.ts.map +1 -1
- package/dist/cmd/massaStation/MassaStationProvider.js +24 -0
- package/dist/cmd/massaStation/MassaStationProvider.js.map +1 -1
- package/dist/cmd/provider/IProvider.d.ts +1 -0
- package/dist/cmd/provider/IProvider.d.ts.map +1 -1
- package/dist/cmd/provider/IProvider.js.map +1 -1
- package/dist/cmd/provider/Provider.d.ts +6 -0
- package/dist/cmd/provider/Provider.d.ts.map +1 -1
- package/dist/cmd/provider/Provider.js +17 -0
- package/dist/cmd/provider/Provider.js.map +1 -1
- package/dist/connector/Connector.d.ts.map +1 -1
- package/dist/esm/bearbyWallet/BearbyAccount.js.map +1 -1
- package/dist/esm/bearbyWallet/BearbyConnect.d.ts.map +1 -1
- package/dist/esm/bearbyWallet/BearbyConnect.js +0 -1
- package/dist/esm/bearbyWallet/BearbyConnect.js.map +1 -1
- package/dist/esm/bearbyWallet/BearbyProvider.d.ts +1 -0
- package/dist/esm/bearbyWallet/BearbyProvider.d.ts.map +1 -1
- package/dist/esm/bearbyWallet/BearbyProvider.js +4 -0
- package/dist/esm/bearbyWallet/BearbyProvider.js.map +1 -1
- package/dist/esm/connector/Connector.d.ts.map +1 -1
- package/dist/esm/connector/Connector.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/massaStation/MassaStationProvider.d.ts +10 -0
- package/dist/esm/massaStation/MassaStationProvider.d.ts.map +1 -1
- package/dist/esm/massaStation/MassaStationProvider.js +24 -0
- package/dist/esm/massaStation/MassaStationProvider.js.map +1 -1
- package/dist/esm/provider/IProvider.d.ts +1 -0
- package/dist/esm/provider/IProvider.d.ts.map +1 -1
- package/dist/esm/provider/IProvider.js.map +1 -1
- package/dist/esm/provider/Provider.d.ts +6 -0
- package/dist/esm/provider/Provider.d.ts.map +1 -1
- package/dist/esm/provider/Provider.js +17 -0
- package/dist/esm/provider/Provider.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/massaStation/MassaStationProvider.d.ts +10 -0
- package/dist/massaStation/MassaStationProvider.d.ts.map +1 -1
- package/dist/massaStation/MassaStationProvider.js +24 -0
- package/dist/provider/IProvider.d.ts +1 -0
- package/dist/provider/IProvider.d.ts.map +1 -1
- package/dist/provider/Provider.d.ts +6 -0
- package/dist/provider/Provider.d.ts.map +1 -1
- package/dist/provider/Provider.js +17 -0
- package/package.json +2 -1
package/bundle.js
CHANGED
|
@@ -6307,7 +6307,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
6307
6307
|
exports.disconnectBearby = exports.connectBearby = exports.detectBearby = void 0;
|
|
6308
6308
|
const bearby_js_1 = __webpack_require__(/*! @hicaru/bearby.js */ "./node_modules/@hicaru/bearby.js/dist/index.js");
|
|
6309
6309
|
async function detectBearby() {
|
|
6310
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6311
6310
|
if (globalThis.window && globalThis.window['bearby']) {
|
|
6312
6311
|
return true;
|
|
6313
6312
|
}
|
|
@@ -6377,6 +6376,10 @@ class BearbyProvider {
|
|
|
6377
6376
|
async getNodesUrls() {
|
|
6378
6377
|
return ['https://buildnet.massa.net/api/v2'];
|
|
6379
6378
|
}
|
|
6379
|
+
async getNetwork() {
|
|
6380
|
+
const network = await bearby_js_1.web3.wallet.network;
|
|
6381
|
+
return network.net;
|
|
6382
|
+
}
|
|
6380
6383
|
async generateNewAccount(name) {
|
|
6381
6384
|
throw new Error('Method not implemented.');
|
|
6382
6385
|
}
|
|
@@ -6649,6 +6652,7 @@ var AvailableCommands;
|
|
|
6649
6652
|
AvailableCommands["ProviderDeleteAccount"] = "DELETE_ACCOUNT";
|
|
6650
6653
|
AvailableCommands["ProviderImportAccount"] = "IMPORT_ACCOUNT";
|
|
6651
6654
|
AvailableCommands["ProviderGetNodesUrls"] = "GET_NODES_URLS";
|
|
6655
|
+
AvailableCommands["ProviderGetNetwork"] = "GET_NETWORK";
|
|
6652
6656
|
AvailableCommands["AccountBalance"] = "ACCOUNT_BALANCE";
|
|
6653
6657
|
AvailableCommands["AccountSign"] = "ACCOUNT_SIGN";
|
|
6654
6658
|
AvailableCommands["ProviderGenerateNewAccount"] = "GENERATE_NEW_ACCOUNT";
|
|
@@ -7305,6 +7309,8 @@ class MassaStationProvider {
|
|
|
7305
7309
|
/**
|
|
7306
7310
|
* This method sends an http call to the MassaStation server to obtain node urls.
|
|
7307
7311
|
*
|
|
7312
|
+
* @throws an error if the call fails.
|
|
7313
|
+
*
|
|
7308
7314
|
* @returns a Promise that resolves to a list of node urls.
|
|
7309
7315
|
*/
|
|
7310
7316
|
async getNodesUrls() {
|
|
@@ -7323,6 +7329,28 @@ class MassaStationProvider {
|
|
|
7323
7329
|
throw ex;
|
|
7324
7330
|
}
|
|
7325
7331
|
}
|
|
7332
|
+
/**
|
|
7333
|
+
* Returns the name of the network MassaStation is connected to.
|
|
7334
|
+
*
|
|
7335
|
+
* @throws an error if the call fails.
|
|
7336
|
+
*
|
|
7337
|
+
* @returns a Promise that resolves to a network.
|
|
7338
|
+
*/
|
|
7339
|
+
async getNetwork() {
|
|
7340
|
+
let nodesResponse = null;
|
|
7341
|
+
try {
|
|
7342
|
+
nodesResponse = await (0, RequestHandler_1.getRequest)(`${exports.MASSA_STATION_URL}massa/node`);
|
|
7343
|
+
if (nodesResponse.isError || nodesResponse.error) {
|
|
7344
|
+
throw nodesResponse.error.message;
|
|
7345
|
+
}
|
|
7346
|
+
const nodes = nodesResponse.result;
|
|
7347
|
+
return nodes.network;
|
|
7348
|
+
}
|
|
7349
|
+
catch (ex) {
|
|
7350
|
+
console.error(`MassaStation nodes retrieval error`, ex);
|
|
7351
|
+
throw ex;
|
|
7352
|
+
}
|
|
7353
|
+
}
|
|
7326
7354
|
/**
|
|
7327
7355
|
* This method sends an http call to the MassaStation server to create a new random account.
|
|
7328
7356
|
*
|
|
@@ -7663,6 +7691,23 @@ class Provider {
|
|
|
7663
7691
|
});
|
|
7664
7692
|
});
|
|
7665
7693
|
}
|
|
7694
|
+
/**
|
|
7695
|
+
* Returns the name of the network the provider is connected to.
|
|
7696
|
+
*
|
|
7697
|
+
* @returns a Promise that resolves to the network name (string).
|
|
7698
|
+
*/
|
|
7699
|
+
async getNetwork() {
|
|
7700
|
+
return new Promise((resolve, reject) => {
|
|
7701
|
+
Connector_1.connector.sendMessageToContentScript(this.providerName, __1.AvailableCommands.ProviderGetNetwork, {}, (result, err) => {
|
|
7702
|
+
if (err)
|
|
7703
|
+
return reject(err);
|
|
7704
|
+
else if (typeof result !== 'string') {
|
|
7705
|
+
return reject(new Error(`Expected a string but got ${typeof result} instead`));
|
|
7706
|
+
}
|
|
7707
|
+
return resolve(result);
|
|
7708
|
+
});
|
|
7709
|
+
});
|
|
7710
|
+
}
|
|
7666
7711
|
/**
|
|
7667
7712
|
* This method generates a new account by a given name and adds it to the wallet.
|
|
7668
7713
|
*
|